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 MonsterHide v1.0.0
CreatureMod.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CreatureMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CreatureMod")] [assembly: AssemblyTitle("CreatureMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 CreatureMod { internal static class BodyRebuild { private sealed class Part { public Mesh Mesh; public Material[] Mats; public MaterialPropertyBlock Mpb; public Matrix4x4 Rel; public float Height; public float Size; public bool Baked; } private sealed class Template { public readonly List<Part> Parts = new List<Part>(); public string Level; } private sealed class Piece { public GameObject Go; public MeshRenderer R; public Part P; public Vector3 ScatterOff; public Quaternion ScatterRot; public float Lift; public float Start; public float T; public float PrevT; public Vector3 Spin; public float TwitchAt = -9f; public Vector3 TwitchAxis; public Matrix4x4 World; } private sealed class Body { public int Actor; public Template Tpl; public readonly List<Piece> Pieces = new List<Piece>(); public Vector3 Center; public float Floor; public float Yaw; public float K; public float ShownK; public float RisingT = -9f; public float NextTwitch; public Light Light; public readonly List<Renderer> HiddenHead = new List<Renderer>(); public float GoneAt = -1f; public float GhostK = 1f; public float SightTimer; public bool Seen; } private static readonly Dictionary<int, Template> templates = new Dictionary<int, Template>(); private static readonly Dictionary<int, Body> bodies = new Dictionary<int, Body>(); private static readonly List<int> tmp = new List<int>(); private static Material ghostMat; private static ParticleSystem motes; private static bool failed; private static string level; private static float captureTimer; private const float PieceDur = 0.22f; private static readonly Color Green = new Color(0.3f, 1f, 0.45f); private static MaterialPropertyBlock ghostBlock; internal static void Clear() { foreach (Body value in bodies.Values) { DestroyBody(value); } bodies.Clear(); foreach (Template value2 in templates.Values) { foreach (Part part in value2.Parts) { if (part.Baked && Object.op_Implicit((Object)(object)part.Mesh)) { Object.Destroy((Object)(object)part.Mesh); } } } templates.Clear(); } internal static void Update(CreatureManager m) { //IL_00f8: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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) if (!m.Active || Cfg.ReanimActive == null || !Cfg.ReanimActive.B) { if (bodies.Count > 0 || templates.Count > 0) { Clear(); } return; } string text = CreatureManager.CurrentLevelId(); if (text != level) { Clear(); level = text; } if (!Hud.GameStarted() || !Init()) { return; } CaptureTemplates(m); float time = Time.time; float deltaTime = Time.deltaTime; HashSet<int> hashSet = new HashSet<int>(); foreach (CreatureManager.Body body in m.Bodies) { hashSet.Add(body.Actor); if (!bodies.TryGetValue(body.Actor, out var value) || value.GoneAt >= 0f) { if (value != null) { DestroyBody(value); } Template template = TemplateFor(body.Actor); if (template == null) { continue; } value = Create(body.Actor, template, body.Pos); bodies[body.Actor] = value; } float num = Mathf.Clamp01(body.Progress / Mathf.Max(0.1f, (float)Cfg.ReanimDuree)); if (num > value.K + 0.0001f) { value.RisingT = time; } value.K = num; Vector3 val = body.Pos - value.Center; if (((Vector3)(ref val)).sqrMagnitude > 0.09f) { value.Center = body.Pos; value.Floor = FloorAt(body.Pos); } } tmp.Clear(); foreach (KeyValuePair<int, Body> body2 in bodies) { Body value2 = body2.Value; if (!hashSet.Contains(body2.Key) && value2.GoneAt < 0f) { value2.GoneAt = time; Finale(value2); } if (value2.GoneAt >= 0f && time - value2.GoneAt > 0.45f) { tmp.Add(body2.Key); } } foreach (int item in tmp) { DestroyBody(bodies[item]); bodies.Remove(item); } Camera main = Camera.main; bool ghosts = !m.IsLocalCreature && Object.op_Implicit((Object)(object)main); foreach (Body value3 in bodies.Values) { Animate(value3, time, deltaTime, main, ghosts); } } private static void CaptureTemplates(CreatureManager m) { captureTimer -= Time.deltaTime; if (captureTimer > 0f || !Object.op_Implicit((Object)(object)GameDirector.instance)) { return; } captureTimer = 0.5f; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!Object.op_Implicit((Object)(object)player) || player.isDisabled || !Object.op_Implicit((Object)(object)player.playerAvatarVisuals)) { continue; } int num = Net.ActorOf(player); if (num <= 0 || (m.CreatureActor > 0 && num == m.CreatureActor) || (templates.TryGetValue(num, out var value) && value.Level == level && value.Parts.Count > 0) || Small.IsSmall(num)) { continue; } Template template = Capture(player); if (template == null || template.Parts.Count == 0) { continue; } if (value != null) { foreach (Part part in value.Parts) { if (part.Baked && Object.op_Implicit((Object)(object)part.Mesh) && !InUse(part)) { Object.Destroy((Object)(object)part.Mesh); } } } templates[num] = template; Plugin.Log.LogInfo((object)$"Creature : [Corps] modele de {player.playerName} copie ({template.Parts.Count} pieces)."); break; } } private static bool InUse(Part part) { foreach (Body value in bodies.Values) { foreach (Piece piece in value.Pieces) { if (piece.P == part) { return true; } } } return false; } private static Template Capture(PlayerAvatar p) { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_00bc: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0178: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01dd: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown Transform transform = ((Component)p.playerAvatarVisuals).transform; bool flag = (Object)(object)p == (Object)(object)PlayerAvatar.instance; Template template = new Template { Level = level }; Matrix4x4 val = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one); Matrix4x4 inverse = ((Matrix4x4)(ref val)).inverse; Renderer[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val2) || (!flag && !((Component)val2).gameObject.activeInHierarchy)) { continue; } bool flag2 = false; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); Mesh val4; Matrix4x4 val5; if (val3 != null) { if (!Object.op_Implicit((Object)(object)val3.sharedMesh)) { continue; } val4 = new Mesh { name = "CreatureCorpsPiece", hideFlags = (HideFlags)61 }; try { val3.BakeMesh(val4, true); } catch { Object.Destroy((Object)(object)val4); continue; } val5 = Matrix4x4.TRS(((Component)val3).transform.position, ((Component)val3).transform.rotation, Vector3.one); flag2 = true; } else { if (!(val2 is MeshRenderer)) { continue; } MeshFilter component = ((Component)val2).GetComponent<MeshFilter>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.sharedMesh)) { continue; } val4 = component.sharedMesh; val5 = ((Component)val2).transform.localToWorldMatrix; } if (val4.vertexCount == 0) { if (flag2) { Object.Destroy((Object)(object)val4); } continue; } Matrix4x4 rel = inverse * val5; Bounds bounds = val4.bounds; Vector3 val6 = Vector3.Scale(((Bounds)(ref bounds)).extents, ((Matrix4x4)(ref rel)).lossyScale); Part obj2 = new Part { Mesh = val4, Mats = val2.sharedMaterials, Rel = rel, Baked = flag2 }; bounds = val4.bounds; obj2.Height = ((Matrix4x4)(ref rel)).MultiplyPoint3x4(((Bounds)(ref bounds)).center).y; obj2.Size = Mathf.Max(0.01f, (Mathf.Abs(val6.x) + Mathf.Abs(val6.y) + Mathf.Abs(val6.z)) / 3f); Part part = obj2; if (val2.HasPropertyBlock()) { part.Mpb = new MaterialPropertyBlock(); val2.GetPropertyBlock(part.Mpb); } template.Parts.Add(part); } return template; } private static Template TemplateFor(int actor) { if (templates.TryGetValue(actor, out var value) && value.Parts.Count > 0) { return value; } if (templates.TryGetValue(Net.LocalActor, out value) && value.Parts.Count > 0) { return value; } foreach (Template value2 in templates.Values) { if (value2.Parts.Count > 0) { return value2; } } if (Object.op_Implicit((Object)(object)PlayerAvatar.instance) && Object.op_Implicit((Object)(object)PlayerAvatar.instance.playerAvatarVisuals)) { value = Capture(PlayerAvatar.instance); if (value.Parts.Count > 0) { templates[Net.LocalActor] = value; return value; } } return null; } private static Body Create(int actor, Template tpl, Vector3 pos) { //IL_0014: 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_001b: 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_00cf: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) Body body = new Body { Actor = actor, Tpl = tpl, Center = pos, Floor = FloorAt(pos) }; Random random = new Random(actor * 7919 + (level ?? "").GetHashCode()); body.Yaw = (float)random.NextDouble() * 360f; body.NextTwitch = Time.time + 1f + (float)random.NextDouble() * 2f; List<Part> list = new List<Part>(tpl.Parts); list.Sort((Part x, Part y) => x.Height.CompareTo(y.Height)); float num = 0.70000005f; for (int num2 = 0; num2 < list.Count; num2++) { Part part = list[num2]; GameObject val = new GameObject("CreatureCorpsPiece"); val.AddComponent<MeshFilter>().sharedMesh = part.Mesh; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).sharedMaterials = part.Mats; if (part.Mpb != null) { ((Renderer)val2).SetPropertyBlock(part.Mpb); } ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)1; float num3 = (float)random.NextDouble() * MathF.PI * 2f; float num4 = 0.12f + (float)Math.Sqrt(random.NextDouble()) * 0.7f; Piece item = new Piece { Go = val, R = val2, P = part, ScatterOff = new Vector3(Mathf.Cos(num3) * num4, 0f, Mathf.Sin(num3) * num4), ScatterRot = Quaternion.Euler((float)random.NextDouble() * 360f, (float)random.NextDouble() * 360f, (float)random.NextDouble() * 360f), Lift = part.Size * 0.55f + 0.005f, Start = 0.04f + num * ((list.Count > 1) ? ((float)num2 / (float)(list.Count - 1)) : 0f), Spin = Random.onUnitSphere }; body.Pieces.Add(item); } PlayerAvatar val3 = Net.AvatarOf(actor); if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.playerDeathHead)) { Renderer[] componentsInChildren = ((Component)val3.playerDeathHead).GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val4) && val4.enabled) { val4.enabled = false; body.HiddenHead.Add(val4); } } } GameObject val5 = new GameObject("CreatureCorpsAura"); body.Light = val5.AddComponent<Light>(); body.Light.type = (LightType)2; body.Light.color = Green; body.Light.range = 2.6f; body.Light.intensity = 0f; body.Light.shadows = (LightShadows)0; return body; } private static void DestroyBody(Body b) { foreach (Piece piece in b.Pieces) { if (Object.op_Implicit((Object)(object)piece.Go)) { Object.Destroy((Object)(object)piece.Go); } } b.Pieces.Clear(); if (Object.op_Implicit((Object)(object)b.Light)) { Object.Destroy((Object)(object)((Component)b.Light).gameObject); } foreach (Renderer item in b.HiddenHead) { if (Object.op_Implicit((Object)(object)item)) { item.enabled = true; } } b.HiddenHead.Clear(); } private static void Animate(Body b, float now, float dt, Camera cam, bool ghosts) { //IL_00ac: 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_00b3: 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_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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0276: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0428: 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_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) bool flag = b.GoneAt >= 0f; float num = (flag ? Mathf.Clamp01((now - b.GoneAt) / 0.45f) : 0f); float num2 = (flag ? 1f : b.K); b.ShownK = Mathf.MoveTowards(b.ShownK, num2, dt * ((num2 > b.ShownK) ? 0.6f : 0.35f)); bool flag2 = now - b.RisingT < 0.8f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(b.Center.x, b.Floor, b.Center.z); Quaternion val2 = Quaternion.Euler(0f, b.Yaw, 0f); Matrix4x4 val3 = Matrix4x4.TRS(val, val2, Vector3.one); if (!flag && b.ShownK < 0.02f && now >= b.NextTwitch && b.Pieces.Count > 0) { Piece piece = b.Pieces[Random.Range(0, b.Pieces.Count)]; piece.TwitchAt = now; piece.TwitchAxis = Random.onUnitSphere; b.NextTwitch = now + Random.Range(2.5f, 6f); } foreach (Piece piece2 in b.Pieces) { if (Object.op_Implicit((Object)(object)piece2.Go)) { piece2.PrevT = piece2.T; float num3 = Mathf.Clamp01((b.ShownK - piece2.Start) / 0.22f); piece2.T = num3 * num3 * (3f - 2f * num3); float t = piece2.T; Vector3 val4 = val + piece2.ScatterOff + Vector3.up * piece2.Lift; Quaternion val5 = piece2.ScatterRot; if (piece2.TwitchAt > 0f && now - piece2.TwitchAt < 0.35f) { float num4 = (now - piece2.TwitchAt) / 0.35f; float num5 = Mathf.Sin(num4 * MathF.PI) * (1f - num4); val5 = Quaternion.AngleAxis(18f * num5, piece2.TwitchAxis) * val5; val4 += Vector3.up * 0.025f * num5; } Matrix4x4 val6 = val3 * piece2.P.Rel; Vector3 val7 = Vector4.op_Implicit(((Matrix4x4)(ref val6)).GetColumn(3)); Quaternion rotation = ((Matrix4x4)(ref val6)).rotation; Vector3 lossyScale = ((Matrix4x4)(ref val6)).lossyScale; Vector3 val8 = Vector3.Lerp(val4, val7, t) + Vector3.up * (Mathf.Sin(t * MathF.PI) * 0.32f); Quaternion val9 = Quaternion.Slerp(val5, rotation, t) * Quaternion.AngleAxis(Mathf.Sin(t * MathF.PI) * 160f, piece2.Spin); if (t > 0.02f && t < 0.98f) { val8 += Random.insideUnitSphere * 0.004f; } Vector3 val10 = lossyScale; if (flag) { val10 *= 1f - num * num; } piece2.Go.transform.SetPositionAndRotation(val8, val9); piece2.Go.transform.localScale = val10; piece2.World = Matrix4x4.TRS(val8, val9, val10); if (piece2.PrevT < 0.999f && piece2.T >= 0.999f && !flag) { Burst(val7, 6, 0.4f); } if (piece2.PrevT >= 0.999f && piece2.T < 0.999f) { Burst(val7, 3, 0.25f); } } } float num6 = (flag ? ((1f - num) * 2.5f) : (flag2 ? (0.6f + 1.6f * b.ShownK) : (0.25f * b.ShownK))); if (Object.op_Implicit((Object)(object)b.Light)) { ((Component)b.Light).transform.position = val + Vector3.up * (0.4f + 0.8f * b.ShownK); b.Light.intensity = Mathf.MoveTowards(b.Light.intensity, num6, dt * 4f); } if (flag2 && !flag && Object.op_Implicit((Object)(object)motes)) { int num7 = Mathf.FloorToInt((10f + 26f * b.ShownK) * dt + Random.value); for (int i = 0; i < num7; i++) { float num8 = Random.value * MathF.PI * 2f; float num9 = Random.Range(0.15f, 0.55f); Emit(val + new Vector3(Mathf.Cos(num8) * num9, Random.Range(0f, 0.15f), Mathf.Sin(num8) * num9), new Vector3((0f - Mathf.Cos(num8)) * 0.08f, Random.Range(0.35f, 0.8f), (0f - Mathf.Sin(num8)) * 0.08f), Random.Range(0.025f, 0.05f), Random.Range(0.9f, 1.6f)); } } if (ghosts && Object.op_Implicit((Object)(object)ghostMat)) { b.SightTimer -= dt; if (b.SightTimer <= 0f) { b.SightTimer = 0.15f; b.Seen = SeenDirectly(b, cam); } b.GhostK = Mathf.MoveTowards(b.GhostK, b.Seen ? 0f : 1f, dt * 2.5f); if (b.GhostK > 0.003f) { DrawGhost(b, cam, num); } } } private static void Finale(Body b) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(b.Center.x, b.Floor, b.Center.z); for (int i = 0; i < 40; i++) { float num = Random.value * MathF.PI * 2f; float num2 = Random.Range(0.05f, 0.45f); Emit(val + new Vector3(Mathf.Cos(num) * num2, Random.Range(0.1f, 1.7f), Mathf.Sin(num) * num2), new Vector3(Mathf.Cos(num) * 0.5f, Random.Range(0.4f, 1.4f), Mathf.Sin(num) * 0.5f), Random.Range(0.03f, 0.07f), Random.Range(0.6f, 1.2f)); } } private static void DrawGhost(Body b, Camera cam, float goneK) { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f6: 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_0197: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)cam).transform.position; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(b.Center.x, b.Floor + 0.4f + 0.5f * b.ShownK, b.Center.z); float num = Vector3.Distance(position, val); float num2 = Mathf.Clamp01((num - 3f) / 20f); float num3 = Mathf.Lerp(0.18f, 0.42f, num2) * (1f - goneK) * b.GhostK; if (num3 <= 0.003f) { return; } float num4 = Mathf.Max(2f, cam.farClipPlane * 0.8f) - 1.2f; Matrix4x4 val2 = Matrix4x4.identity; if (num > num4 && num > 0.01f) { float num5 = Mathf.Max(0.02f, num4 / num); val2 = Matrix4x4.Translate(position) * Matrix4x4.Scale(Vector3.one * num5) * Matrix4x4.Translate(-position); } object obj = ghostBlock; if (obj == null) { MaterialPropertyBlock val3 = new MaterialPropertyBlock(); ghostBlock = val3; obj = (object)val3; } MaterialPropertyBlock val4 = (MaterialPropertyBlock)obj; foreach (Piece piece in b.Pieces) { if (Object.op_Implicit((Object)(object)piece.Go)) { float num6 = num3 + 0.25f * Mathf.Sin(piece.T * MathF.PI) * (1f - goneK) * b.GhostK; val4.SetColor("_Color", new Color(Green.r, Green.g, Green.b, num6)); Matrix4x4 val5 = val2 * piece.World; int num7 = Mathf.Max(1, piece.P.Mesh.subMeshCount); for (int i = 0; i < num7; i++) { Graphics.DrawMesh(piece.P.Mesh, val5, ghostMat, 0, (Camera)null, i, val4, false, false); } } } } private static bool SeenDirectly(Body b, Camera cam) { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00b0: 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_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_00bb: 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_00ca: 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_00d1: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)cam).transform.position; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(b.Center.x, b.Floor + 0.35f, b.Center.z); if (Vector3.Distance(position, val) > cam.farClipPlane * 0.8f) { return false; } Object val2 = Rooms.RoomOf(position); if (val2 != (Object)null && val2 == Rooms.RoomOf(val + Vector3.up * 0.3f)) { return true; } int mask = LayerMask.GetMask(new string[1] { "Default" }); if (!Physics.Linecast(position, val, mask, (QueryTriggerInteraction)1)) { return true; } Vector3 up = Vector3.up; Vector3 val3 = val - position; Vector3 val4 = Vector3.Cross(up, ((Vector3)(ref val3)).normalized) * 0.45f; if (Physics.Linecast(position, val + val4, mask, (QueryTriggerInteraction)1)) { return !Physics.Linecast(position, val - val4, mask, (QueryTriggerInteraction)1); } return true; } private static float FloorAt(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_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_0049: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(p + Vector3.up * 0.6f, Vector3.down, ref val, 3f, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point.y; } return p.y - 0.2f; } private static void Burst(Vector3 at, int n, float speed) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < n; i++) { Emit(at, Random.onUnitSphere * speed + Vector3.up * 0.2f, Random.Range(0.02f, 0.045f), Random.Range(0.35f, 0.7f)); } } private static void Emit(Vector3 pos, Vector3 vel, float size, float life) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0064: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)motes)) { Color val = Color.Lerp(Green, new Color(0.85f, 1f, 0.9f), Random.value * 0.5f); val.a = Random.Range(0.6f, 0.95f); ParticleSystem obj = motes; EmitParams val2 = default(EmitParams); ((EmitParams)(ref val2)).position = pos; ((EmitParams)(ref val2)).velocity = vel; ((EmitParams)(ref val2)).startSize = size; ((EmitParams)(ref val2)).startLifetime = life; ((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val); ((EmitParams)(ref val2)).rotation = Random.Range(0f, 360f); ((EmitParams)(ref val2)).applyShapeToPosition = false; obj.Emit(val2, 1); } } private static bool Init() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: 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_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)ghostMat) && Object.op_Implicit((Object)(object)motes)) { return true; } if (failed) { return false; } try { Shader obj = Shader.Find("Hidden/Internal-Colored"); if (!Object.op_Implicit((Object)(object)obj)) { throw new Exception("shader de silhouette introuvable"); } ghostMat = new Material(obj) { hideFlags = (HideFlags)61 }; ghostMat.SetInt("_SrcBlend", 5); ghostMat.SetInt("_DstBlend", 1); ghostMat.SetInt("_Cull", 2); ghostMat.SetInt("_ZWrite", 0); ghostMat.SetInt("_ZTest", 8); ghostMat.renderQueue = 4000; Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("UI/Default"); if (!Object.op_Implicit((Object)(object)val)) { throw new Exception("shader de particules introuvable"); } float[] array = HudArt.Star(); Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, true) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; Color32[] array2 = (Color32[])(object)new Color32[64 * 64]; for (int i = 0; i < array2.Length; i++) { array2[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Clamp01(array[i * 4 + 3]) * 255f)); } val2.SetPixels32(array2); val2.Apply(true, true); Material sharedMaterial = new Material(val) { hideFlags = (HideFlags)61, mainTexture = (Texture)(object)val2, renderQueue = 3100 }; GameObject val3 = new GameObject("CreatureCorpsParticules"); Object.DontDestroyOnLoad((Object)(object)val3); val3.SetActive(false); motes = val3.AddComponent<ParticleSystem>(); motes.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = motes.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 800; ((MainModule)(ref main)).cullingMode = (ParticleSystemCullingMode)3; EmissionModule emission = motes.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = motes.shape; ((ShapeModule)(ref shape)).enabled = false; ColorOverLifetimeModule colorOverLifetime = motes.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.15f), new GradientAlphaKey(0.7f, 0.6f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); SizeOverLifetimeModule sizeOverLifetime = motes.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.4f), new Keyframe(0.2f, 1f), new Keyframe(1f, 0.2f) })); LimitVelocityOverLifetimeModule limitVelocityOverLifetime = motes.limitVelocityOverLifetime; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.06f; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = new MinMaxCurve(0.3f); ParticleSystemRenderer component = val3.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = sharedMaterial; component.renderMode = (ParticleSystemRenderMode)0; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; val3.SetActive(true); motes.Play(); return true; } catch (Exception ex) { failed = true; Plugin.Log.LogWarning((object)("Creature : corps a reconstruire indisponible (" + ex.Message + ")")); return false; } } } internal class BotManager { private enum St { Explore, Flee, GoHide, Hiding, Aim } private class Bot { public string Name; public GameObject Go; public NavMeshAgent Agent; public Animator Anim; public Light Lamp; public Renderer[] Rends; public bool[] RendOn; public GameObject Visual; public int Id; public float Hp = 100f; public St State; public float StateT; public float TalkT; public float StepT; public float SprintT; public float RevealT; public float HideCd; public float StillT; public float LostT; public bool Hidden; public bool Crouched; public bool Brave; public bool Controlled; public float FreezeT; public float RoarPingT; public float QuietT; public int LastAttackId = -1; public Vector3 Dest; public float Energy = 40f; public float SmallT; public float SmallCd; public float Scale = 1f; public Vector3 VisualScale = Vector3.one; public Vector3 LampPos; } private static readonly string[] Names = new string[12] { "Bob", "Lulu", "Max", "Zoe", "Gus", "Nina", "Tom", "Ivy", "Rex", "Mia", "Leo", "Sam" }; private readonly List<Bot> bots = new List<Bot>(); private bool spawnedForLevel; private bool ended; private int nextId; private float surviveT; private int total; internal int Alive => bots.Count; internal int Total => total; internal bool Ended => ended; internal bool Enabled(CreatureManager m) { if (Net.Alone && m.IsHost && m.Active && m.IsLocalCreature && Cfg.BotsNombre.Value > 0) { if (!Cfg.JouerSeul.Value) { return Cfg.DebugSolo.Value; } return true; } return false; } internal void ForceCreatureWin(string why) { if (!ended && total != 0) { ended = true; HostLogic.ScoreCreature++; Hud.Message($"{why} | LA CREATURE A GAGNE | Creature {HostLogic.ScoreCreature} - {HostLogic.ScoreExplorers} Bots | F11 pour rejouer", 10f); Plugin.Log.LogInfo((object)("[Bilan solo] Victoire CREATURE (" + why + ")")); } } internal void Clear() { foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Go)) { Object.Destroy((Object)(object)bot.Go); } } bots.Clear(); spawnedForLevel = false; ended = false; surviveT = 0f; total = 0; } internal void Respawn(CreatureManager m) { Clear(); Spawn(m); } internal void Update(CreatureManager m, bool monsterSpawned) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_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_0105: 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_0109: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_015e: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0941: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_0a22: Unknown result type (might be due to invalid IL or missing references) //IL_0aed: Unknown result type (might be due to invalid IL or missing references) //IL_0b01: Unknown result type (might be due to invalid IL or missing references) //IL_0b0d: Unknown result type (might be due to invalid IL or missing references) if (!Enabled(m)) { if (bots.Count > 0 || spawnedForLevel) { Clear(); } } else if (!spawnedForLevel) { Spawn(m); } else { if (ended) { return; } float deltaTime = Time.deltaTime; EnemyRobe monster = m.Monster; Vector3 val = (Vector3)(Object.op_Implicit((Object)(object)monster) ? ((Component)monster).transform.position : new Vector3(9999f, 9999f, 9999f)); Vector3 val2 = HeadOf(monster); int mask = LayerMask.GetMask(new string[1] { "Default" }); Vector3 val7 = default(Vector3); foreach (Bot bot in bots) { if (!Object.op_Implicit((Object)(object)bot.Go) || !Object.op_Implicit((Object)(object)bot.Agent) || !bot.Agent.isOnNavMesh) { continue; } Transform transform = bot.Go.transform; Vector3 nextPosition = bot.Agent.nextPosition; Vector3 position = transform.position; Vector3 val3 = nextPosition - position; if (((Vector3)(ref val3)).sqrMagnitude > 4f) { transform.position = nextPosition; } else { Vector3 val4 = m.Host.BotDoorStep(position, new Vector3(nextPosition.x - position.x, 0f, nextPosition.z - position.z)); transform.position = new Vector3(position.x + val4.x, nextPosition.y, position.z + val4.z); } bot.Agent.nextPosition = transform.position; Vector3 position2 = bot.Go.transform.position; bot.StateT -= deltaTime; bot.TalkT -= deltaTime; bot.RevealT -= deltaTime; bot.HideCd -= deltaTime; bot.SprintT -= deltaTime; if (bot.Controlled) { bot.FreezeT = 0f; bot.SmallT = 0f; bot.Crouched = false; bot.Hidden = false; bot.Agent.isStopped = false; bot.Agent.speed = Cfg.MiniVitessePossession; UpdateSmall(bot, deltaTime, sees: false, 99f); if (Object.op_Implicit((Object)(object)bot.Anim)) { Animator anim = bot.Anim; val3 = bot.Agent.velocity; SetBool(anim, "Moving", ((Vector3)(ref val3)).magnitude > 0.2f); SetBool(bot.Anim, "Sprinting", v: false); SetBool(bot.Anim, "Crouching", v: false); } continue; } if (bot.FreezeT > 0f) { bot.FreezeT -= deltaTime; bot.Agent.isStopped = true; if (Object.op_Implicit((Object)(object)bot.Anim)) { SetBool(bot.Anim, "Moving", v: false); SetBool(bot.Anim, "Sprinting", v: false); } if (bot.FreezeT > 0f) { continue; } bot.Agent.isStopped = false; } if (m.Host.Focusing) { val3 = bot.Agent.velocity; if (((Vector3)(ref val3)).magnitude > 0.5f) { bot.RoarPingT -= deltaTime; if (bot.RoarPingT <= 0f) { bot.RoarPingT = 0.6f; m.Host.SendPingPublic(position2, 2, bot.Id, float.MaxValue); } } } float num = Vector3.Distance(position2, val); Vector3 val5 = position2 + Vector3.up * 1.5f; bool flag = monsterSpawned && !m.Host.Invisible && num < 11f && !Physics.Linecast(val5, val2, mask, (QueryTriggerInteraction)1); if (monsterSpawned && num < (float)Cfg.DistanceFlair) { bot.RevealT = Cfg.DureeRevele; } switch (bot.State) { case St.Explore: bot.Crouched = false; if (flag) { StartSeen(bot, monster); break; } if ((!Generators.Blackout || !(Vector3.Distance(position2, Generators.Pos[Generators.Broken]) < (float)Cfg.GenRayon - 0.3f)) && (bot.StateT <= 0f || Arrived(bot))) { if (Generators.Blackout && Random.value < 0.5f) { Go(bot, Generators.Pos[Generators.Broken] + new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f))); } else { Go(bot, RandomPoint(position2, 8f, 35f)); } bot.StateT = Random.Range(8f, 18f); if (Random.value < 0.25f) { bot.SprintT = Random.Range(2f, 4f); } } bot.Agent.speed = ((bot.SprintT > 0f) ? 4.6f : 2.1f); if (bot.TalkT <= 0f) { Talk(bot, 9f); } break; case St.Aim: { bot.Agent.isStopped = true; bot.Agent.updateRotation = false; Vector3 val6 = val2 - (position2 + Vector3.up * 1.4f); ((Vector3)(ref val7))..ctor(val6.x, 0f, val6.z); if (((Vector3)(ref val7)).sqrMagnitude > 0.01f) { bot.Go.transform.rotation = Quaternion.Slerp(bot.Go.transform.rotation, Quaternion.LookRotation(val7), deltaTime * 6f); } if (Object.op_Implicit((Object)(object)bot.Lamp)) { ((Component)bot.Lamp).transform.rotation = Quaternion.Slerp(((Component)bot.Lamp).transform.rotation, Quaternion.LookRotation(val6 + Random.insideUnitSphere * 0.15f), deltaTime * 5f); } if (bot.StateT <= 0f || num < 2.2f || !flag || m.Blind > 0f) { bot.Agent.isStopped = false; bot.Agent.updateRotation = true; StartFlee(bot, val); } break; } case St.Flee: bot.Crouched = false; bot.Agent.speed = 4.8f; bot.SprintT = 1f; if (flag) { bot.LostT = 0f; } else { bot.LostT += deltaTime; } if (!Arrived(bot) && !(bot.StateT <= 0f)) { break; } if (bot.LostT > 2f && num > 9f) { if (Random.value < 0.6f && bot.HideCd <= 0f && FindHideSpot(position2, val, out var spot)) { Go(bot, spot); bot.State = St.GoHide; bot.StateT = 12f; } else { bot.State = St.Explore; bot.StateT = 0f; } } else { StartFlee(bot, val); } break; case St.GoHide: bot.Agent.speed = 3.2f; if (flag && num < 7f) { StartFlee(bot, val); } else if (Arrived(bot)) { bot.State = St.Hiding; bot.StateT = Random.Range(10f, 25f); bot.StillT = 0f; bot.Agent.ResetPath(); } else if (bot.StateT <= 0f) { bot.State = St.Explore; bot.StateT = 0f; } break; case St.Hiding: bot.Crouched = !Small.ReplacesCrouch; bot.StillT += deltaTime; if (bot.TalkT <= 0f) { Talk(bot, 3.5f); } if (bot.RevealT > 0f && flag && num < 6f) { bot.HideCd = (float)Cfg.DureeRevele + 4f; StartFlee(bot, val); } else if (bot.StateT <= 0f) { bot.HideCd = (float)Cfg.DureeRevele + 4f; bot.State = St.Explore; bot.StateT = 0f; } break; } val3 = bot.Agent.velocity; bool flag2 = ((Vector3)(ref val3)).magnitude > 0.25f; int num2; if (flag2) { val3 = bot.Agent.velocity; num2 = ((((Vector3)(ref val3)).magnitude > (float)Cfg.SeuilVitesseCourse) ? 1 : 0); } else { num2 = 0; } bool flag3 = (byte)num2 != 0; int num3; if (!m.Host.Focusing) { if (!flag3) { if (!HostLogic.WalkSilent && flag2 && !bot.Crouched && bot.Scale > 0.5f) { val3 = bot.Agent.velocity; num3 = ((((Vector3)(ref val3)).magnitude > 0.6f) ? 1 : 0); } else { num3 = 0; } } else { num3 = 1; } } else { val3 = bot.Agent.velocity; num3 = ((((Vector3)(ref val3)).magnitude > 0.5f) ? 1 : 0); } bool flag4 = (byte)num3 != 0; if (flag4 && !m.Host.Focusing) { bot.StepT -= deltaTime; if (bot.StepT <= 0f) { bot.StepT = (flag3 ? 0.8f : 1.2f); m.Host.SendPingPublic(position2, 1, bot.Id, flag3 ? Cfg.EcouteCourse : Cfg.EcoutePas); } } bot.QuietT = (flag4 ? 0f : (bot.QuietT + deltaTime)); bot.Hidden = Cfg.CachetteActive.B && bot.RevealT <= 0f && bot.QuietT >= (float)Cfg.DelaiEntreeCachette; if (Object.op_Implicit((Object)(object)bot.Lamp)) { ((Behaviour)bot.Lamp).enabled = !bot.Crouched && !bot.Hidden; if (bot.State != St.Aim) { ((Component)bot.Lamp).transform.localRotation = Quaternion.Slerp(((Component)bot.Lamp).transform.localRotation, Quaternion.Euler(8f, 0f, 0f), deltaTime * 4f); } } for (int i = 0; i < bot.Rends.Length; i++) { if (Object.op_Implicit((Object)(object)bot.Rends[i])) { bot.Rends[i].enabled = bot.RendOn[i]; } } UpdateSmall(bot, deltaTime, flag, num); if (Object.op_Implicit((Object)(object)bot.Anim)) { SetBool(bot.Anim, "Moving", flag2); SetBool(bot.Anim, "Sprinting", flag3); SetBool(bot.Anim, "Crouching", bot.Crouched); } } } } private static void UpdateSmall(Bot b, float dt, bool sees, float dist) { //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) bool num = Small.Enabled && Cfg.PetitBots != null && Cfg.PetitBots.B; b.SmallCd -= dt; if (!num) { b.SmallT = 0f; } else if (b.SmallT <= 0f && b.SmallCd <= 0f && b.Energy > Mathf.Max(8f, (float)Cfg.PetitEnergieMin)) { float num2 = ((b.State != St.Hiding) ? ((b.State == St.GoHide) ? 0.25f : ((b.State == St.Flee) ? 0.15f : 0.06f)) : (Small.ReplacesCrouch ? 50f : 0.25f)); if (Random.value < num2 * dt) { b.SmallT = Random.Range(4f, 12f); Plugin.Log.LogInfo((object)$"Creature : [Petit] bot {b.Name} retrecit (energie {b.Energy:0})"); } } if (b.SmallT > 0f) { b.SmallT -= dt; b.Energy = Mathf.Max(0f, b.Energy - (float)Cfg.PetitConso * dt); if (b.Energy <= 0f || b.SmallT <= 0f) { b.SmallT = 0f; b.SmallCd = Random.Range(6f, 14f); } } else { b.Energy = Mathf.Min(40f, b.Energy + 3f * dt); } float num3 = ((b.SmallT > 0f) ? Mathf.Clamp((float)Cfg.PetitTaille, 0.03f, 0.95f) : 1f); float scale = b.Scale; b.Scale = Mathf.MoveTowards(b.Scale, num3, dt * Mathf.Max(0.1f, (float)Cfg.PetitVitesse)); if (Object.op_Implicit((Object)(object)b.Visual)) { b.Visual.transform.localScale = b.VisualScale * b.Scale; Sparkles.Step(CreatureManager.I, b, b.Visual.transform.position, scale, b.Scale, local: false, dt); Squeak.Step(Object.op_Implicit((Object)(object)b.Go) ? b.Go.transform : b.Visual.transform, scale, b.Scale); MouseSkin.StepClone(b, b.Visual.transform, b.Scale, Mathf.Clamp((float)Cfg.PetitTaille, 0.03f, 0.95f)); } if (Object.op_Implicit((Object)(object)b.Lamp)) { ((Component)b.Lamp).transform.localPosition = b.LampPos * b.Scale; } } internal int DebugGoRepair() { //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_0078: 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) if (!Generators.Blackout) { return 0; } int num = 0; Vector3 val = Generators.Pos[Generators.Broken]; foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Agent) && bot.Agent.isOnNavMesh) { bot.State = St.Explore; bot.StateT = 30f; bot.FreezeT = 0f; bot.Agent.isStopped = false; Go(bot, val + new Vector3(Random.Range(-1f, 1f), 0f, Random.Range(-1f, 1f))); num++; } } return num; } internal int DebugShrinkAll() { foreach (Bot bot in bots) { bot.Energy = 40f; bot.SmallT = 12f; bot.SmallCd = 0f; } return bots.Count; } internal IEnumerable<Light> Lamps() { foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Lamp) && ((Behaviour)bot.Lamp).enabled) { yield return bot.Lamp; } } } internal IEnumerable<Vector3> Targets() { foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Go)) { yield return bot.Go.transform.position + Vector3.up * ((bot.Crouched ? 0.6f : 1.1f) * bot.Scale); } } } internal IEnumerable<int> Ids() { foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Go)) { yield return bot.Id; } } } internal bool TryGet(int id, out Vector3 pos, out bool isHidden) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) foreach (Bot bot in bots) { if (bot.Id == id && Object.op_Implicit((Object)(object)bot.Go)) { pos = bot.Go.transform.position; isHidden = bot.Hidden; return true; } } pos = Vector3.zero; isHidden = false; return false; } internal bool Control(int id, Vector3 dest) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) foreach (Bot bot in bots) { if (bot.Id == id && Object.op_Implicit((Object)(object)bot.Go) && Object.op_Implicit((Object)(object)bot.Agent) && bot.Agent.isOnNavMesh) { bot.Controlled = true; Go(bot, dest); bot.Agent.speed = Cfg.MiniVitessePossession; return true; } } return false; } internal void Release(int id) { foreach (Bot bot in bots) { if (bot.Id == id) { bot.Controlled = false; bot.State = St.Explore; bot.StateT = 0f; if (Object.op_Implicit((Object)(object)bot.Agent) && bot.Agent.isOnNavMesh) { bot.Agent.isStopped = false; bot.Agent.ResetPath(); } } } } internal bool IsControlled(int id) { foreach (Bot bot in bots) { if (bot.Id == id) { return bot.Controlled; } } return false; } internal bool ControlDone(int id) { //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) foreach (Bot bot in bots) { if (bot.Id == id && Object.op_Implicit((Object)(object)bot.Go) && Object.op_Implicit((Object)(object)bot.Agent) && bot.Agent.isOnNavMesh) { if (bot.Agent.pathPending) { return false; } return Vector3.Distance(bot.Go.transform.position, bot.Dest) < 1.5f || (!bot.Agent.hasPath && bot.Agent.remainingDistance < 0.5f); } } return true; } internal int NearestId(Vector3 pos, float radius) { //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) int result = 0; float num = radius; foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Go) && !bot.Hidden) { float num2 = Vector3.Distance(bot.Go.transform.position, pos); if (num2 <= num) { num = num2; result = bot.Id; } } } return result; } internal GameObject VisualOf(int id, out Func<Renderer, bool> enabledOf) { enabledOf = null; foreach (Bot bot2 in bots) { if (bot2.Id == id && Object.op_Implicit((Object)(object)bot2.Visual)) { Bot bot = bot2; enabledOf = delegate(Renderer r) { int num = Array.IndexOf(bot.Rends, r); return num < 0 || bot.RendOn[num]; }; return bot2.Visual; } } return null; } internal void OnFocus(Vector3 pos) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Go) && bot.State != St.Hiding) { if (Random.value < 0.65f) { bot.FreezeT = (float)Cfg.ConcDureeMax + Random.Range(0f, 1f); } else { StartFlee(bot, pos); } } } } internal void OnNoise(Vector3 pos) { //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) foreach (Bot bot in bots) { if (Object.op_Implicit((Object)(object)bot.Go) && !bot.Hidden && Vector3.Distance(bot.Go.transform.position, pos) <= (float)Cfg.RayonBruitRevele) { bot.RevealT = Cfg.DureeRevele; } } } internal bool Hit(Vector3 origin, Vector3 fwd, float range, float half, float dmg, int attackId, Action<Vector3, string, bool> onHit = null) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: 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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) bool result = false; int mask = LayerMask.GetMask(new string[1] { "Default" }); Vector3 val3 = default(Vector3); NavMeshHit val4 = default(NavMeshHit); for (int num = bots.Count - 1; num >= 0; num--) { Bot bot = bots[num]; if (Object.op_Implicit((Object)(object)bot.Go) && bot.LastAttackId != attackId) { Vector3 val = bot.Go.transform.position + Vector3.up * ((bot.Crouched ? 0.6f : 1.1f) * bot.Scale); Vector3 val2 = val - origin; ((Vector3)(ref val3))..ctor(val2.x, 0f, val2.z); if (!(((Vector3)(ref val2)).magnitude > range) && (!(((Vector3)(ref val3)).sqrMagnitude > 0.01f) || !(Vector3.Angle(fwd, val3) > half)) && !Physics.Linecast(origin, val, mask, (QueryTriggerInteraction)1)) { result = true; bot.LastAttackId = attackId; bot.Hp -= dmg; bot.RevealT = Cfg.DureeRevele; onHit?.Invoke(val, bot.Name, bot.Hp <= 0f); GameDirector instance = GameDirector.instance; if (instance != null) { instance.CameraImpact.ShakeDistance(5f, 2f, 8f, val, 0.2f); } if (bot.Hp <= 0f) { Hud.Message(bot.Name + " est tombe", 3f); EnemyDirector instance2 = EnemyDirector.instance; if (instance2 != null) { instance2.SetInvestigate(val, 12f, false); } Object.Destroy((Object)(object)bot.Go); bots.RemoveAt(num); } else { if (NavMesh.SamplePosition(bot.Go.transform.position + ((Vector3)(ref val3)).normalized * 2f, ref val4, 2f, -1)) { bot.Agent.Warp(((NavMeshHit)(ref val4)).position); } bot.HideCd = (float)Cfg.DureeRevele + 4f; StartFlee(bot, origin); } } } } if (bots.Count == 0 && total > 0 && !ended) { ended = true; HostLogic.ScoreCreature++; Hud.Message($"LA CREATURE A GAGNE | Creature {HostLogic.ScoreCreature} - {HostLogic.ScoreExplorers} Bots | F11 pour rejouer", 10f); Plugin.Log.LogInfo((object)"[Bilan solo] Victoire CREATURE"); } return result; } private void StartSeen(Bot b, EnemyRobe r) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (Cfg.LumiereActive.B && b.Brave && Random.value < 0.8f) { b.State = St.Aim; b.StateT = Random.Range(1.5f, 2.6f); } else { StartFlee(b, Object.op_Implicit((Object)(object)r) ? ((Component)r).transform.position : b.Go.transform.position); } } private void StartFlee(Bot b, Vector3 threat) { //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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_005d: 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_0074: 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) b.State = St.Flee; b.StateT = 6f; b.LostT = 0f; b.Crouched = false; Vector3 position = b.Go.transform.position; Vector3 p = position; float num = -1f; for (int i = 0; i < 8; i++) { Vector3 val = RandomPoint(position, 8f, 30f); float num2 = Vector3.Distance(val, threat) - Vector3.Distance(val, position) * 0.3f; if (num2 > num) { num = num2; p = val; } } Go(b, p); if (Random.value < 0.4f) { Talk(b, 10f); } } private void Talk(Bot b, float radius) { //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_0046: Unknown result type (might be due to invalid IL or missing references) b.TalkT = Random.Range(18f, 45f); b.Hidden = false; b.QuietT = 0f; EnemyDirector instance = EnemyDirector.instance; if (instance != null) { instance.SetInvestigate(b.Go.transform.position + Vector3.up, radius, false); } } private static bool Arrived(Bot b) { if (!b.Agent.pathPending) { return b.Agent.remainingDistance < 0.8f; } return false; } private static void Go(Bot b, Vector3 p) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) b.Dest = p; b.Agent.isStopped = false; b.Agent.updateRotation = true; b.Agent.SetDestination(p); } private static Vector3 RandomPoint(Vector3 from, float min, float max) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) List<LevelPoint> list = (Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.LevelPathPoints : null); NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < 12; i++) { if (list == null) { break; } if (list.Count <= 0) { break; } LevelPoint val = list[Random.Range(0, list.Count)]; if (Object.op_Implicit((Object)(object)val)) { float num = Vector3.Distance(((Component)val).transform.position, from); if (!(num < min) && !(num > max) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 2f, ref val2, 3f, -1)) { return ((NavMeshHit)(ref val2)).position; } } } NavMeshHit val3 = default(NavMeshHit); if (!NavMesh.SamplePosition(from + Random.insideUnitSphere * max, ref val3, max, -1)) { return from; } return ((NavMeshHit)(ref val3)).position; } private static bool FindHideSpot(Vector3 from, Vector3 threat, out Vector3 spot) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a9: 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_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_0089: 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) int mask = LayerMask.GetMask(new string[1] { "Default" }); spot = from; NavMeshHit val = default(NavMeshHit); for (int i = 0; i < 40; i++) { if (NavMesh.SamplePosition(from + new Vector3(Random.Range(-9f, 9f), 0f, Random.Range(-9f, 9f)), ref val, 2f, -1) && !(Vector3.Distance(((NavMeshHit)(ref val)).position, threat) < 6f) && (i >= 30 || Physics.Raycast(((NavMeshHit)(ref val)).position + Vector3.up * 0.25f, Vector3.up, 1.6f, mask, (QueryTriggerInteraction)1))) { spot = ((NavMeshHit)(ref val)).position; return true; } } return false; } private static Vector3 HeadOf(EnemyRobe r) { //IL_0017: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)r)) { return new Vector3(9999f, 9999f, 9999f); } if (!Object.op_Implicit((Object)(object)r.robeAnim) || !Object.op_Implicit((Object)(object)r.robeAnim.visionTransform)) { return ((Component)r).transform.position + Vector3.up * 1.8f; } return r.robeAnim.visionTransform.position; } private static void SetBool(Animator a, string name, bool v) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] parameters = a.parameters; foreach (AnimatorControllerParameter val in parameters) { if ((int)val.type == 4 && val.name == name) { a.SetBool(name, v); break; } } } private void Spawn(CreatureManager m) { //IL_016b: 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_0107: 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_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_01df: 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) PlayerAvatar instance = PlayerAvatar.instance; EnemyRobe monster = m.Monster; if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)monster) || !Object.op_Implicit((Object)(object)monster.enemy) || !Object.op_Implicit((Object)(object)monster.enemy.NavMeshAgent) || !Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !LevelGenerator.Instance.Generated) { return; } spawnedForLevel = true; ended = false; surviveT = 0f; int agentType = (Object.op_Implicit((Object)(object)monster.enemy.NavMeshAgent.Agent) ? monster.enemy.NavMeshAgent.Agent.agentTypeID : 0); int value = Cfg.BotsNombre.Value; List<Vector3> list = new List<Vector3>(); List<LevelPoint> levelPathPoints = LevelGenerator.Instance.LevelPathPoints; if (levelPathPoints != null) { List<LevelPoint> list2 = new List<LevelPoint>(levelPathPoints); list2.RemoveAll((LevelPoint x) => !Object.op_Implicit((Object)(object)x)); Vector3 mePos = ((Component)instance).transform.position; list2.Sort((LevelPoint a, LevelPoint c) => Vector3.Distance(((Component)a).transform.position, mePos).CompareTo(Vector3.Distance(((Component)c).transform.position, mePos))); for (int num = 0; num < list2.Count; num++) { if (list.Count >= 5) { break; } list.Add(((Component)list2[num]).transform.position); } } if (list.Count == 0) { list.Add(((Component)instance).transform.position); } NavMeshHit val = default(NavMeshHit); for (int num2 = 0; num2 < value; num2++) { if (NavMesh.SamplePosition(list[num2 % list.Count] + new Vector3(Random.Range(-1.5f, 1.5f), 0f, Random.Range(-1.5f, 1.5f)), ref val, 6f, -1)) { Bot bot = Create(instance, m, Names[num2 % Names.Length], ((NavMeshHit)(ref val)).position, agentType); if (bot != null) { bots.Add(bot); } } } total = bots.Count; Plugin.Log.LogInfo((object)$"Creature : {total} bots crees."); if (total > 0) { Hud.Message($"{total} explorateurs se dispersent dans le noir... Chasse-les", 6f); } } private Bot Create(PlayerAvatar me, CreatureManager m, string name, Vector3 pos, int agentType) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: 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_0065: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CreatureBot " + name); val.transform.position = pos; Bot bot = new Bot { Name = name, Go = val, Brave = (Random.value < Cfg.BotsCourage.Value), TalkT = Random.Range(5f, 20f) }; GameObject val2 = null; Vector3 localPosition = Vector3.zero; try { val2 = CloneVisual(me, m); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Bot : copie de l'avatar impossible, forme simple utilisee. " + ex.Message)); } if (!Object.op_Implicit((Object)(object)val2)) { val2 = GameObject.CreatePrimitive((PrimitiveType)1); Object.Destroy((Object)(object)val2.GetComponent<Collider>()); localPosition = Vector3.up; } val2.transform.SetParent(val.transform, false); val2.transform.localPosition = localPosition; val2.transform.localRotation = Quaternion.identity; bot.Visual = val2; bot.VisualScale = val2.transform.localScale; bot.Id = -(++nextId); bot.Rends = val2.GetComponentsInChildren<Renderer>(true); bot.RendOn = new bool[bot.Rends.Length]; for (int i = 0; i < bot.Rends.Length; i++) { bot.RendOn[i] = Object.op_Implicit((Object)(object)bot.Rends[i]) && bot.Rends[i].enabled; } bot.Anim = val2.GetComponentInChildren<Animator>(true); if (Object.op_Implicit((Object)(object)bot.Anim)) { bot.Anim.fireEvents = false; bot.Anim.applyRootMotion = false; bot.Anim.cullingMode = (AnimatorCullingMode)0; } GameObject val3 = new GameObject("Lampe"); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = new Vector3(0.15f, 1.35f, 0.25f); bot.LampPos = val3.transform.localPosition; bot.Lamp = val3.AddComponent<Light>(); bot.Lamp.type = (LightType)0; bot.Lamp.range = 12f; bot.Lamp.spotAngle = 50f; bot.Lamp.intensity = 2.2f; bot.Lamp.color = new Color(1f, 0.95f, 0.85f); bot.Lamp.shadows = (LightShadows)2; bot.Agent = val.AddComponent<NavMeshAgent>(); bot.Agent.agentTypeID = agentType; bot.Agent.radius = 0.35f; bot.Agent.height = 1.7f; bot.Agent.speed = 2.1f; bot.Agent.acceleration = 10f; bot.Agent.angularSpeed = 540f; bot.Agent.stoppingDistance = 0.3f; bot.Agent.autoBraking = true; bot.Agent.updatePosition = false; if (!bot.Agent.isOnNavMesh) { bot.Agent.Warp(pos); } bot.State = St.Explore; return bot; } internal static GameObject CloneVisual(PlayerAvatar me, CreatureManager m) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown GameObject val = (Object.op_Implicit((Object)(object)me.playerAvatarVisuals) ? ((Component)me.playerAvatarVisuals).gameObject : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); GameObject val2 = new GameObject("BotHolder"); val2.SetActive(false); GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform); PlayerAvatarVisuals component = val3.GetComponent<PlayerAvatarVisuals>(); GameObject val4 = (Object.op_Implicit((Object)(object)component) ? component.meshParent : null); for (int i = 0; i < 4; i++) { Joint[] componentsInChildren2 = val3.GetComponentsInChildren<Joint>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[j]); } MonoBehaviour[] componentsInChildren3 = val3.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val5 in componentsInChildren3) { if (Object.op_Implicit((Object)(object)val5)) { Object.DestroyImmediate((Object)(object)val5); } } Collider[] componentsInChildren4 = val3.GetComponentsInChildren<Collider>(true); for (int j = 0; j < componentsInChildren4.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren4[j]); } Rigidbody[] componentsInChildren5 = val3.GetComponentsInChildren<Rigidbody>(true); for (int j = 0; j < componentsInChildren5.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren5[j]); } AudioSource[] componentsInChildren6 = val3.GetComponentsInChildren<AudioSource>(true); for (int j = 0; j < componentsInChildren6.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren6[j]); } Light[] componentsInChildren7 = val3.GetComponentsInChildren<Light>(true); for (int j = 0; j < componentsInChildren7.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren7[j]); } } int layer = LayerMask.NameToLayer("Default"); Transform[] componentsInChildren8 = val3.GetComponentsInChildren<Transform>(true); for (int j = 0; j < componentsInChildren8.Length; j++) { ((Component)componentsInChildren8[j]).gameObject.layer = layer; } Renderer[] componentsInChildren9 = val3.GetComponentsInChildren<Renderer>(true); for (int k = 0; k < componentsInChildren9.Length; k++) { bool enabled = k >= componentsInChildren.Length || m.OriginalEnabled(componentsInChildren[k]); componentsInChildren9[k].enabled = enabled; componentsInChildren9[k].shadowCastingMode = (ShadowCastingMode)1; Renderer obj = componentsInChildren9[k]; SkinnedMeshRenderer val6 = (SkinnedMeshRenderer)(object)((obj is SkinnedMeshRenderer) ? obj : null); if (val6 != null) { val6.updateWhenOffscreen = true; } } if (Object.op_Implicit((Object)(object)val4)) { val4.SetActive(true); } val3.transform.SetParent((Transform)null, false); val3.SetActive(true); Object.Destroy((Object)(object)val2); return val3; } } internal sealed class S : IFormattable { internal static readonly List<S> All = new List<S>(); public readonly bool IsBool; private readonly ConfigEntry<float> f; private readonly ConfigEntry<bool> b; public float V; public bool B => V > 0.5f; public override string ToString() { if (!IsBool) { return V.ToString(); } return B.ToString(); } public string ToString(string format, IFormatProvider p) { if (!IsBool) { return V.ToString(format, p); } return B.ToString(); } private S(ConfigEntry<float> f) { this.f = f; V = f.Value; All.Add(this); } private S(ConfigEntry<bool> b) { this.b = b; IsBool = true; V = (b.Value ? 1f : 0f); All.Add(this); } public static implicit operator float(S s) { return s.V; } public void LoadLocal() { V = ((!IsBool) ? f.Value : (b.Value ? 1f : 0f)); } internal static S F(ConfigFile c, string sec, string key, float def, float min, float max, string desc) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown return new S(c.Bind<float>(sec, key, def, new ConfigDescription(desc, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()))); } internal static S Bo(ConfigFile c, string sec, string key, bool def, string desc) { return new S(c.Bind<bool>(sec, key, def, desc)); } } internal static class Cfg { internal static ConfigFile File; internal static ConfigEntry<bool> Actif; internal static ConfigEntry<bool> JouerSeul; internal static ConfigEntry<bool> DebugSolo; internal static ConfigEntry<bool> SoloHumain; internal static ConfigEntry<float> RepereDecalageX; internal static ConfigEntry<float> RepereDecalageY; internal static ConfigEntry<string> JoueurCreature; internal static ConfigEntry<int> BotsNombre; internal static ConfigEntry<float> BotsCourage; internal static ConfigEntry<float> VolumeRetourCoup; internal static ConfigEntry<float> GenVolume; internal static ConfigEntry<float> GenPortee; internal static ConfigEntry<float> SourisVolume; internal static ConfigEntry<bool> CameraSansSecousse; internal static ConfigEntry<bool> TutoAuto; internal static ConfigEntry<bool> TutoUneSeuleFois; internal static ConfigEntry<bool> TutoVuSurvivant; internal static ConfigEntry<bool> TutoVuCreature; internal static ConfigEntry<float> TutoVolume; internal static S TutoAttente; internal static S TutoAttenteMax; internal static S DelaiDepart; internal static S RespawnCreature; internal static S VoixDepuisMonstre; internal static S CoeurActif; internal static S CoeurDistance; internal static S DureeSalleAttente; internal static S MasquerArgent; internal static S TailleActive; internal static S SurfaceRefer