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 Dalek v1.0.1
Dalek.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using REPOLib.Objects.Sdk; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("Dalek")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+6ee3f7d4bcc058301a131a52f8d2709514a87aab")] [assembly: AssemblyProduct("Dalek")] [assembly: AssemblyTitle("Dalek")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [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 Dalek { internal sealed class DalekAssets { internal sealed class Part { internal string Name; internal int Parent; internal Vector3 LocalPosition; internal Mesh Mesh; internal int[] MaterialOfSub; } internal Material[] Materials; internal string[] MaterialNames; internal Part[] Parts; internal Dictionary<string, (int part, Vector3 at)> Markers = new Dictionary<string, (int, Vector3)>(); private static DalekAssets cached; private static Shader shader; internal static DalekAssets Get() { return cached ?? (cached = Load()); } private static DalekAssets Load() { //IL_00c7: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01c3: Expected O, but got Unknown using BinaryReader binaryReader = new BinaryReader(new MemoryStream(Resource("dalek.bin"))); if (new string(binaryReader.ReadChars(4)) != "DLK1") { throw new InvalidDataException("dalek.bin: bad header"); } DalekAssets dalekAssets = new DalekAssets(); int num = binaryReader.ReadInt32(); dalekAssets.Materials = (Material[])(object)new Material[num]; dalekAssets.MaterialNames = new string[num]; Color colour = default(Color); Color emission = default(Color); for (int i = 0; i < num; i++) { string text = Name(binaryReader); ((Color)(ref colour))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); float metallic = binaryReader.ReadSingle(); float smooth = binaryReader.ReadSingle(); ((Color)(ref emission))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); dalekAssets.MaterialNames[i] = text; dalekAssets.Materials[i] = Material(text, colour, metallic, smooth, emission); } int num2 = binaryReader.ReadInt32(); dalekAssets.Parts = new Part[num2]; int num3 = 0; for (int j = 0; j < num2; j++) { Part part = new Part { Name = Name(binaryReader), Parent = binaryReader.ReadInt32(), LocalPosition = V3(binaryReader) }; int num4 = binaryReader.ReadInt32(); num3 += num4; Vector3[] array = (Vector3[])(object)new Vector3[num4]; Vector3[] array2 = (Vector3[])(object)new Vector3[num4]; for (int k = 0; k < num4; k++) { array[k] = V3(binaryReader); } for (int l = 0; l < num4; l++) { array2[l] = V3(binaryReader); } int num5 = binaryReader.ReadInt32(); Mesh val = new Mesh { name = "Dalek " + part.Name, indexFormat = (IndexFormat)(num4 > 65000) }; val.vertices = array; val.normals = array2; val.subMeshCount = num5; part.MaterialOfSub = new int[num5]; for (int m = 0; m < num5; m++) { part.MaterialOfSub[m] = binaryReader.ReadInt32(); int num6 = binaryReader.ReadInt32(); int[] array3 = new int[num6]; for (int n = 0; n < num6; n++) { array3[n] = binaryReader.ReadInt32(); } val.SetTriangles(array3, m); } val.RecalculateBounds(); part.Mesh = val; dalekAssets.Parts[j] = part; } int num7 = binaryReader.ReadInt32(); for (int num8 = 0; num8 < num7; num8++) { string key = Name(binaryReader); dalekAssets.Markers[key] = (binaryReader.ReadInt32(), V3(binaryReader)); } object[] obj = new object[5] { num2, num3, num, string.Join(", ", dalekAssets.Markers.Keys), null }; Shader obj2 = FindShader(); obj[4] = ((obj2 != null) ? ((Object)obj2).name : null); Plugin.Debug(string.Format("model: {0} parts, {1} vertices, {2} materials, markers {3}, shader {4}", obj)); return dalekAssets; } private static Material Material(string name, Color colour, float metallic, float smooth, Color emission) { //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_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_0023: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(FindShader()) { name = "Dalek " + name, color = colour }; val.SetFloat("_Metallic", metallic); val.SetFloat("_Glossiness", smooth); val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", emission); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)0; return val; } internal static Shader FindShader() { if (Object.op_Implicit((Object)(object)shader)) { return shader; } shader = Shader.Find("Standard") ?? ((IEnumerable<Shader>)Resources.FindObjectsOfTypeAll<Shader>()).FirstOrDefault((Func<Shader, bool>)((Shader s) => ((Object)s).name == "Standard")) ?? Shader.Find("Legacy Shaders/Diffuse"); return shader; } internal static byte[] Resource(string name) { using Stream stream = typeof(DalekAssets).Assembly.GetManifestResourceStream(name) ?? throw new FileNotFoundException("missing embedded resource " + name); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } private static string Name(BinaryReader r) { return Encoding.UTF8.GetString(r.ReadBytes(r.ReadByte())); } private static Vector3 V3(BinaryReader r) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle()); } } internal sealed class Body : MonoBehaviour { internal const float Height = 1.75f; private static int count; private static readonly Color EyeCalm = new Color(0.25f, 0.6f, 2.6f); private static readonly Color EyeLocked = new Color(3.2f, 0.12f, 0.05f); private static readonly Color LightsOn = new Color(2.4f, 2.1f, 1.5f); internal int Id; internal Enemy Enemy; internal Transform Self; internal Gun Gun; internal Vector3? LookAt; internal bool Locked; private DalekAssets assets; private Transform model; private Transform top; private Transform dome; private Transform eye; private Transform gun; private readonly Dictionary<string, Transform> markers = new Dictionary<string, Transform>(); private Material[] materials; private Color[] baseColours; private Material eyeMaterial; private Material lightsMaterial; private Light eyeLight; private Light domeLight; private Transform eyeGlow; private Material eyeGlowMaterial; private Transform[] lightGlows; private Material lightGlowMaterial; private AudioSource voice; private AudioSource hum; private readonly float[] samples = new float[256]; private float topYaw; private float domeYaw; private float eyePitch; private float gunYaw; private float gunPitch; private float lockBlend; private float talk; private float flash; private float bob; private float recoil; private Vector3 gunRest; private Vector3 lastPosition; private float speed; internal Vector3 Eyes => Marker("eye_tip"); internal Vector3 GunTip => Marker("gun_tip"); internal Vector3 TopForward { get { //IL_001f: 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) if (!Object.op_Implicit((Object)(object)top)) { return ((Component)this).transform.forward; } return top.forward; } } internal Vector3 LookForward { get { //IL_001f: 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) if (!Object.op_Implicit((Object)(object)eye)) { return ((Component)this).transform.forward; } return eye.forward; } } internal bool Talking { get { if (Object.op_Implicit((Object)(object)voice)) { return voice.isPlaying; } return false; } } internal float Speed => speed; private bool Stunned { get { if (Object.op_Implicit((Object)(object)Enemy)) { return Enemy.IsStunned(); } return false; } } private Vector3 Marker(string name) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0039: Unknown result type (might be due to invalid IL or missing references) if (!markers.TryGetValue(name, out var value) || !Object.op_Implicit((Object)(object)value)) { return ((Component)this).transform.position + Vector3.up * 1.4f; } return value.position; } internal static Body Create(Transform physicsBody, Transform self, float floor) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0035: 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_00b7: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_030f: 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_0326: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_037a: 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_045e: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) DalekAssets dalekAssets = DalekAssets.Get(); GameObject val = new GameObject("Dalek"); val.transform.SetParent(physicsBody, false); val.transform.localPosition = new Vector3(0f, floor, 0f); Body body = val.AddComponent<Body>(); body.Id = ++count; body.Self = self; body.assets = dalekAssets; body.model = new GameObject("Model").transform; body.model.SetParent(val.transform, false); body.model.localScale = Vector3.one * Plugin.Scale.Value; body.materials = ((IEnumerable<Material>)dalekAssets.Materials).Select((Func<Material, Material>)((Material m) => new Material(m))).ToArray(); body.baseColours = body.materials.Select((Material m) => m.color).ToArray(); int num = Array.IndexOf(dalekAssets.MaterialNames, "eye"); int num2 = Array.IndexOf(dalekAssets.MaterialNames, "lights"); body.eyeMaterial = ((num >= 0) ? body.materials[num] : null); body.lightsMaterial = ((num2 >= 0) ? body.materials[num2] : null); Transform[] parts = (Transform[])(object)new Transform[dalekAssets.Parts.Length]; for (int num3 = 0; num3 < parts.Length; num3++) { DalekAssets.Part part = dalekAssets.Parts[num3]; GameObject val2 = new GameObject(part.Name); val2.transform.SetParent((part.Parent < 0) ? body.model : parts[part.Parent], false); val2.transform.localPosition = part.LocalPosition; val2.AddComponent<MeshFilter>().sharedMesh = part.Mesh; MeshRenderer val3 = val2.AddComponent<MeshRenderer>(); ((Renderer)val3).sharedMaterials = part.MaterialOfSub.Select((int m) => body.materials[m]).ToArray(); parts[num3] = val2.transform; } body.top = Find("top"); body.dome = Find("dome"); body.eye = Find("eye"); body.gun = Find("gun"); body.gunRest = (Object.op_Implicit((Object)(object)body.gun) ? body.gun.localPosition : Vector3.zero); foreach (KeyValuePair<string, (int, Vector3)> marker in dalekAssets.Markers) { Transform transform = new GameObject(marker.Key).transform; transform.SetParent(parts[marker.Value.Item1], false); transform.localPosition = marker.Value.Item2; body.markers[marker.Key] = transform; } Fx.Init(); body.eyeLight = body.PointLight("EyeLight", body.markers["eye_tip"], 3.5f); body.domeLight = body.PointLight("DomeLight", body.dome, 3f); ((Component)body.domeLight).transform.localPosition = new Vector3(0f, 0.18f, 0f); body.domeLight.color = new Color(1f, 0.9f, 0.7f); body.eyeGlowMaterial = Fx.Additive((Texture)(object)Fx.SoftTexture); body.eyeGlow = Fx.Quad("EyeGlow", body.markers["eye_tip"], body.eyeGlowMaterial).transform; body.lightGlowMaterial = Fx.Additive((Texture)(object)Fx.SoftTexture); body.lightGlows = (from n in new string[2] { "light_l", "light_r" }.Where(body.markers.ContainsKey) select Fx.Quad("LightGlow", body.markers[n], body.lightGlowMaterial).transform).ToArray(); body.voice = Sfx.Source(Object.op_Implicit((Object)(object)body.dome) ? ((Component)body.dome).gameObject : val, Plugin.VoiceRange.Value); body.hum = Sfx.Source(val, 18f, loop: true); body.hum.minDistance = 2f; body.lastPosition = val.transform.position; body.Gun = val.AddComponent<Gun>(); body.Gun.Init(body); val.AddComponent<Theme>().Init(body); return body; Transform Find(string name) { return ((IEnumerable<Transform>)parts).FirstOrDefault((Func<Transform, bool>)((Transform p) => ((Object)p).name == name)); } } private Light PointLight(string name, Transform parent, float range) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Light val = new GameObject(name).AddComponent<Light>(); ((Component)val).transform.SetParent(parent, false); val.type = (LightType)2; val.range = range; val.intensity = 0f; val.shadows = (LightShadows)0; val.renderMode = (LightRenderMode)1; return val; } internal void Flash() { flash = 1f; } internal void Recoil() { recoil = 1f; } internal void Say(AudioClip clip, bool shout = false) { if (Object.op_Implicit((Object)(object)clip) && Object.op_Implicit((Object)(object)voice)) { voice.Stop(); Sfx.Carry(voice, shout ? Plugin.ShoutRange.Value : Plugin.VoiceRange.Value); voice.clip = clip; voice.volume = Plugin.VoiceVolume.Value; voice.Play(); } } internal void Quiet() { if (Object.op_Implicit((Object)(object)voice)) { voice.Stop(); } } private void LateUpdate() { Safe.Run("body", Animate); } private void Animate() { //IL_001f: 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) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: 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_005f: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00ae: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(Time.deltaTime, 0.05f); if (!(num <= 0f)) { Vector3 val = (((Component)this).transform.position - lastPosition) / num; lastPosition = ((Component)this).transform.position; float num2 = speed; Vector3 val2 = new Vector3(val.x, 0f, val.z); speed = Mathf.Lerp(num2, Mathf.Min(((Vector3)(ref val2)).magnitude, 5f), 1f - Mathf.Exp((0f - num) * 4f)); bob += num; Vector3 val3 = ((flash > 0f) ? (Random.insideUnitSphere * 0.015f * flash) : Vector3.zero); model.localPosition = new Vector3(0f, Mathf.Sin(bob * 1.6f) * 0.015f, 0f) + val3; Aim(num); Glow(num); Hum(); Tint(num); } } private void Aim(float dt) { //IL_0028: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00d3: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f4: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_034e: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_037b: 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_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) Vector3? val = ((Object.op_Implicit((Object)(object)Gun) && Gun.Busy) ? new Vector3?(Gun.Aim) : LookAt); float num = 0f; float num2 = 0f; float num3 = 0f; float num4 = 0f; float num5 = 0f; if (val.HasValue) { Vector3 valueOrDefault = val.GetValueOrDefault(); Vector3 val2 = ((Component)this).transform.InverseTransformDirection(valueOrDefault - ((Component)this).transform.position); num = Mathf.Clamp(Mathf.Atan2(val2.x, val2.z) * 57.29578f, -150f, 150f); Vector2 val4; if (Object.op_Implicit((Object)(object)eye)) { Vector3 val3 = Quaternion.Inverse(Quaternion.Euler(0f, num, 0f) * ((Component)this).transform.rotation) * (valueOrDefault - eye.position); float y = val3.y; val4 = new Vector2(val3.x, val3.z); num3 = Mathf.Clamp((0f - Mathf.Atan2(y, ((Vector2)(ref val4)).magnitude)) * 57.29578f, -25f, 35f); } if (Object.op_Implicit((Object)(object)gun) && Object.op_Implicit((Object)(object)top)) { Vector3 val5 = Quaternion.Inverse(((Component)this).transform.rotation * Quaternion.Euler(0f, topYaw, 0f)) * (valueOrDefault - gun.position); num4 = Mathf.Clamp(Mathf.Atan2(val5.x, val5.z) * 57.29578f, -30f, 30f); float y2 = val5.y; val4 = new Vector2(val5.x, val5.z); num5 = Mathf.Clamp((0f - Mathf.Atan2(y2, ((Vector2)(ref val4)).magnitude)) * 57.29578f, -35f, 35f); } } else if (Stunned) { num2 = Mathf.Sin(bob * 2.3f) * 55f + Mathf.Sin(bob * 5.1f) * 20f; num3 = 32f + Mathf.Sin(bob * 3f) * 6f; } else { num2 = Mathf.Sin(bob * 0.45f) * 40f + Mathf.Sin(bob * 1.1f) * 8f; num3 = Mathf.Sin(bob * 0.7f) * 6f; } topYaw = Mathf.MoveTowardsAngle(topYaw, num, 110f * dt); domeYaw = Mathf.MoveTowardsAngle(domeYaw, num2, 45f * dt); eyePitch = Mathf.MoveTowards(eyePitch, num3, 60f * dt); gunYaw = Mathf.MoveTowards(gunYaw, num4, 90f * dt); gunPitch = Mathf.MoveTowards(gunPitch, num5, 90f * dt); if (Object.op_Implicit((Object)(object)top)) { top.localRotation = Quaternion.Euler(0f, topYaw, 0f); } if (Object.op_Implicit((Object)(object)dome)) { dome.localRotation = Quaternion.Euler(0f, domeYaw, 0f); } if (Object.op_Implicit((Object)(object)eye)) { eye.localRotation = Quaternion.Euler(eyePitch, 0f, 0f); } recoil = Mathf.MoveTowards(recoil, 0f, dt * 7f); if (Object.op_Implicit((Object)(object)gun)) { gun.localRotation = Quaternion.Euler(gunPitch, gunYaw, 0f); gun.localPosition = gunRest - gun.localRotation * Vector3.forward * (0.035f * recoil); } } private void Glow(float dt) { //IL_007a: 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_008a: 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_0095: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_011a: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) lockBlend = Mathf.MoveTowards(lockBlend, Locked ? 1f : 0f, dt * 3f); float num = ((!Stunned) ? (Locked ? (0.85f + 0.15f * Mathf.Sin(Time.time * 9f)) : 1f) : ((Random.value < 0.25f) ? 0.1f : 0.6f)); Color val = Color.Lerp(EyeCalm, EyeLocked, lockBlend) * num; if (Object.op_Implicit((Object)(object)eyeMaterial)) { eyeMaterial.SetColor("_EmissionColor", val); } Color val2 = new Color(val.r, val.g, val.b) / Mathf.Max(((Color)(ref val)).maxColorComponent, 0.01f); eyeLight.color = val2; eyeLight.intensity = 1.6f * num; Camera main = Camera.main; if (Object.op_Implicit((Object)(object)main)) { eyeGlow.rotation = ((Component)main).transform.rotation; Transform[] array = lightGlows; foreach (Transform val3 in array) { val3.rotation = ((Component)main).transform.rotation; } } eyeGlow.localScale = Vector3.one * (0.14f + 0.04f * lockBlend); Fx.SetTint(eyeGlowMaterial, val2 * 0.45f * num); float num2 = 0f; if (Object.op_Implicit((Object)(object)voice) && voice.isPlaying) { voice.GetOutputData(samples, 0); float num3 = 0f; float[] array2 = samples; foreach (float num4 in array2) { num3 += num4 * num4; } num2 = Mathf.Clamp01(Mathf.Sqrt(num3 / (float)samples.Length) * 7f); } talk = ((num2 > talk) ? Mathf.Lerp(talk, num2, 1f - Mathf.Exp((0f - dt) * 30f)) : Mathf.MoveTowards(talk, num2, dt * 5f)); if (Object.op_Implicit((Object)(object)lightsMaterial)) { lightsMaterial.SetColor("_EmissionColor", LightsOn * talk); } domeLight.intensity = 1.8f * talk; Transform[] array3 = lightGlows; foreach (Transform val4 in array3) { val4.localScale = Vector3.one * (0.12f * talk); } Fx.SetTint(lightGlowMaterial, new Color(1f, 0.9f, 0.7f) * 0.5f * talk); } private void Hum() { AudioClip val = Sfx.One("hover_loop"); if (Object.op_Implicit((Object)(object)val)) { if (!hum.isPlaying) { hum.clip = val; hum.time = Random.Range(0f, val.length * 0.9f); hum.Play(); } float num = Mathf.Clamp01(speed / 1.5f); hum.volume = Plugin.HoverVolume.Value * (0.45f + 0.55f * num); hum.pitch = 0.94f + 0.1f * num; } } private void Tint(float dt) { //IL_006c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (flash <= 0f) { return; } flash = Mathf.Max(0f, flash - dt * 4f); for (int i = 0; i < materials.Length; i++) { if (!((Object)(object)materials[i] == (Object)(object)eyeMaterial) && !((Object)(object)materials[i] == (Object)(object)lightsMaterial)) { materials[i].color = Color.Lerp(baseColours[i], new Color(1f, 0.15f, 0.1f), flash); materials[i].SetColor("_EmissionColor", new Color(0.6f, 0.02f, 0f) * flash); } } } private void OnDisable() { if (Object.op_Implicit((Object)(object)hum)) { hum.Stop(); } if (Object.op_Implicit((Object)(object)voice)) { voice.Stop(); } } } internal sealed class Brain : MonoBehaviour, IPunObservable { private enum Mode { Patrol, Investigate, Engage, Pursue, Leave } private const float CatchUpSpeed = 8f; private const float Spread = 0.12f; private Enemy enemy; private EnemyParent parent; private PhotonView view; private Body body; private Gun gun; private Sight sight; private Transform feet; private Mode mode; private PlayerAvatar target; private Vector3 lastSeen; private Vector3 lastChest; private Vector3 moving; private float lastSeenAt = -99f; private readonly Queue<(float at, Vector3 where)> trail = new Queue<(float, Vector3)>(); private Vector3? noise; private float tipOffAt; private float lookAroundUntil; private float leaveUntil; private bool wasStunned; private const float BeamCharge = 0.5f; private int shotsLeft; private float nextShot; private float nextBurst; private float burstAt = -1f; private float beamUntil = -1f; private bool shoutedThisLock; private bool beamNext; private float voiceUntil; private float nextChatter; private float nextCombatLine; private Vector3 goal; private bool hasGoal; private float speed; private Quaternion facing; private bool looking; private Vector3 lookAt; private int spawns; internal static bool debugPending; private void Awake() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown enemy = ((Component)this).GetComponent<Enemy>(); view = ((Component)this).GetComponent<PhotonView>(); parent = ((Component)this).GetComponentInParent<EnemyParent>(true); Transform val = ((Component)this).transform.parent.Find("Rigidbody"); feet = val.Find("Feet Transform"); body = Body.Create(val, Object.op_Implicit((Object)(object)parent) ? ((Component)parent).transform : ((Component)this).transform.parent, 0f - Shell.BodyHeight); body.Enemy = enemy; gun = body.Gun; gun.OnShock = delegate(PlayerAvatar player) { Send("ShockRPC", player.photonView.ViewID, Plugin.ShockSeconds.Value); }; sight = new Sight(Object.op_Implicit((Object)(object)parent) ? ((Component)parent).transform : ((Component)this).transform.parent); facing = ((Component)this).transform.rotation; ((Component)this).GetComponent<EnemyStateSpawn>().OnSpawn.AddListener(new UnityAction(OnSpawn)); EnemyHealth component = ((Component)this).GetComponent<EnemyHealth>(); component.onHurt.AddListener(new UnityAction(OnHurt)); component.onDeath.AddListener(new UnityAction(OnDeath)); EnemyStateInvestigate ears = ((Component)this).GetComponent<EnemyStateInvestigate>(); if (ears != null) { ears.onInvestigateTriggered.AddListener((UnityAction)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Heard(ears.onInvestigateTriggeredPosition); }); } } private void OnSpawn() { //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) if (Net.IsHost) { SemiFunc.EnemySpawn(enemy); mode = Mode.Patrol; Unlock(); noise = null; hasGoal = false; wasStunned = false; facing = ((Component)this).transform.rotation; tipOffAt = Time.time + 8f; nextChatter = Time.time + Random.Range(4f, 10f); spawns++; string text = (debugPending ? "by the debug key" : "naturally"); debugPending = false; Log((spawns == 1) ? ("spawned " + text) : $"spawned {text} (back again, #{spawns} this level)"); } } private void OnHurt() { body.Flash(); if (Net.IsHost && mode == Mode.Leave) { mode = Mode.Patrol; } } private void OnDeath() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) gun.Busy = false; body.Quiet(); PlayAt(Sfx.One("death"), enemy.CenterTransform.position, 1f); Transform val = (Object.op_Implicit((Object)(object)parent) ? ((Component)parent).transform.Find("Particles") : null); if (Object.op_Implicit((Object)(object)val)) { ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren) { ((Component)val2).transform.position = enemy.CenterTransform.position; val2.Play(); } } if (Object.op_Implicit((Object)(object)GameDirector.instance)) { GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, enemy.CenterTransform.position, 0.5f); GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, enemy.CenterTransform.position, 0.05f); } if (Net.IsHost) { Log("destroyed"); parent.Despawn(); } } private static void PlayAt(AudioClip clip, Vector3 at, float volume) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)clip)) { GameObject val = new GameObject("Dalek one-shot"); val.transform.position = at; AudioSource val2 = Sfx.Source(val, Plugin.ShoutRange.Value); Sfx.Carry(val2, Plugin.ShoutRange.Value); val2.volume = volume * Plugin.VoiceVolume.Value; val2.clip = clip; val2.Play(); Object.Destroy((Object)(object)val, clip.length + 0.2f); } } private void Heard(Vector3 position) { //IL_0045: 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_002b: Unknown result type (might be due to invalid IL or missing references) if (Net.IsHost && mode != Mode.Engage) { if (!noise.HasValue) { Log($"heard something {Vector3.Distance(position, ((Component)this).transform.position):0} m away"); } noise = position; } } private void Update() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (Net.IsHost) { if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated) { Safe.Run("brain", Think); } } else { body.LookAt = (looking ? new Vector3?(lookAt) : ((Vector3?)null)); } } private void Think() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_027b: 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_0286: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01c8: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) if ((int)enemy.CurrentState == 11) { gun.Busy = false; parent.Despawn(); return; } if (enemy.IsStunned()) { if (!wasStunned) { wasStunned = true; CeaseFire(); Say("stunned", force: true); Log("stunned"); } enemy.NavMeshAgent.Disable(0.1f); ((Component)this).transform.position = feet.position; body.LookAt = null; looking = false; return; } if (wasStunned) { wasStunned = false; enemy.NavMeshAgent.Warp(feet.position, false); enemy.NavMeshAgent.ResetPath(); hasGoal = false; nextBurst = Time.time + 1f; } Vector3 eyes = body.Eyes; float value = Plugin.GunRange.Value; if (Object.op_Implicit((Object)(object)target) && target.isDisabled) { Log(target.playerName + " is down"); Unlock(); } bool flag = Object.op_Implicit((Object)(object)target) && sight.Visible(target, eyes, Mathf.Max(value, Plugin.VisionRange.Value)); if (flag) { Vector3 val = Chest(target); if (Time.time - lastSeenAt < 0.5f && Time.deltaTime > 0f) { moving = Vector3.Lerp(moving, (val - lastChest) / Time.deltaTime, 1f - Mathf.Exp((0f - Time.deltaTime) * 6f)); } lastChest = (lastSeen = val); lastSeenAt = Time.time; } else if (mode != Mode.Leave) { List<PlayerAvatar> list = sight.Look(eyes, body.LookForward); if (list.Count > 0) { bool flag2 = !Object.op_Implicit((Object)(object)target); target = list[0]; flag = true; lastChest = (lastSeen = Chest(target)); moving = Vector3.zero; lastSeenAt = Time.time; gun.Aim = lastSeen; trail.Clear(); if (flag2) { shoutedThisLock = false; nextBurst = Mathf.Max(nextBurst, Time.time + 0.8f); Say("combat"); nextCombatLine = Time.time + Random.Range(8f, 14f); } Log($"spotted {target.playerName}, {Vector3.Distance(eyes, lastSeen):0} m"); } } bool flag3 = shotsLeft > 0 || burstAt >= 0f || Time.time < beamUntil; if (Time.time < beamUntil || (flag3 && Object.op_Implicit((Object)(object)target) && Time.time - lastSeenAt < 1.5f)) { Engage(flag); } else if (flag && Vector3.Distance(eyes, lastSeen) <= value) { Engage(flag); } else if (Object.op_Implicit((Object)(object)target) && Time.time - lastSeenAt < Plugin.SearchSeconds.Value) { CeaseFire(); Pursue(flag); } else if (mode == Mode.Leave || SemiFunc.EnemyForceLeave(enemy)) { CeaseFire(); Unlock(); Leave(); } else if (noise.HasValue) { CeaseFire(); Unlock(); Investigate(); } else { CeaseFire(); Unlock(); Patrol(); } body.Locked = Object.op_Implicit((Object)(object)target); looking = Object.op_Implicit((Object)(object)target) && flag; lookAt = (looking ? PlayerEyes(target) : Vector3.zero); body.LookAt = (looking ? new Vector3?(lookAt) : ((Vector3?)null)); Turn(); } private void Engage(bool seeing) { //IL_0045: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0123: 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) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) mode = Mode.Engage; noise = null; gun.Busy = true; if (Time.time < beamUntil) { Engaged(); return; } Vector3 val = Delayed(seeing ? Chest(target) : Believed()); float value = Plugin.TrackSpeed.Value; float num = Mathf.Lerp(value, Mathf.Max(value, 8f), Mathf.InverseLerp(1f, 3f, Vector3.Distance(gun.Aim, val))); gun.Aim = Vector3.MoveTowards(gun.Aim, val, num * Time.deltaTime); Face(gun.Aim); if (burstAt >= 0f) { Stop(); if (Time.time >= burstAt && OnTarget()) { burstAt = -1f; if (beamNext) { Vector3 val2 = gun.Aim - body.GunTip; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num2 = Mathf.Max(0.2f, Plugin.BeamSeconds.Value); beamUntil = Time.time + 0.5f + num2; nextBurst = beamUntil + Plugin.BurstCooldown.Value; gun.Aim = body.GunTip + normalized * Mathf.Max(2f, Vector3.Distance(body.GunTip, gun.Aim)); Send("BeamRPC", normalized, 0.5f, num2); Log("beam at " + target.playerName); } else { shotsLeft = Mathf.Max(1, Plugin.BurstShots.Value); nextShot = Time.time; } } } else if (shotsLeft > 0) { Stop(); if (Time.time >= nextShot && OnTarget()) { Shoot(); shotsLeft--; nextShot = Time.time + Mathf.Max(0.05f, Plugin.ShotInterval.Value); if (shotsLeft == 0) { nextBurst = Time.time + Plugin.BurstCooldown.Value; } } } else if (Time.time >= nextBurst && seeing) { Stop(); beamNext = Random.value < Plugin.BeamChance.Value; if ((!shoutedThisLock || Random.value < 0.45f) && Sfx.Count("exterminate") > 0 && Time.time >= voiceUntil) { shoutedThisLock = true; float num3 = Say("exterminate", force: true); burstAt = Time.time + Mathf.Max(0.3f, num3 * 0.8f); Log(string.Format("exterminating {0} ({1}), {2:0} m", target.playerName, beamNext ? "beam" : "burst", Vector3.Distance(body.Eyes, lastSeen))); } else { burstAt = Time.time + 0.25f; Log((beamNext ? "beam" : "burst") + " at " + target.playerName); } } else { if (Time.time >= nextCombatLine && Time.time >= voiceUntil) { Say("combat"); nextCombatLine = Time.time + Random.Range(9f, 16f); } float num4 = Vector3.Distance(body.Eyes, lastSeen); if (num4 > Plugin.StopDistance.Value) { GoTo(((Component)target).transform.position, Plugin.Speed.Value); } else { Stop(); } } } private bool OnTarget() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = gun.Aim - body.GunTip; val.y = 0f; Vector3 topForward = body.TopForward; topForward.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { return Vector3.Angle(topForward, val) < 35f; } return true; } private void Shoot() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) Vector3 aim = gun.Aim + Random.insideUnitSphere * 0.12f; Vector3 end; Vector3 surface; Collider struck; bool flag = gun.Trace(aim, out end, out surface, out struck); gun.Damage(struck, end); Send("ShotRPC", end, flag, surface); } private void Engaged() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Stop(); Face(gun.Aim); } private void CeaseFire() { shotsLeft = 0; burstAt = -1f; if (Time.time < beamUntil) { beamUntil = -1f; Send("BeamStopRPC"); } gun.Busy = false; } private void Unlock() { target = null; shoutedThisLock = false; CeaseFire(); } private Vector3 Delayed(Vector3 now) { //IL_000b: 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) trail.Enqueue((Time.time, now)); float num = Time.time - Plugin.ReactionTime.Value; while (trail.Count > 1 && trail.Peek().at < num) { trail.Dequeue(); } return trail.Peek().where; } private Vector3 Believed() { //IL_0032: 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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(Time.time - lastSeenAt, 1f); Vector3 val = Vector3.ClampMagnitude(new Vector3(moving.x, 0f, moving.z), 3f); return lastSeen + val * num; } private void Pursue(bool seeing) { //IL_0096: 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_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_0121: 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) if (mode != Mode.Pursue) { lookAroundUntil = 0f; hasGoal = false; if (!seeing) { Log("lost " + target.playerName + "; going to where he last saw them"); } } mode = Mode.Pursue; if (Time.time >= nextCombatLine && Time.time >= voiceUntil) { Say("combat"); nextCombatLine = Time.time + Random.Range(10f, 18f); } if (seeing) { GoTo(((Component)target).transform.position, Plugin.Speed.Value); return; } if (!Arrived(1f) && !Stuck()) { GoTo(lastSeen, Plugin.Speed.Value); return; } Stop(); if (lookAroundUntil == 0f) { lookAroundUntil = Time.time + 6f; } facing *= Quaternion.Euler(0f, 50f * Time.deltaTime, 0f); if (Time.time > lookAroundUntil) { Log("gave up on " + target.playerName); Unlock(); hasGoal = false; nextChatter = Mathf.Min(nextChatter, Time.time + 2f); } } private void Investigate() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (mode != Mode.Investigate) { hasGoal = false; } mode = Mode.Investigate; GoTo(noise.Value, Plugin.Speed.Value * 0.85f); if (Arrived(1.5f) || Stuck()) { noise = null; hasGoal = false; } } private void Patrol() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0135: Unknown result type (might be due to invalid IL or missing references) if (mode != Mode.Patrol) { hasGoal = false; } mode = Mode.Patrol; Chatter(); if (SemiFunc.EnemySpawnIdlePause()) { Stop(); return; } float moveSpeed = Plugin.Speed.Value * 0.67f; if (hasGoal && !Arrived(1.5f) && !Stuck()) { GoTo(goal, moveSpeed); return; } List<LevelPoint> list = (SemiFunc.LevelPointsGetAll() ?? new List<LevelPoint>()).Where((LevelPoint p) => Object.op_Implicit((Object)(object)p) && !p.Truck).ToList(); if (list.Count == 0) { return; } Vector3 position; if (Time.time >= tipOffAt) { PlayerAvatar near = Nearest(); if (near != null) { tipOffAt = Time.time + Plugin.TipOffSeconds.Value; position = ((Component)(from _ in list.OrderBy(delegate(LevelPoint p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)p).transform.position - ((Component)near).transform.position; return ((Vector3)(ref val)).sqrMagnitude; }).Take(4) orderby Random.value select _).First()).transform.position; Log("drifting toward " + near.playerName + "'s area"); goto IL_0175; } } position = ((Component)list[Random.Range(0, list.Count)]).transform.position; goto IL_0175; IL_0175: hasGoal = false; GoTo(position, moveSpeed); } private void Chatter() { float value = Plugin.ChatterSeconds.Value; if (!(value <= 0f) && !(Time.time < nextChatter) && !(Time.time < voiceUntil)) { nextChatter = Time.time + value * Random.Range(0.85f, 1.15f); Say("idle"); } } private void Leave() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (mode != Mode.Leave) { LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 30f, 50f, false) ?? SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f); if (!Object.op_Implicit((Object)(object)val)) { Patrol(); return; } mode = Mode.Leave; hasGoal = false; noise = null; leaveUntil = Time.time + 25f; SemiFunc.EnemyLeaveStart(enemy); GoTo(((Component)val).transform.position, Plugin.Speed.Value); Log("leaving"); } else { GoTo(goal, Plugin.Speed.Value); if (Arrived(1.5f) || Stuck() || Time.time > leaveUntil) { mode = Mode.Patrol; hasGoal = false; } } } private void GoTo(Vector3 destination, float moveSpeed) { //IL_0030: 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_0010: Unknown result type (might be due to invalid IL or missing references) //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) speed = moveSpeed; if (hasGoal) { Vector3 val = Flat(goal - destination); if (!(((Vector3)(ref val)).magnitude > 0.5f)) { goto IL_0052; } } goal = destination; hasGoal = true; enemy.Rigidbody.notMovingTimer = 0f; goto IL_0052; IL_0052: enemy.NavMeshAgent.SetDestination(goal); enemy.NavMeshAgent.OverrideAgent(speed, enemy.NavMeshAgent.DefaultAcceleration, 0.2f); } private void Stop() { speed = 0f; enemy.NavMeshAgent.ResetPath(); } private bool Arrived(float within) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (hasGoal) { Vector3 val = Flat(((Component)this).transform.position - goal); return ((Vector3)(ref val)).magnitude < within + 0.5f; } return false; } private bool Stuck() { if (hasGoal && speed > 0f) { return enemy.Rigidbody.notMovingTimer > 3f; } return false; } private void Face(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_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) Vector3 val = Flat(point - ((Component)this).transform.position); if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { facing = Quaternion.LookRotation(val); } } private void Turn() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Flat(enemy.NavMeshAgent.AgentVelocity); if (mode != Mode.Engage && ((Vector3)(ref val)).sqrMagnitude > 0.04f) { facing = Quaternion.LookRotation(val); } ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, facing, 90f * Time.deltaTime); } private float Say(string set, bool force = false) { if (!force && Time.time < voiceUntil) { return 0f; } int num = Sfx.Pick(set); AudioClip val = Sfx.Get(set, num); if (!Object.op_Implicit((Object)(object)val)) { return 0f; } voiceUntil = Time.time + val.length + 0.4f; Send("SayRPC", set, num); return val.length; } private void Send(string rpc, params object[] args) { //IL_0071: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer()) { view.RPC(rpc, (RpcTarget)0, args); return; } switch (rpc) { case "SayRPC": SayRPC((string)args[0], (int)args[1]); break; case "ShotRPC": ShotRPC((Vector3)args[0], (bool)args[1], (Vector3)args[2]); break; case "BeamRPC": BeamRPC((Vector3)args[0], (float)args[1], (float)args[2]); break; case "BeamStopRPC": BeamStopRPC(); break; case "ShockRPC": ShockRPC((int)args[0], (float)args[1]); break; } } [PunRPC] private void BeamRPC(Vector3 dir, float charge, float seconds, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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) if (SemiFunc.MasterOnlyRPC(info)) { gun.Beam(dir, charge, seconds); } } [PunRPC] private void BeamStopRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { gun.CancelBeam(); } } [PunRPC] private void ShockRPC(int playerView, float seconds, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { PhotonView val = (SemiFunc.IsMultiplayer() ? PhotonView.Find(playerView) : null); PlayerAvatar player = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<PlayerAvatar>() : PlayerAvatar.instance); Shock.Start(player, seconds); } } [PunRPC] private void SayRPC(string set, int index, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { body.Say(Sfx.Get(set, index), set == "exterminate"); } } [PunRPC] private void ShotRPC(Vector3 end, bool struck, Vector3 surface, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { gun.Bolt(end, struck, surface); } } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_006d: 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_005d: 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_0093: 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_00d5: Unknown result type (might be due to invalid IL or missing references) if (stream.IsWriting) { stream.SendNext((object)looking); stream.SendNext((object)lookAt); stream.SendNext((object)body.Locked); stream.SendNext((object)gun.Busy); stream.SendNext((object)gun.Aim); } else if (SemiFunc.MasterOnlyRPC(info)) { looking = (bool)stream.ReceiveNext(); lookAt = (Vector3)stream.ReceiveNext(); body.Locked = (bool)stream.ReceiveNext(); gun.Busy = (bool)stream.ReceiveNext(); gun.Aim = (Vector3)stream.ReceiveNext(); } } internal static void DebugSpawn(Vector3 spot, Quaternion facing) { //IL_0036: 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_0080: 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_005b: Unknown result type (might be due to invalid IL or missing references) EnemyParent val = Shell.All().FirstOrDefault(); debugPending = !Object.op_Implicit((Object)(object)val) || !val.Spawned; if (!Object.op_Implicit((Object)(object)val)) { ManualLogSource log = Plugin.Log; List<EnemyParent> list = Enemies.SpawnEnemy(Shell.Setup, spot, facing, false); log.LogInfo((object)((list != null && list.Count > 0) ? $"debug: spawned at {spot}" : "debug: spawn failed")); return; } if (!val.Spawned) { val.Spawn(); } val.Enemy.EnemyTeleported(spot); Plugin.Log.LogInfo((object)$"debug: moved to {spot}"); } internal static void DebugDespawn() { foreach (EnemyParent item in from p in Shell.All() where p.Spawned select p) { item.Despawn(); Plugin.Log.LogInfo((object)"debug: despawned"); } } private PlayerAvatar Nearest() { return World.Targets().OrderBy(delegate(PlayerAvatar p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)p).transform.position - ((Component)this).transform.position; return ((Vector3)(ref val)).sqrMagnitude; }).FirstOrDefault(); } private void Log(string text) { Plugin.Debug($"dalek #{body.Id}: {text}"); } private static Vector3 Flat(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new Vector3(v.x, 0f, v.z); } internal static Vector3 Chest(PlayerAvatar player) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) if (player.isTumbling && Object.op_Implicit((Object)(object)player.tumble)) { return ((Component)player.tumble).transform.position; } return ((Component)player).transform.position + Vector3.up * (player.isCrawling ? 0.3f : (player.isCrouching ? 0.6f : 1.1f)); } internal static Vector3 PlayerEyes(PlayerAvatar player) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_002a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)player.PlayerVisionTarget) && Object.op_Implicit((Object)(object)player.PlayerVisionTarget.VisionTransform)) { return player.PlayerVisionTarget.VisionTransform.position; } return ((Component)player).transform.position + Vector3.up * 1.5f; } } internal static class Fx { internal static readonly int Tint = Shader.PropertyToID("_TintColor"); internal static Texture2D BeamTexture; internal static Texture2D CrackleTexture; internal static Texture2D GlowTexture; internal static Texture2D SoftTexture; internal static Texture2D ScorchTexture; internal static Material ScorchMaterial; private static Shader additive; private static Shader alpha; private static Shader standardParticles; private static Mesh quad; private static float sparkDebt; private static float smokeDebt; private static float emberDebt; internal static void Init() { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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_0179: Expected O, but got Unknown //IL_021f: 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_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_0242: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)BeamTexture)) { return; } Shader[] loaded = Resources.FindObjectsOfTypeAll<Shader>(); additive = Find("Legacy Shaders/Particles/Additive") ?? Find("Mobile/Particles/Additive"); standardParticles = (Object.op_Implicit((Object)(object)additive) ? null : Find("Particles/Standard Unlit")); if (additive == null) { additive = standardParticles ?? Shader.Find("Sprites/Default"); } alpha = Find("Legacy Shaders/Particles/Alpha Blended") ?? Find("Mobile/Particles/Alpha Blended") ?? Shader.Find("Sprites/Default"); string[] obj = new string[6] { "glow shaders: ", null, null, null, null, null }; Shader obj2 = additive; obj[1] = ((obj2 != null) ? ((Object)obj2).name : null); obj[2] = ", "; Shader obj3 = alpha; obj[3] = ((obj3 != null) ? ((Object)obj3).name : null); obj[4] = "; particle shaders loaded: "; obj[5] = string.Join(", ", (from x in loaded where Object.op_Implicit((Object)(object)x) && ((Object)x).name.Contains("Particle") select ((Object)x).name).Distinct()); Plugin.Debug(string.Concat(obj)); BeamTexture = new Texture2D(4, 64, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, name = "Dalek beam" }; Color val = default(Color); for (int num = 0; num < 64; num++) { float num2 = Mathf.Abs((float)num / 63f - 0.5f) * 2f; float num3 = Mathf.Exp((0f - num2) * num2 * 40f); float num4 = Mathf.Exp((0f - num2) * num2 * 4f); float num5 = Mathf.Clamp01(0.6f * num4 + num3); ((Color)(ref val))..ctor(1f, 1f, 1f, num5); for (int num6 = 0; num6 < 4; num6++) { BeamTexture.SetPixel(num6, num, val); } } BeamTexture.Apply(); CrackleTexture = new Texture2D(64, 32, (TextureFormat)4, false) { wrapModeU = (TextureWrapMode)0, wrapModeV = (TextureWrapMode)1, name = "Dalek crackle" }; for (int num7 = 0; num7 < 64; num7++) { float num8 = (float)num7 / 64f * MathF.PI * 2f; float num9 = 0.55f + 0.45f * Mathf.Sin(num8 * 3f) * Mathf.Sin(num8 * 7f + 1.3f) + 0.15f * Mathf.Sin(num8 * 13f); for (int num10 = 0; num10 < 32; num10++) { float num11 = Mathf.Abs((float)num10 / 31f - 0.5f) * 2f; float num12 = Mathf.Exp((0f - num11) * num11 * 5f) * Mathf.Clamp01(num9); CrackleTexture.SetPixel(num7, num10, Straight(new Color(num12, num12 * 0.25f, num12 * 0.15f))); } } CrackleTexture.Apply(); GlowTexture = Radial("glow", delegate(float d) { //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) float num13 = Mathf.Pow(Mathf.Clamp01(1f - d), 2.2f); return Straight(new Color(num13, Mathf.Exp((0f - d) * d * 30f) * num13, Mathf.Exp((0f - d) * d * 40f) * num13)); }); SoftTexture = Radial("soft", (float d) => new Color(1f, 1f, 1f, Mathf.Pow(Mathf.Clamp01(1f - d), 2f))); ScorchTexture = Radial("scorch", (float d) => new Color(0f, 0f, 0f, 0.9f * Mathf.Pow(Mathf.Clamp01(1f - d), 1.2f))); ScorchMaterial = new Material(alpha) { mainTexture = (Texture)(object)ScorchTexture, renderQueue = 3000 }; ScorchMaterial.SetColor(Tint, new Color(0.5f, 0.5f, 0.5f, 0.5f)); Shader Find(string name) { return Shader.Find(name) ?? Array.Find(loaded, (Shader x) => Object.op_Implicit((Object)(object)x) && ((Object)x).name == name); } } private static Color Straight(Color glow) { //IL_0000: 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_000c: 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_0025: 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_003e: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(glow.r, Mathf.Max(glow.g, glow.b)); if (!(num < 0.0001f)) { return new Color(glow.r / num, glow.g / num, glow.b / num, num); } return new Color(0f, 0f, 0f, 0f); } private static Texture2D Radial(string name, Func<float, Color> colour) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //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_0062: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, name = "Dalek " + name }; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { Vector2 val2 = new Vector2((float)j / 63f - 0.5f, (float)i / 63f - 0.5f); float arg = ((Vector2)(ref val2)).magnitude * 2f; val.SetPixel(j, i, colour(arg)); } } val.Apply(); return val; } internal static Material Additive(Texture texture, float tint = 0.5f) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_002b: 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_0072: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(additive) { mainTexture = texture, renderQueue = 3100 }; val.SetColor(Tint, new Color(tint, tint, tint, 0.5f)); if (Object.op_Implicit((Object)(object)additive) && ((Object)additive).name == "Sprites/Default") { val.color = new Color(tint * 2f, tint * 2f, tint * 2f, 1f); } if ((Object)(object)additive == (Object)(object)standardParticles) { val.SetOverrideTag("RenderType", "Transparent"); val.SetFloat("_Mode", 4f); val.SetInt("_BlendOp", 0); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 1); val.SetInt("_ZWrite", 0); val.EnableKeyword("_ALPHABLEND_ON"); val.SetColor("_Color", new Color(tint * 2f, tint * 2f, tint * 2f, 1f)); } return val; } internal static void SetTint(Material m, Color c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) m.SetColor(Tint, c); if ((Object)(object)additive == (Object)(object)standardParticles) { m.SetColor("_Color", c * 2f); } else if (Object.op_Implicit((Object)(object)additive) && ((Object)additive).name == "Sprites/Default") { m.color = c * 2f; } } internal static GameObject Quad(string name, Transform parent, Material material) { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00fe: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)quad)) { quad = new Mesh { name = "Dalek quad" }; quad.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f), new Vector3(0.5f, 0.5f, 0f) }; quad.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }; quad.triangles = new int[6] { 0, 2, 1, 1, 2, 3 }; quad.RecalculateBounds(); } GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.AddComponent<MeshFilter>().sharedMesh = quad; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).sharedMaterial = material; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; return val; } internal static ParticleSystem Sparks(Transform parent, Color hot, Color warm, Color cool) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_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_00b2: 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_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_00da: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0125: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = System(parent, "Sparks", Additive((Texture)(object)SoftTexture), 600); MainModule main = val.main; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(1f); ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(hot, 0f), new GradientColorKey(warm, 0.3f), new GradientColorKey(cool, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.8f, 0.6f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2); CollisionModule collision = val.collision; ((CollisionModule)(ref collision)).enabled = true; ((CollisionModule)(ref collision)).type = (ParticleSystemCollisionType)1; ((CollisionModule)(ref collision)).dampen = MinMaxCurve.op_Implicit(0.6f); ((CollisionModule)(ref collision)).bounce = MinMaxCurve.op_Implicit(0.3f); ((CollisionModule)(ref collision)).lifetimeLoss = MinMaxCurve.op_Implicit(0.2f); ((CollisionModule)(ref collision)).quality = (ParticleSystemCollisionQuality)2; return val; } internal static ParticleSystem Smoke(Transform parent) { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_003b: 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_0083: 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_0093: 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_00a3: Expected O, but got Unknown //IL_00ad: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0115: 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_0128: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(alpha) { mainTexture = (Texture)(object)SoftTexture, renderQueue = 3050 }; val.SetColor(Tint, new Color(0.12f, 0.1f, 0.1f, 0.35f)); ParticleSystem val2 = System(parent, "Smoke", val, 80); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.4f, 1f, 1.6f)); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.8f, 0.2f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); return val2; } private static ParticleSystem System(Transform parent, string name, Material material, int max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = max; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = false; ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = material; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; val2.Play(); return val2; } internal static void EmitSparks(ParticleSystem ps, Vector3 point, Vector3 normal, float amount) { //IL_000e: 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_0023: 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_0032: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) sparkDebt += amount; EmitParams val = default(EmitParams); while (sparkDebt >= 1f) { ((EmitParams)(ref val)).position = point; ((EmitParams)(ref val)).velocity = Random.onUnitSphere * 1.8f + normal * Random.Range(1.5f, 4f); ((EmitParams)(ref val)).startLifetime = Random.Range(0.4f, 1f); ((EmitParams)(ref val)).startSize = Random.Range(0.015f, 0.035f); ((EmitParams)(ref val)).startColor = Color32.op_Implicit(Color.white); ps.Emit(val, 1); sparkDebt -= 1f; } } internal static void EmitEmbers(ParticleSystem ps, Vector3 from, Vector3 to, float amount) { //IL_000e: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005b: 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_006a: 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_00a7: 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) emberDebt += amount; EmitParams val = default(EmitParams); while (emberDebt >= 1f) { ((EmitParams)(ref val)).position = Vector3.Lerp(from, to, Random.Range(0.1f, 1f)) + Random.insideUnitSphere * 0.03f; ((EmitParams)(ref val)).velocity = Random.insideUnitSphere * 0.4f + Vector3.up * 0.3f; ((EmitParams)(ref val)).startLifetime = Random.Range(0.25f, 0.6f); ((EmitParams)(ref val)).startSize = Random.Range(0.008f, 0.018f); ((EmitParams)(ref val)).startColor = Color32.op_Implicit(Color.white); ps.Emit(val, 1); emberDebt -= 1f; } } internal static void EmitSmoke(ParticleSystem ps, Vector3 point, float amount) { //IL_000e: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) smokeDebt += amount; EmitParams val = default(EmitParams); while (smokeDebt >= 1f) { ((EmitParams)(ref val)).position = point; ((EmitParams)(ref val)).velocity = new Vector3(Random.Range(-0.15f, 0.15f), Random.Range(0.5f, 0.9f), Random.Range(-0.15f, 0.15f)); ((EmitParams)(ref val)).startLifetime = Random.Range(1.2f, 1.8f); ((EmitParams)(ref val)).startSize = Random.Range(0.2f, 0.35f); ((EmitParams)(ref val)).startColor = Color32.op_Implicit(Color