using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json.Linq; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TemerskieModLethal")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TemerskieModLethal")] [assembly: AssemblyTitle("TemerskieModLethal")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 TemerskieModLethal { internal static class GLTFLoader { public static GameObject LoadZmoraPrefab() { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(TemerskieMod._pluginDir, "zmora"); string path2 = Path.Combine(path, "scene.gltf"); string path3 = Path.Combine(path, "scene.bin"); string text = File.ReadAllText(path2); byte[] bin = File.ReadAllBytes(path3); JObject val = JObject.Parse(text); List accessors = ParseAccessors(val); List bufferViews = ParseBufferViews(val); string texturesDir = Path.Combine(path, "textures"); List materials = BuildMaterials(val, texturesDir); List list = new List(); JToken obj = val["meshes"]; JArray val2 = (JArray)(object)((obj is JArray) ? obj : null); if (val2 != null) { for (int i = 0; i < ((JContainer)val2).Count; i++) { JToken val3 = val2[i]; JToken obj2 = val3[(object)"primitives"]; JArray val4 = (JArray)(object)((obj2 is JArray) ? obj2 : null); if (val4 == null) { continue; } for (int j = 0; j < ((JContainer)val4).Count; j++) { JToken prim = val4[j]; GameObject val5 = BuildMeshGO($"ZmoraMesh{i}_{j}", bin, bufferViews, accessors, prim, materials); if ((Object)(object)val5 != (Object)null) { list.Add(val5); } } } } if (list.Count == 0) { throw new Exception("No meshes built from GLTF"); } GameObject val6 = new GameObject("ZmoraPrefab"); foreach (GameObject item in list) { item.transform.SetParent(val6.transform, false); } val6.transform.localScale = Vector3.one * 0.01f; return val6; } private static List ParseAccessors(JObject root) { List list = new List(); JToken obj = root["accessors"]; JArray val = (JArray)(object)((obj is JArray) ? obj : null); if (val != null) { foreach (JToken item in val) { list.Add(item); } } return list; } private static List ParseBufferViews(JObject root) { List list = new List(); JToken obj = root["bufferViews"]; JArray val = (JArray)(object)((obj is JArray) ? obj : null); if (val != null) { foreach (JToken item in val) { list.Add(item); } } return list; } private static List BuildMaterials(JObject root, string texturesDir) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown Shader val = Shader.Find("HDRP/Lit"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Standard"); } List list = new List(); JToken obj = root["materials"]; JArray val2 = (JArray)(object)((obj is JArray) ? obj : null); if (val2 == null) { return list; } JToken obj2 = root["textures"]; JArray textures = (JArray)(object)((obj2 is JArray) ? obj2 : null); JToken obj3 = root["images"]; JArray images = (JArray)(object)((obj3 is JArray) ? obj3 : null); foreach (JToken item in val2) { Material val3 = new Material(val); JToken val4 = item[(object)"pbrMetallicRoughness"]; if (val4 != null) { JToken val5 = val4[(object)"baseColorTexture"]; if (val5 != null) { int texIdx = (int)(val5[(object)"index"] ?? JToken.op_Implicit(-1)); Texture2D val6 = LoadTextureFromIndex(textures, images, texturesDir, texIdx); if ((Object)(object)val6 != (Object)null) { val3.SetTexture("_BaseColorMap", (Texture)(object)val6); if (((Object)val).name == "Standard") { val3.SetTexture("_MainTex", (Texture)(object)val6); } } } } JToken val7 = item[(object)"normalTexture"]; if (val7 != null) { int texIdx2 = (int)(val7[(object)"index"] ?? JToken.op_Implicit(-1)); Texture2D val8 = LoadTextureFromIndex(textures, images, texturesDir, texIdx2); if ((Object)(object)val8 != (Object)null) { val3.SetTexture("_NormalMap", (Texture)(object)val8); if (((Object)val).name == "Standard") { val3.SetTexture("_BumpMap", (Texture)(object)val8); } } } list.Add(val3); } return list; } private static Texture2D? LoadTextureFromIndex(JArray? textures, JArray? images, string texturesDir, int texIdx) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown if (textures == null || images == null) { return null; } if (texIdx < 0 || texIdx >= ((JContainer)textures).Count) { return null; } JToken val = textures[texIdx]; int num = (int)(val[(object)"source"] ?? JToken.op_Implicit(-1)); if (num < 0 || num >= ((JContainer)images).Count) { return null; } string text = (string)images[num][(object)"uri"]; if (string.IsNullOrEmpty(text)) { return null; } string text2 = Path.Combine(texturesDir, text.Replace('/', Path.DirectorySeparatorChar)); if (!File.Exists(text2)) { return null; } try { byte[] array = File.ReadAllBytes(text2); Texture2D val2 = new Texture2D(2, 2); ImageConversion.LoadImage(val2, array); ((Texture)val2).wrapMode = (TextureWrapMode)0; return val2; } catch (Exception arg) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogWarning((object)$"Failed to load texture {text2}: {arg}"); } return null; } } private static GameObject? BuildMeshGO(string name, byte[] bin, List bufferViews, List accessors, JToken prim, List materials) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown JToken obj = prim[(object)"attributes"]; JObject val = (JObject)(object)((obj is JObject) ? obj : null); if (val == null) { return null; } List list = ReadVec3(bin, bufferViews, accessors, GetAccessorIndex(val, "POSITION")); List list2 = ReadVec3(bin, bufferViews, accessors, GetAccessorIndex(val, "NORMAL")); List list3 = ReadVec2(bin, bufferViews, accessors, GetAccessorIndex(val, "TEXCOORD_0")); List list4 = ReadIndices(bin, bufferViews, accessors, prim[(object)"indices"]); if (list == null || list4 == null) { return null; } Mesh val2 = new Mesh(); ((Object)val2).name = name; val2.SetVertices(list); if (list2 != null) { val2.SetNormals(list2); } else { val2.RecalculateNormals(); } if (list3 != null) { val2.SetUVs(0, list3); } val2.subMeshCount = 1; val2.SetTriangles(list4, 0); val2.RecalculateBounds(); GameObject val3 = new GameObject(name); val3.AddComponent().sharedMesh = val2; MeshRenderer val4 = val3.AddComponent(); int num = ((prim[(object)"material"] != null) ? ((int)(prim[(object)"material"] ?? JToken.op_Implicit(-1))) : (-1)); if (num >= 0 && num < materials.Count) { ((Renderer)val4).sharedMaterial = materials[num]; } else if (materials.Count > 0) { ((Renderer)val4).sharedMaterial = materials[0]; } return val3; } private static int GetAccessorIndex(JObject attrs, string key) { JToken val = attrs[key]; return (val != null) ? ((int)val) : (-1); } private static int GetAccessorInt(JToken acc, string field, int defaultVal = 0) { JToken val = acc[(object)field]; return (val != null) ? ((int)val) : defaultVal; } private static List? ReadVec3(byte[] bin, List bufferViews, List accessors, int accIdx) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) if (accIdx < 0 || accIdx >= accessors.Count) { return null; } JToken acc = accessors[accIdx]; int accessorInt = GetAccessorInt(acc, "bufferView"); int accessorInt2 = GetAccessorInt(acc, "byteOffset"); int accessorInt3 = GetAccessorInt(acc, "count"); if (accessorInt < 0 || accessorInt >= bufferViews.Count) { return null; } JToken val = bufferViews[accessorInt]; int accessorInt4 = GetAccessorInt(val, "byteOffset"); JToken val2 = val[(object)"byteStride"]; int num = ((val2 != null) ? ((int)(val2 ?? JToken.op_Implicit(12))) : 12); int num2 = accessorInt4 + accessorInt2; if (num2 + accessorInt3 * num > bin.Length) { return null; } List list = new List(accessorInt3); for (int i = 0; i < accessorInt3; i++) { int num3 = num2 + i * num; float num4 = BitConverter.ToSingle(bin, num3); float num5 = BitConverter.ToSingle(bin, num3 + 4); float num6 = BitConverter.ToSingle(bin, num3 + 8); list.Add(new Vector3(num4, num5, 0f - num6)); } return list; } private static List? ReadVec2(byte[] bin, List bufferViews, List accessors, int accIdx) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (accIdx < 0 || accIdx >= accessors.Count) { return null; } JToken acc = accessors[accIdx]; int accessorInt = GetAccessorInt(acc, "bufferView"); int accessorInt2 = GetAccessorInt(acc, "byteOffset"); int accessorInt3 = GetAccessorInt(acc, "count"); if (accessorInt < 0 || accessorInt >= bufferViews.Count) { return null; } JToken val = bufferViews[accessorInt]; int accessorInt4 = GetAccessorInt(val, "byteOffset"); JToken val2 = val[(object)"byteStride"]; int num = ((val2 != null) ? ((int)val2) : 8); int num2 = accessorInt4 + accessorInt2; if (num2 + accessorInt3 * num > bin.Length) { return null; } List list = new List(accessorInt3); for (int i = 0; i < accessorInt3; i++) { int num3 = num2 + i * num; float num4 = BitConverter.ToSingle(bin, num3); float num5 = BitConverter.ToSingle(bin, num3 + 4); list.Add(new Vector2(num4, num5)); } return list; } private static List? ReadIndices(byte[] bin, List bufferViews, List accessors, JToken? indicesToken) { if (indicesToken == null) { return null; } int num = (int)indicesToken; if (num < 0 || num >= accessors.Count) { return null; } JToken acc = accessors[num]; int accessorInt = GetAccessorInt(acc, "bufferView"); int accessorInt2 = GetAccessorInt(acc, "byteOffset"); int accessorInt3 = GetAccessorInt(acc, "count"); int accessorInt4 = GetAccessorInt(acc, "componentType", 5125); if (accessorInt < 0 || accessorInt >= bufferViews.Count) { return null; } JToken acc2 = bufferViews[accessorInt]; int accessorInt5 = GetAccessorInt(acc2, "byteOffset"); if (1 == 0) { } int num2 = accessorInt4 switch { 5121 => 1, 5123 => 2, 5125 => 4, _ => 4, }; if (1 == 0) { } int num3 = num2; int num4 = accessorInt5 + accessorInt2; if (num4 + accessorInt3 * num3 > bin.Length) { return null; } List list = new List(accessorInt3); for (int i = 0; i < accessorInt3; i++) { int num5 = num4 + i * num3; if (1 == 0) { } num2 = accessorInt4 switch { 5121 => bin[num5], 5123 => BitConverter.ToUInt16(bin, num5), 5125 => (int)BitConverter.ToUInt32(bin, num5), _ => BitConverter.ToInt32(bin, num5), }; if (1 == 0) { } int item = num2; list.Add(item); } return list; } } [BepInPlugin("TemerskieModLethal", "Temerskie Mod Lethal", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class TemerskieMod : BaseUnityPlugin { public const string PluginGuid = "TemerskieModLethal"; public const string PluginName = "Temerskie Mod Lethal"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource? _log; internal static string? _pluginDir; internal static GameObject? ZmoraPrefab; internal static EnemyType? ZmoraEnemyType; internal static bool ForceBialaMewa; private void Awake() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown _log = ((BaseUnityPlugin)this).Logger; _pluginDir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("Loading {0} v{1} [BUILD-{2:yyyyMMdd-HHmmss}]...", "Temerskie Mod Lethal", "1.0.0", DateTime.Now)); try { Harmony val = new Harmony("TemerskieModLethal"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied"); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Harmony init failed: {arg}"); } GameObject val2 = new GameObject("ZmoraDirectionUI"); val2.AddComponent(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TemerskieModLethal loaded!"); } internal static void BuildZmoraAssets() { try { GameObject val = GLTFLoader.LoadZmoraPrefab(); ((Object)val).name = "ZmoraEnemy"; if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } ApplyDarkThemeToModel(val); AddSmokeParticles(val); EnemyType val2 = ScriptableObject.CreateInstance(); val2.enemyName = "Zmora"; val2.enemyPrefab = val; val2.canDie = true; val2.canBeDestroyed = true; val2.canBeStunned = true; val2.destroyOnDeath = true; val2.isOutsideEnemy = false; Object.DontDestroyOnLoad((Object)(object)val); NetworkPrefabs.RegisterNetworkPrefab(val); ZmoraPrefab = val; ZmoraEnemyType = val2; ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)"Zmora assets built successfully"); } } catch (Exception arg) { ManualLogSource? log2 = _log; if (log2 != null) { log2.LogError((object)$"Failed to build Zmora assets: {arg}"); } } } private static void ApplyDarkThemeToModel(GameObject model) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = model.GetComponentsInChildren(true); MeshRenderer[] array = componentsInChildren; Color val4 = default(Color); foreach (MeshRenderer val in array) { Material[] sharedMaterials = ((Renderer)val).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!((Object)(object)val2 == (Object)null)) { Material val3 = new Material(val2); ((Object)val3).name = ((Object)val2).name + "_DarkTheme"; ((Color)(ref val4))..ctor(0.05f, 0.03f, 0.08f, 1f); val3.SetColor("_BaseColor", val4); if (val3.HasProperty("_Color")) { val3.SetColor("_Color", val4); } if (val3.HasProperty("_EmissiveColor")) { val3.SetColor("_EmissiveColor", new Color(0.02f, 0.01f, 0.03f, 1f)); } if (val3.HasProperty("_BaseColorMap")) { val3.SetTexture("_BaseColorMap", val3.GetTexture("_BaseColorMap")); } val3.SetFloat("_SurfaceType", 0f); val3.DisableKeyword("_SURFACE_TYPE_TRANSPARENT"); val3.renderQueue = 2000; if (val3.HasProperty("_Metallic")) { val3.SetFloat("_Metallic", 0.2f); } if (val3.HasProperty("_Smoothness")) { val3.SetFloat("_Smoothness", 0.5f); } sharedMaterials[j] = val3; } } ((Renderer)val).sharedMaterials = sharedMaterials; } } private static void AddSmokeParticles(GameObject root) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: 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_02cb: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ZmoraSmokeParticles"); val.transform.SetParent(root.transform, false); val.transform.localPosition = new Vector3(0f, 0.9f, 0f); ParticleSystem val2 = val.AddComponent(); MainModule main = val2.main; ((MainModule)(ref main)).duration = 1f; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.5f, 2f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.3f, 0.8f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.2f, 0.8f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.15f, 0.4f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.15f, 0.1f, 0.2f, 0.4f), new Color(0.05f, 0.02f, 0.1f, 0.15f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(15f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.35f; ((ShapeModule)(ref shape)).position = Vector3.zero; ((ShapeModule)(ref shape)).alignToDirection = false; ((ShapeModule)(ref shape)).randomDirectionAmount = 1f; ((ShapeModule)(ref shape)).sphericalDirectionAmount = 1f; VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(0.1f, 0.5f); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val3 = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0.2f), new Keyframe(0.5f, 1f), new Keyframe(1f, 0f) }); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val3); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(new Color(0.15f, 0.1f, 0.2f), 0f), new GradientColorKey(new Color(0.1f, 0.05f, 0.15f), 0.5f), new GradientColorKey(new Color(0.05f, 0.02f, 0.1f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0.4f, 0f), new GradientAlphaKey(0.3f, 0.3f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); NoiseModule noise = val2.noise; ((NoiseModule)(ref noise)).enabled = true; ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(0.3f); ((NoiseModule)(ref noise)).frequency = 0.5f; ((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(0.2f); } internal static (Mesh mesh, Material mat, GameObject prefab) BuildAssets() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(_pluginDir, "Scene_-_Root_baseColor.png"); if (!File.Exists(text)) { throw new Exception("Texture not found: " + text); } byte[] array = File.ReadAllBytes(text); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ImageConversion.LoadImage(val, array); ((Texture)val).wrapMode = (TextureWrapMode)0; Mesh val2 = LoadMesh(); Shader val3 = Shader.Find("HDRP/Lit") ?? throw new Exception("HDRP/Lit shader not found!"); Material val4 = new Material(val3); val4.SetTexture("_BaseColorMap", (Texture)(object)val); val4.SetColor("_BaseColor", Color.white); val4.enableInstancing = true; Sprite icon = LoadIcon(); GameObject val5 = BuildPrefab(val2, val4, icon); Object.DontDestroyOnLoad((Object)(object)val5); NetworkPrefabs.RegisterNetworkPrefab(val5); return (mesh: val2, mat: val4, prefab: val5); } internal static Sprite? LoadIcon() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(_pluginDir, "temerczyk.png"); if (!File.Exists(path)) { ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)"temerczyk.png not found, no icon set"); } return null; } byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } internal static (AudioClip? grab, AudioClip? drop, AudioClip? pocket, AudioClip? throwSfx, AudioClip[] clinks) LoadFlaskAudio() { Item val = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((Item i) => i.itemName.IndexOf("flask", StringComparison.OrdinalIgnoreCase) >= 0)); if ((Object)(object)val == (Object)null) { ManualLogSource? log = _log; if (log != null) { log.LogWarning((object)"Flask item not found, no audio"); } return (grab: null, drop: null, pocket: null, throwSfx: null, clinks: Array.Empty()); } ManualLogSource? log2 = _log; if (log2 != null) { log2.LogInfo((object)"Found flask item, copying audio clips"); } return (grab: val.grabSFX, drop: val.dropSFX, pocket: val.pocketSFX, throwSfx: val.throwSFX, clinks: val.clinkAudios); } private static Mesh LoadMesh() { string path = Path.Combine(_pluginDir, "temerczyk.obj"); if (File.Exists(path)) { ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)"Loading temerczyk.obj..."); } try { return ObjLoader.Load(path); } catch (Exception arg) { ManualLogSource? log2 = _log; if (log2 != null) { log2.LogWarning((object)$"OBJ load failed: {arg}, falling back to procedural mesh"); } } } else { ManualLogSource? log3 = _log; if (log3 != null) { log3.LogInfo((object)"temerczyk.obj not found, using procedural mesh"); } } return BuildProceduralMesh(); } private static Mesh BuildProceduralMesh() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Mesh val = new Mesh(); ((Object)val).name = "TemerskieProcedural"; List list = new List(); List list2 = new List(); List normals = new List(); List list3 = new List(); AddCylinder(list, list2, normals, list3, 0f, 0.4125f, 0.081f, 12); AddCone(list, list2, normals, list3, 0.4125f, 0.55f, 0.081f, 12); AddCylinder(list, list2, normals, list3, 13f / 32f, 93f / 160f, 0.056f, 12); AddCylinder(list, list2, normals, list3, 91f / 160f, 19f / 32f, 0.069f, 12); AddCylinder(list, list2, normals, list3, 0.5875f, 0.6f, 0.0625f, 12); val.SetVertices(list); val.SetUVs(0, list2); val.SetNormals(normals); val.subMeshCount = 1; val.SetTriangles(list3, 0); val.RecalculateBounds(); val.Optimize(); return val; } private static void AddCylinder(List verts, List uvs, List normals, List tris, float yBot, float yTop, float radius, int segs) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00eb: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) int count = verts.Count; verts.Add(new Vector3(0f, yTop, 0f)); uvs.Add(new Vector2(0.5f, 0.95f)); normals.Add(Vector3.up); verts.Add(new Vector3(0f, yBot, 0f)); uvs.Add(new Vector2(0.5f, 0.05f)); normals.Add(Vector3.down); for (int i = 0; i < segs; i++) { float num = (float)i / (float)segs * MathF.PI * 2f; float num2 = Mathf.Cos(num) * radius; float num3 = Mathf.Sin(num) * radius; verts.Add(new Vector3(num2, yTop, num3)); uvs.Add(new Vector2((float)i / (float)segs, 1f)); Vector3 val = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)); normals.Add(((Vector3)(ref val)).normalized); verts.Add(new Vector3(num2, yBot, num3)); uvs.Add(new Vector2((float)i / (float)segs, 0f)); val = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)); normals.Add(((Vector3)(ref val)).normalized); } for (int j = 0; j < segs; j++) { int num4 = (j + 1) % segs; int item = count + 2 + j * 2; int item2 = count + 2 + num4 * 2; tris.Add(count); tris.Add(item2); tris.Add(item); item = count + 2 + j * 2 + 1; item2 = count + 2 + num4 * 2 + 1; tris.Add(count + 1); tris.Add(item); tris.Add(item2); int num5 = count + 2 + j * 2; int item3 = num5 + 1; int num6 = count + 2 + num4 * 2; int item4 = num6 + 1; tris.Add(num5); tris.Add(num6); tris.Add(item3); tris.Add(num6); tris.Add(item4); tris.Add(item3); } } private static void AddCone(List verts, List uvs, List normals, List tris, float yBot, float yTop, float radius, int segs) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) int count = verts.Count; verts.Add(new Vector3(0f, yBot, 0f)); uvs.Add(new Vector2(0.5f, 0.05f)); normals.Add(Vector3.down); verts.Add(new Vector3(0f, yTop, 0f)); uvs.Add(new Vector2(0.5f, 0.95f)); normals.Add(Vector3.up); for (int i = 0; i < segs; i++) { float num = (float)i / (float)segs * MathF.PI * 2f; verts.Add(new Vector3(Mathf.Cos(num) * radius, yBot, Mathf.Sin(num) * radius)); uvs.Add(new Vector2((float)i / (float)segs, 0f)); Vector3 val = new Vector3(Mathf.Cos(num), 0.5f, Mathf.Sin(num)); normals.Add(((Vector3)(ref val)).normalized); } for (int j = 0; j < segs; j++) { int num2 = (j + 1) % segs; int item = count + 2 + j; int item2 = count + 2 + num2; tris.Add(count); tris.Add(item); tris.Add(item2); tris.Add(item); tris.Add(count + 1); tris.Add(item2); } } private static GameObject BuildPrefab(Mesh mesh, Material mat, Sprite? icon) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown GameObject val = new GameObject("TemerskieScrap"); val.tag = "PhysicsProp"; val.layer = LayerMask.NameToLayer("Props"); val.transform.localScale = Vector3.one * 0.0025f; val.AddComponent().sharedMesh = mesh; ((Renderer)val.AddComponent()).sharedMaterial = mat; Bounds bounds = mesh.bounds; val.AddComponent(); TemerskieProp temerskieProp = val.AddComponent(); ((GrabbableObject)temerskieProp).grabbable = true; ((GrabbableObject)temerskieProp).grabbableToEnemies = true; ((GrabbableObject)temerskieProp).floorYRot = -1; ((GrabbableObject)temerskieProp).rotateObject = true; Item val2 = ScriptableObject.CreateInstance(); val2.itemName = "Temerskie"; val2.weight = 1.18f; val2.isScrap = true; val2.itemSpawnsOnGround = true; val2.canBeGrabbedBeforeGameStart = true; val2.twoHanded = false; val2.twoHandedAnimation = false; val2.isConductiveMetal = true; val2.isDefensiveWeapon = true; val2.holdButtonUse = false; val2.syncUseFunction = true; val2.toolTips = new string[1] { "Wypij za Temerie : [LMB]" }; val2.minValue = 60; val2.maxValue = 160; val2.spawnPrefab = val; val2.restingRotation = new Vector3(0f, -90f, 0f); val2.rotationOffset = new Vector3(0f, 0f, 0f); val2.positionOffset = new Vector3(0f, 0.15f, 0.2f); val2.meshVariants = (Mesh[])(object)new Mesh[1] { mesh }; val2.materialVariants = (Material[])(object)new Material[1] { mat }; (AudioClip? grab, AudioClip? drop, AudioClip? pocket, AudioClip? throwSfx, AudioClip[] clinks) tuple = LoadFlaskAudio(); AudioClip item = tuple.grab; AudioClip item2 = tuple.drop; AudioClip item3 = tuple.pocket; AudioClip item4 = tuple.throwSfx; AudioClip[] item5 = tuple.clinks; val2.grabSFX = item; val2.dropSFX = item2; val2.pocketSFX = item3; val2.throwSFX = item4; val2.clinkAudios = item5; val2.spawnPositionTypes = new List(); val2.itemIcon = icon; ((GrabbableObject)temerskieProp).itemProperties = val2; val.AddComponent().spatialBlend = 1f; val.GetComponent().pitch = 0.8f; val.AddComponent().SynchronizeTransform = true; GameObject val3 = new GameObject("ScanNode"); val3.transform.SetParent(val.transform, false); val3.layer = LayerMask.NameToLayer("ScanNode"); ((Collider)val3.AddComponent()).isTrigger = true; ScanNodeProperties val4 = val3.AddComponent(); val4.maxRange = 13; val4.minRange = 1; val4.requiresLineOfSight = true; val4.headerText = "Temerskie"; val4.subText = "Value: "; val4.scrapValue = 0; val4.creatureScanID = -1; val4.nodeType = 2; return val; } } internal static class ObjLoader { public static Mesh Load(string path) { //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Expected O, but got Unknown //IL_0150: 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_0247: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0439: 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_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) string[] array = File.ReadAllLines(path); List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); List list5 = new List(); List list6 = new List(); List list7 = new List(); string[] array2 = array; foreach (string text in array2) { string text2 = text.Trim(); if (text2.Length == 0 || text2.StartsWith("#") || text2.StartsWith("o ") || text2.StartsWith("s ") || text2.StartsWith("g ") || text2.StartsWith("usemtl ") || text2.StartsWith("mtllib ")) { continue; } string[] array3 = text2.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (array3.Length == 0) { continue; } if (array3[0] == "v" && array3.Length >= 4) { if (float.TryParse(array3[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array3[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array3[3], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { list.Add(new Vector3(result, result2, result3)); } } else if (array3[0] == "vt" && array3.Length >= 3) { if (float.TryParse(array3[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result4) && float.TryParse(array3[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result5)) { list2.Add(new Vector2(result4, result5)); } } else if (array3[0] == "vn" && array3.Length >= 4) { if (float.TryParse(array3[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result6) && float.TryParse(array3[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result7) && float.TryParse(array3[3], NumberStyles.Float, CultureInfo.InvariantCulture, out var result8)) { list3.Add(new Vector3(result6, result7, result8)); } } else { if (!(array3[0] == "f")) { continue; } List list8 = new List(); List list9 = new List(); List list10 = new List(); for (int j = 1; j < array3.Length; j++) { string[] array4 = array3[j].Split('/'); if (array4.Length != 0 && int.TryParse(array4[0], out var result9)) { list8.Add((result9 < 0) ? (list.Count + result9) : (result9 - 1)); } if (array4.Length > 1 && array4[1].Length > 0 && int.TryParse(array4[1], out var result10)) { list9.Add((result10 < 0) ? (list2.Count + result10) : (result10 - 1)); } if (array4.Length > 2 && array4[2].Length > 0 && int.TryParse(array4[2], out var result11)) { list10.Add((result11 < 0) ? (list3.Count + result11) : (result11 - 1)); } } if (list8.Count >= 3) { for (int k = 1; k < list8.Count - 1; k++) { int count = list4.Count; list4.Add(list[list8[0]]); list5.Add((list9.Count > 0) ? list2[list9[0]] : Vector2.zero); list6.Add((list10.Count > 0) ? list3[list10[0]] : Vector3.up); int count2 = list4.Count; list4.Add(list[list8[k]]); list5.Add((list9.Count > k) ? list2[list9[k]] : Vector2.zero); list6.Add((list10.Count > k) ? list3[list10[k]] : Vector3.up); int count3 = list4.Count; list4.Add(list[list8[k + 1]]); list5.Add((list9.Count > k + 1) ? list2[list9[k + 1]] : Vector2.zero); list6.Add((list10.Count > k + 1) ? list3[list10[k + 1]] : Vector3.up); list7.Add(count); list7.Add(count2); list7.Add(count3); } } } } if (list7.Count == 0) { throw new Exception("No triangles generated from OBJ"); } Mesh val = new Mesh(); ((Object)val).name = "TemerskieOBJ"; val.SetVertices(list4); val.SetUVs(0, list5); val.SetNormals(list6); val.subMeshCount = 1; val.SetTriangles(list7, 0); val.RecalculateBounds(); return val; } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatches { private static GameObject? _prefab; [HarmonyPostfix] [HarmonyPatch("Awake")] private static void AfterStartOfRoundAwake(StartOfRound __instance) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)"BuildAssets starting..."); } try { (Mesh mesh, Material mat, GameObject prefab) tuple = TemerskieMod.BuildAssets(); Mesh item = tuple.mesh; Material item2 = tuple.mat; GameObject item3 = tuple.prefab; _prefab = item3; RegisterScrap(__instance, item, item2); TemerskieMod.BuildZmoraAssets(); ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)"BuildAssets + Zmora + registration done"); } } catch (Exception arg) { ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogError((object)$"BuildAssets failed: {arg}"); } } } [HarmonyPostfix] [HarmonyPatch("Start")] private static void AfterStartOfRoundStart(StartOfRound __instance) { bool valueOrDefault = __instance.allItemsList?.itemsList?.Any((Item i) => i.itemName == "Temerskie") == true; ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"SOR.Start: Temerskie registered = {valueOrDefault}"); } } private static void RegisterScrap(StartOfRound sor, Mesh mesh, Material mat) { //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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown if ((Object)(object)_prefab == (Object)null) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogError((object)"_prefab null in RegisterScrap"); } return; } if ((Object)(object)sor.allItemsList == (Object)null) { ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogError((object)"allItemsList null"); } return; } Item val = ScriptableObject.CreateInstance(); ((Object)val).name = "TemerskieItem"; val.itemName = "Temerskie"; val.weight = 1.18f; val.isScrap = true; val.itemSpawnsOnGround = true; val.canBeGrabbedBeforeGameStart = true; val.twoHanded = false; val.twoHandedAnimation = false; val.isConductiveMetal = false; val.isDefensiveWeapon = true; val.holdButtonUse = false; val.syncUseFunction = true; val.toolTips = new string[1] { "Wypij za Temerie : [LMB]" }; val.minValue = 60; val.maxValue = 80; val.spawnPrefab = _prefab; val.verticalOffset = 0f; val.restingRotation = new Vector3(0f, -90f, 0f); val.rotationOffset = new Vector3(0f, 0f, 0f); val.positionOffset = new Vector3(0f, 0.15f, 0.2f); val.meshVariants = (Mesh[])(object)new Mesh[1] { mesh }; val.materialVariants = (Material[])(object)new Material[1] { mat }; (AudioClip? grab, AudioClip? drop, AudioClip? pocket, AudioClip? throwSfx, AudioClip[] clinks) tuple = TemerskieMod.LoadFlaskAudio(); AudioClip item = tuple.grab; AudioClip item2 = tuple.drop; AudioClip item3 = tuple.pocket; AudioClip item4 = tuple.throwSfx; AudioClip[] item5 = tuple.clinks; val.grabSFX = item; val.dropSFX = item2; val.pocketSFX = item3; val.throwSFX = item4; val.clinkAudios = item5; val.itemIcon = TemerskieMod.LoadIcon(); sor.allItemsList.itemsList.Add(val); SelectableLevel[] array = Resources.FindObjectsOfTypeAll(); SelectableLevel[] array2 = array; foreach (SelectableLevel val2 in array2) { if (val2.spawnableScrap != null) { val2.spawnableScrap.Add(new SpawnableItemWithRarity(val, 100)); } } ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogInfo((object)$"Temerskie scrap item registered, added to {array.Length} levels"); } } } [HarmonyPatch(typeof(HUDManager))] internal static class HUDManagerPatches { [HarmonyPrefix] [HarmonyPatch("AddTextToChatOnServer")] private static bool BeforeAddTextToChat(HUDManager __instance, string chatMessage, int playerId) { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null || playerId != (int)val.playerClientId) { return true; } string text = chatMessage.Trim(); ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)("Chat from local player: \"" + text + "\"")); } switch (text) { case "/debug": { AllItemsList val2 = StartOfRound.Instance?.allItemsList; int num = val2?.itemsList?.Count ?? (-1); bool valueOrDefault = val2?.itemsList?.Any((Item i) => i.itemName == "Temerskie") == true; __instance.AddTextToChatOnServer($"[Temerskie] Debug: itemsList.Count={num} found={valueOrDefault}", playerId); return false; } case "/test": { TemerskieMod.ForceBialaMewa = !TemerskieMod.ForceBialaMewa; string text2 = (TemerskieMod.ForceBialaMewa ? "[Temerskie] Biała Mewa forced ON (100% chance)" : "[Temerskie] Biała Mewa forced OFF"); ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)text2); } HUDManager.Instance.AddTextToChatOnServer(text2, (int)val.playerClientId); return false; } case "/zmora": SpawnZmora(val); return false; default: if (text.StartsWith("/tp") || text.StartsWith("/temerskie")) { TeleportToNearestTemerskie(val); return false; } break; } } catch (Exception arg) { ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogError((object)$"Chat handler error: {arg}"); } } return true; } private static void TeleportToNearestTemerskie(PlayerControllerB player) { //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0074: Unknown result type (might be due to invalid IL or missing references) PhysicsProp[] array = Object.FindObjectsOfType(); PhysicsProp val = null; float num = float.MaxValue; Vector3 position = ((Component)player).transform.position; PhysicsProp[] array2 = array; foreach (PhysicsProp val2 in array2) { if (!(((GrabbableObject)val2).itemProperties?.itemName != "Temerskie") && ((NetworkBehaviour)val2).IsSpawned && !((GrabbableObject)val2).isHeld) { float num2 = Vector3.Distance(position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { HUDManager.Instance.AddTextToChatOnServer("[Temerskie] No Temerskie scrap found on the map.", (int)player.playerClientId); return; } Vector3 val3 = FindSafePosition(((Component)val).transform.position, position); player.TeleportPlayer(val3, false, 0f, false, true); HUDManager.Instance.AddTextToChatOnServer($"[Temerskie] Teleported to ({val3.x:F1}, {val3.y:F1}, {val3.z:F1})", (int)player.playerClientId); GiveProFlashlight(player); } private static Vector3 FindSafePosition(Vector3 scrapPos, Vector3 playerPos) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0078: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_015f: 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_0168: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = scrapPos - playerPos; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.up * 1f; Vector3[] obj = new Vector3[10] { normalized, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3) }; val = normalized + Vector3.forward; obj[1] = ((Vector3)(ref val)).normalized; val = normalized - Vector3.forward; obj[2] = ((Vector3)(ref val)).normalized; val = normalized + Vector3.right; obj[3] = ((Vector3)(ref val)).normalized; val = normalized - Vector3.right; obj[4] = ((Vector3)(ref val)).normalized; obj[5] = Vector3.forward; obj[6] = Vector3.back; obj[7] = Vector3.right; obj[8] = Vector3.left; val = normalized + Vector3.forward - Vector3.right; obj[9] = ((Vector3)(ref val)).normalized; Vector3[] array = (Vector3[])(object)obj; int mask = LayerMask.GetMask(new string[5] { "Default", "Terrain", "Room", "InteractableObject", "Colliders" }); float[] array2 = new float[4] { 1.5f, 2f, 2.5f, 3f }; foreach (float num in array2) { Vector3[] array3 = array; foreach (Vector3 val3 in array3) { Vector3 val4 = scrapPos + val3 * num + val2; if (!Physics.CheckSphere(val4, 0.5f, mask)) { return val4; } } } return scrapPos + normalized * 3f + Vector3.up * 2f; } private static void SpawnZmora(PlayerControllerB player) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer || (Object)(object)TemerskieMod.ZmoraEnemyType == (Object)null) { return; } float num = Random.Range(10f, 20f); float num2 = Random.Range(0f, 360f); Vector3 val = Quaternion.Euler(0f, num2, 0f) * Vector3.forward; Vector3 val2 = ((Component)player).transform.position + val * num; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val2.x, val2.y + 5f, val2.z); NavMeshHit val4 = default(NavMeshHit); if (!NavMesh.SamplePosition(val3, ref val4, 20f, -1)) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogWarning((object)"Zmora spawn aborted: no valid NavMesh near player"); } HUDManager.Instance.AddTextToChatOnServer("[Temerskie] No valid spawn point for Zmora.", (int)player.playerClientId); return; } ZmoraAI.PrepareSpawn(TemerskieMod.ZmoraEnemyType, ((NetworkBehaviour)player).NetworkObjectId); NetworkObjectReference val5 = RoundManager.Instance.SpawnEnemyGameObject(((NavMeshHit)(ref val4)).position, 0f, -1, TemerskieMod.ZmoraEnemyType); NetworkObject val6 = default(NetworkObject); if (((NetworkObjectReference)(ref val5)).TryGet(ref val6, (NetworkManager)null)) { (((Component)val6).GetComponent() ?? ((Component)val6).GetComponentInChildren())?.ApplyPendingTarget(); } ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)$"Zmora spawned at {((NavMeshHit)(ref val4)).position}"); } HUDManager.Instance.AddTextToChatOnServer("[Temerskie] Zmora summoned!", (int)player.playerClientId); } private static void GiveProFlashlight(PlayerControllerB player) { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance?.allItemsList == (Object)null) { return; } Item val = null; foreach (Item items in instance.allItemsList.itemsList) { if (items.itemName.Equals("Flashlight", StringComparison.OrdinalIgnoreCase)) { val = items; break; } } if ((Object)(object)val == (Object)null) { foreach (Item items2 in instance.allItemsList.itemsList) { if (items2.itemName.IndexOf("flashlight", StringComparison.OrdinalIgnoreCase) >= 0) { val = items2; break; } } } if ((Object)(object)val?.spawnPrefab == (Object)null) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogWarning((object)"Pro-flashlight item not found in allItemsList"); } return; } Vector3 position = ((Component)player).transform.position; Vector3 val2 = -((Component)player).transform.forward; Vector3 val3 = position + val2 * 1.2f + Vector3.up * 1.5f; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, Vector3.down, ref val4, 3f, LayerMask.GetMask(new string[2] { "Default", "Terrain" }))) { val3 = ((RaycastHit)(ref val4)).point + Vector3.up * 0.3f; } GameObject val5 = Object.Instantiate(val.spawnPrefab, val3, Quaternion.identity); val5.GetComponent().Spawn(false); ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)"Spawned pro-flashlight near player"); } } } public class TemerskieProp : PhysicsProp { private static readonly Dictionary _activeZmoras = new Dictionary(); private bool _isDrinking; private Vector3 _origPosOff; private Vector3 _origRotOff; private AudioSource? _audio; private AudioClip? _gulpClip; public override void Start() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) ((GrabbableObject)this).Start(); _audio = ((Component)this).GetComponent(); if ((Object)(object)_audio == (Object)null) { _audio = ((Component)this).gameObject.AddComponent(); _audio.spatialBlend = 1f; } Item itemProperties = ((GrabbableObject)this).itemProperties; if ((Object)(object)itemProperties != (Object)null) { itemProperties.holdButtonUse = false; itemProperties.syncUseFunction = true; itemProperties.toolTips = new string[1] { "Wypij za Temerie : [LMB]" }; _gulpClip = itemProperties.dropSFX ?? itemProperties.grabSFX; _origPosOff = itemProperties.positionOffset; _origRotOff = itemProperties.rotationOffset; } } public override void Update() { ((GrabbableObject)this).Update(); if (!_isDrinking && ((GrabbableObject)this).isHeld && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)GameNetworkManager.Instance?.localPlayerController && Mouse.current.leftButton.wasPressedThisFrame) { StartDrinkingServerRpc(); } } [ServerRpc(RequireOwnership = false)] private void StartDrinkingServerRpc() { StartDrinkingClientRpc(); } [ClientRpc] private void StartDrinkingClientRpc() { ((MonoBehaviour)this).StartCoroutine(DrinkAnimation()); } private IEnumerator DrinkAnimation() { _isDrinking = true; Item ip = ((GrabbableObject)this).itemProperties; Vector3 startPos = ip.positionOffset; Vector3 startRot = ip.rotationOffset; Vector3 raisePos = startPos + new Vector3(0f, 0.15f, -0.2f); Vector3 raiseRot = startRot + new Vector3(60f, 0f, 0f); float dur = 0.3f; float elapsed = 0f; while (elapsed < dur) { elapsed += Time.deltaTime; float t = elapsed / dur; ip.positionOffset = Vector3.Lerp(startPos, raisePos, t); ip.rotationOffset = Vector3.Lerp(startRot, raiseRot, t); yield return null; } ip.positionOffset = raisePos; ip.rotationOffset = raiseRot; if ((Object)(object)_audio != (Object)null && (Object)(object)_gulpClip != (Object)null) { float saved = _audio.pitch; _audio.pitch = Random.Range(0.9f, 1f); _audio.PlayOneShot(_gulpClip); _audio.pitch = saved; } yield return (object)new WaitForSeconds(0.7f); if ((Object)(object)_audio != (Object)null && (Object)(object)_gulpClip != (Object)null) { float saved2 = _audio.pitch; _audio.pitch = Random.Range(1.1f, 1.2f); _audio.PlayOneShot(_gulpClip); _audio.pitch = saved2; } yield return (object)new WaitForSeconds(0.15f); elapsed = 0f; while (elapsed < dur) { elapsed += Time.deltaTime; float t2 = elapsed / dur; ip.positionOffset = Vector3.Lerp(raisePos, startPos, t2); ip.rotationOffset = Vector3.Lerp(raiseRot, startRot, t2); yield return null; } ip.positionOffset = startPos; ip.rotationOffset = startRot; if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { PlayerControllerB p = ((GrabbableObject)this).playerHeldBy; p.DestroyItemInSlotAndSync(p.currentItemSlot); p.movementSpeed *= 2f; GameObject baseReset = new GameObject("TemerskieSpeedReset"); Object.DontDestroyOnLoad((Object)(object)baseReset); baseReset.AddComponent().StartReset(p, 30f); float roll = (TemerskieMod.ForceBialaMewa ? 0f : Random.value); if (roll < 0.01f) { BialaMewaServerRpc(NetworkObjectReference.op_Implicit(((Component)p).GetComponent())); } else if (roll < 0.11f) { RandomEffectServerRpc(NetworkObjectReference.op_Implicit(((Component)p).GetComponent())); } } _isDrinking = false; } [ServerRpc(RequireOwnership = false)] private void BialaMewaServerRpc(NetworkObjectReference playerRef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) BialaMewaClientRpc(playerRef); NetworkObject val = default(NetworkObject); if (NetworkManager.Singleton.IsServer && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val, (NetworkManager)null)) { PlayerControllerB component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { SpawnZmora(component); } } } private void SpawnZmora(PlayerControllerB player) { //IL_002a: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)TemerskieMod.ZmoraEnemyType == (Object)null)) { DespawnZmora((int)player.playerClientId); Vector3 val = ((Component)player).transform.forward * -4f + Vector3.up * 1.5f; Vector3 val2 = ((Component)player).transform.position + val; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(val2, ref val3, 20f, -1)) { val2 = ((NavMeshHit)(ref val3)).position; } ZmoraAI.PrepareSpawn(TemerskieMod.ZmoraEnemyType, ((NetworkBehaviour)player).NetworkObjectId); NetworkObjectReference val4 = RoundManager.Instance.SpawnEnemyGameObject(val2, 0f, -1, TemerskieMod.ZmoraEnemyType); NetworkObject val5 = default(NetworkObject); if (((NetworkObjectReference)(ref val4)).TryGet(ref val5, (NetworkManager)null)) { (((Component)val5).GetComponent() ?? ((Component)val5).GetComponentInChildren())?.ApplyPendingTarget(); _activeZmoras[(int)player.playerClientId] = val5; } } } internal static void DespawnZmora(int playerClientId) { if (NetworkManager.Singleton.IsServer && _activeZmoras.TryGetValue(playerClientId, out NetworkObject value)) { if ((Object)(object)value != (Object)null && value.IsSpawned) { value.Despawn(false); } _activeZmoras.Remove(playerClientId); } } [ClientRpc] private void BialaMewaClientRpc(NetworkObjectReference playerRef) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref playerRef)).TryGet(ref val, (NetworkManager)null)) { return; } PlayerControllerB component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.movementSpeed *= 1.25f; float carryWeight = component.carryWeight; component.carryWeight = carryWeight / 1.25f; GameObject val2 = new GameObject("TemerskieMewa"); Object.DontDestroyOnLoad((Object)(object)val2); val2.AddComponent().StartEffect(component, 20f, carryWeight); if ((Object)(object)component == (Object)(object)GameNetworkManager.Instance?.localPlayerController) { component.drunkness = 1f; component.drunknessSpeed = 0f; } } } [ServerRpc(RequireOwnership = false)] private void RandomEffectServerRpc(NetworkObjectReference playerRef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) RandomEffectClientRpc(playerRef); } [ClientRpc] private void RandomEffectClientRpc(NetworkObjectReference playerRef) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0050: 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_00f4: Expected O, but got Unknown NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref playerRef)).TryGet(ref val, (NetworkManager)null)) { return; } PlayerControllerB component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { GameObject val2 = new GameObject("TemerskieBurp"); Object.DontDestroyOnLoad((Object)(object)val2); val2.transform.position = ((Component)component).transform.position; AudioSource val3 = val2.AddComponent(); val3.spatialBlend = 1f; val3.maxDistance = 500f; val3.minDistance = 10f; val3.rolloffMode = (AudioRolloffMode)1; val3.volume = 1.5f; val3.pitch = Random.Range(0.3f, 0.6f); if ((Object)(object)_gulpClip != (Object)null) { val3.PlayOneShot(_gulpClip); } Object.Destroy((Object)(object)val2, 3f); if (((NetworkBehaviour)this).IsOwner) { GameObject val4 = new GameObject("TemerskieRandomKnockdown"); Object.DontDestroyOnLoad((Object)(object)val4); val4.AddComponent().StartEffect(component); } } } public override void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); ((GrabbableObject)this).OnDestroy(); } } internal class TemerskieSpeedReset : MonoBehaviour { private PlayerControllerB? _player; private float _timer; public void StartReset(PlayerControllerB player, float delay) { _player = player; _timer = delay; } private void Update() { if ((Object)(object)_player == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _timer -= Time.deltaTime; if (_timer <= 0f) { PlayerControllerB? player = _player; player.movementSpeed *= 0.5f; Object.Destroy((Object)(object)((Component)this).gameObject); } } } internal class TemerskieMewaEffect : MonoBehaviour { private PlayerControllerB? _player; private float _timer; private float _origCarryWeight; private float _speedBeforeKnockdown; private bool _hasFallen; public void StartEffect(PlayerControllerB player, float duration, float origCarryWeight) { _player = player; _timer = duration; _origCarryWeight = origCarryWeight; } private void Update() { if ((Object)(object)_player == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _timer -= Time.deltaTime; if (_timer <= 0f && !_hasFallen) { _hasFallen = true; PlayerControllerB? player = _player; player.movementSpeed /= 1.25f; _player.carryWeight = _origCarryWeight; if ((Object)(object)_player == (Object)(object)GameNetworkManager.Instance?.localPlayerController) { _player.drunkness = 0f; _player.drunknessSpeed = 1f; } _speedBeforeKnockdown = _player.movementSpeed; _player.movementSpeed = 0f; ((MonoBehaviour)this).Invoke("RestoreMovement", 3f); } } private void RestoreMovement() { if ((Object)(object)_player != (Object)null) { if (NetworkManager.Singleton.IsServer) { TemerskieProp.DespawnZmora((int)_player.playerClientId); } _player.movementSpeed = _speedBeforeKnockdown; } Object.Destroy((Object)(object)((Component)this).gameObject); } } internal class TemerskieRandomKnockdown : MonoBehaviour { private PlayerControllerB? _player; private float _savedSpeed; private bool _started; public void StartEffect(PlayerControllerB player) { _player = player; } private void Update() { if ((Object)(object)_player == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (!_started) { _started = true; _savedSpeed = _player.movementSpeed; _player.movementSpeed = 0f; ((MonoBehaviour)this).Invoke("ApplySpeedBoost", 2f); } } private void ApplySpeedBoost() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if ((Object)(object)_player == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _player.movementSpeed = _savedSpeed * 2f; GameObject val = new GameObject("TemerskieRandomSpeed"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent().StartReset(_player, 5f); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class ZmoraAI : EnemyAI { private const int STATE_ROAM = 0; private const int STATE_HUNT = 1; private const int STATE_ATTACK = 2; public NetworkVariable targetPlayerId = new NetworkVariable(ulong.MaxValue, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private PlayerControllerB? _targetPlayer; private float _phaseTimer = 10f; private float _flickerTimer; private bool _isFlickering; private Vector3 _roamTarget; private bool _hasRoamTarget; private Vector3 _huntTarget; private bool _hasHuntTarget; private Vector3 _lastNoisePos; private float _noiseAge = float.MaxValue; private bool _hasAttacked; internal ulong pendingTargetPlayerId = ulong.MaxValue; private float _targetRefreshTimer = 0f; private float _huntTimer = 0f; private bool _hasSeenPlayer = false; private bool _isRetreating = false; private float _retreatTimer = 0f; private float _verticalVelocity = 0f; private float _gravity = -30f; private float _terminalVelocity = -50f; private float _groundCheckDistance = 0.3f; private int _groundLayerMask; private int _wallLayerMask; private int _obstacleDoorLayerMask; private bool _isGrounded; private Rigidbody? _rigidbody; private CapsuleCollider? _capsuleCollider; private int _currentInteriorIndex = -1; private float _interiorCheckTimer = 0f; private Vector3 _moveVelocity; private float _teleportCooldown = 0f; private const float TELEPORT_COOLDOWN = 3f; private const float TELEPORT_RANGE = 15f; private const float TELEPORT_MIN_DIST = 5f; private const float FLY_HEIGHT_THRESHOLD = 5f; private const float FLY_SPEED = 8f; private MeshRenderer[]? _myRenderers; private ParticleSystem? _smokeParticles; private bool _currentVisible; private bool _callbacksHooked; private bool _initialized; private float _aiTimer; private Vector3? _manualMoveTarget; private float _manualMoveSpeed; internal static void PrepareSpawn(EnemyType type, ulong targetPlayerId) { ZmoraSpawnContext.NextEnemyType = type; ZmoraSpawnContext.NextTargetId = targetPlayerId; } internal bool IsTargetingPlayer(ulong playerNetworkObjectId) { if (targetPlayerId.Value == playerNetworkObjectId) { return true; } return pendingTargetPlayerId == playerNetworkObjectId; } public override void Start() { if (!((Object)(object)((NetworkBehaviour)this).NetworkObject == (Object)null) && ((NetworkBehaviour)this).NetworkObject.IsSpawned) { if (base.meshRenderers == null || base.meshRenderers.Length == 0) { base.meshRenderers = ((Component)this).GetComponentsInChildren(true); } if (base.skinnedMeshRenderers == null || base.skinnedMeshRenderers.Length == 0) { base.skinnedMeshRenderers = ((Component)this).GetComponentsInChildren(true); } if ((Object)(object)base.creatureSFX == (Object)null) { base.creatureSFX = ((Component)this).GetComponent(); } if ((Object)(object)base.creatureAnimator == (Object)null) { base.creatureAnimator = ((Component)this).GetComponentInChildren(true); } InitializeEnemy(); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ManualLogSource? log = TemerskieMod._log; if (log != null) { object arg = ((NetworkBehaviour)this).IsServer; NetworkObject networkObject = ((NetworkBehaviour)this).NetworkObject; log.LogInfo((object)$"Zmora OnNetworkSpawn - IsServer: {arg}, IsSpawned: {((networkObject != null) ? new bool?(networkObject.IsSpawned) : ((bool?)null))}, IsOwner: {((NetworkBehaviour)this).IsOwner}"); } ZmoraSpawnContext.Consume(this); InitializeEnemy(); if (((NetworkBehaviour)this).IsServer) { ApplyPendingTarget(); } } private IEnumerator ApplyPendingTargetDeferred() { yield return (object)new WaitUntil((Func)(() => (Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.IsSpawned)); yield return (object)new WaitForSeconds(0.1f); ApplyPendingTarget(); } internal void ApplyPendingTarget() { if (!((NetworkBehaviour)this).IsServer || pendingTargetPlayerId == ulong.MaxValue) { return; } if ((Object)(object)((NetworkBehaviour)this).NetworkObject == (Object)null || !((NetworkBehaviour)this).NetworkObject.IsSpawned) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)"Zmora: NetworkObject not spawned yet, deferring target assignment"); } ((MonoBehaviour)this).StartCoroutine(ApplyPendingTargetDeferred()); return; } targetPlayerId.Value = pendingTargetPlayerId; pendingTargetPlayerId = ulong.MaxValue; ResolveTargetPlayer(); ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)$"Zmora target set to player id {targetPlayerId.Value}"); } } internal void ConfigureAfterSpawn(EnemyType type) { base.enemyType = type; base.ventAnimationFinished = true; DisableBasePathfinding(); SnapToNavMesh(); ApplyPendingTarget(); if ((Object)(object)RoundManager.Instance != (Object)null && !RoundManager.Instance.SpawnedEnemies.Contains((EnemyAI)(object)this)) { RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this); } } private void DisableBasePathfinding() { base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; if ((Object)(object)base.agent != (Object)null) { ((Behaviour)base.agent).enabled = false; } } private void InitializeEnemy() { //IL_0243: Unknown result type (might be due to invalid IL or missing references) ManualLogSource? log = TemerskieMod._log; if (log != null) { object arg = _initialized; NetworkObject networkObject = ((NetworkBehaviour)this).NetworkObject; NetworkObject networkObject2 = ((NetworkBehaviour)this).NetworkObject; log.LogInfo((object)$"Zmora InitializeEnemy - _initialized: {arg}, NetworkObject: {networkObject}, IsSpawned: {((networkObject2 != null) ? new bool?(networkObject2.IsSpawned) : ((bool?)null))}"); } if (_initialized) { return; } _initialized = true; if ((Object)(object)base.enemyType == (Object)null) { base.enemyType = ZmoraSpawnContext.NextEnemyType ?? TemerskieMod.ZmoraEnemyType; } ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)("Zmora enemyType: " + (base.enemyType?.enemyName ?? "null"))); } base.ventAnimationFinished = true; base.timeSinceSpawn = base.exitVentAnimationTime + 1f; if ((Object)(object)base.agent == (Object)null) { base.agent = ((Component)this).GetComponent(); } if ((Object)(object)base.agent != (Object)null) { base.agent.radius = 0.1f; base.agent.height = 0.2f; base.agent.autoRepath = false; base.agent.updatePosition = false; base.agent.updateRotation = false; base.agent.stoppingDistance = 0.5f; } _rigidbody = ((Component)this).GetComponent(); if ((Object)(object)_rigidbody == (Object)null) { _rigidbody = ((Component)this).gameObject.AddComponent(); } _rigidbody.useGravity = false; _rigidbody.isKinematic = false; _rigidbody.constraints = (RigidbodyConstraints)112; _rigidbody.mass = 100f; _rigidbody.collisionDetectionMode = (CollisionDetectionMode)2; _capsuleCollider = ((Component)this).GetComponent(); if ((Object)(object)_capsuleCollider == (Object)null) { _capsuleCollider = ((Component)this).gameObject.AddComponent(); } _capsuleCollider.radius = 0.4f; _capsuleCollider.height = 1.8f; _capsuleCollider.center = new Vector3(0f, 0.9f, 0f); _groundLayerMask = LayerMask.GetMask(new string[5] { "Default", "Terrain", "Room", "InteractableObject", "Colliders" }); _wallLayerMask = LayerMask.GetMask(new string[4] { "Default", "Terrain", "Room", "Colliders" }); _obstacleDoorLayerMask = LayerMask.GetMask(new string[4] { "InteractableObject", "Door", "Doors", "Obstacles" }); DisableBasePathfinding(); SnapToNavMesh(); try { ((EnemyAI)this).Start(); } catch (Exception ex) { ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogWarning((object)("Zmora base.Start partial fail: " + ex.Message)); } } ((Behaviour)this).enabled = true; DisableBasePathfinding(); base.ventAnimationFinished = true; SnapToNavMesh(); if (base.meshRenderers == null || base.meshRenderers.Length == 0) { base.meshRenderers = ((Component)this).GetComponentsInChildren(true); } ManualLogSource? log4 = TemerskieMod._log; if (log4 != null) { MeshRenderer[] meshRenderers = base.meshRenderers; log4.LogInfo((object)$"Zmora meshRenderers found: {((meshRenderers != null) ? meshRenderers.Length : 0)}"); } if ((Object)(object)base.creatureAnimator == (Object)null) { base.creatureAnimator = ((Component)this).GetComponentInChildren(true); } if ((Object)(object)base.creatureSFX == (Object)null) { base.creatureSFX = ((Component)this).GetComponent(); } base.AIIntervalTime = 0.3f; base.enemyHP = 20; base.openDoorSpeedMultiplier = 1f; base.currentBehaviourStateIndex = 0; _phaseTimer = 10f; _flickerTimer = Random.Range(3f, 5f); _aiTimer = base.AIIntervalTime; _myRenderers = ((Component)this).GetComponentsInChildren(true); _smokeParticles = ((Component)this).GetComponentInChildren(true); SetVisible(visible: false); ResolveTargetPlayer(); if (!_callbacksHooked) { NetworkVariable obj = targetPlayerId; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)(OnValueChangedDelegate)delegate { ResolveTargetPlayer(); }); _callbacksHooked = true; } ManualLogSource? log5 = TemerskieMod._log; if (log5 != null) { log5.LogInfo((object)$"Zmora InitializeEnemy complete - AIIntervalTime: {base.AIIntervalTime}, _aiTimer: {_aiTimer}, enabled: {((Behaviour)this).enabled}, activeInHierarchy: {((Component)this).gameObject.activeInHierarchy}"); } } public override void Update() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0352: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) ManualLogSource? log = TemerskieMod._log; if (log != null) { object[] obj = new object[4] { ((NetworkBehaviour)this).IsServer, null, null, null }; NetworkObject networkObject = ((NetworkBehaviour)this).NetworkObject; obj[1] = ((networkObject != null) ? new bool?(networkObject.IsSpawned) : ((bool?)null)); obj[2] = ((Behaviour)this).enabled; obj[3] = ((Component)this).gameObject.activeInHierarchy; log.LogInfo((object)string.Format("Zmora Update - IsServer: {0}, IsSpawned: {1}, enabled: {2}, activeInHierarchy: {3}", obj)); } if (!((NetworkBehaviour)this).IsServer) { UpdateVisibility(); return; } DisableBasePathfinding(); HandlePhysics(); TickManualMovementPhysics(); if (_aiTimer > 0f) { _aiTimer -= Time.deltaTime; } else { _aiTimer = base.AIIntervalTime + Random.Range(-0.015f, 0.015f); ((EnemyAI)this).DoAIInterval(); } _targetRefreshTimer += Time.deltaTime; if (_targetRefreshTimer > 5f) { _targetRefreshTimer = 0f; if (base.currentBehaviourStateIndex == 0 && _hasRoamTarget) { float num = Vector3.Distance(_roamTarget, ((Component)_targetPlayer).transform.position); if (num > 20f) { _hasRoamTarget = false; ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)"Zmora: Player moved far, refreshing roam target"); } } } else if (base.currentBehaviourStateIndex == 1 && _hasHuntTarget) { float num2 = Vector3.Distance(_huntTarget, ((Component)_targetPlayer).transform.position); if (num2 > 20f) { _hasHuntTarget = false; ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogInfo((object)"Zmora: Player moved far, refreshing hunt target"); } } } } if (base.isEnemyDead || (Object)(object)_targetPlayer == (Object)null) { return; } float num3 = ((base.currentBehaviourStateIndex == 2) ? 1.5f : 10f); float num4 = Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position); if (num4 < num3) { Vector3 val = ((Component)this).transform.position - ((Component)_targetPlayer).transform.position; Vector3 val2 = ((Vector3)(ref val)).normalized; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.001f) { val2 = Vector3.forward; } _moveVelocity += val2 * (num3 - num4) * 15f; _moveVelocity = Vector3.ClampMagnitude(_moveVelocity, 20f); } Vector3 val3 = ((Component)_targetPlayer).transform.position - ((Component)this).transform.position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude > 0.001f) { Quaternion val4 = Quaternion.LookRotation(val3); _rigidbody.MoveRotation(Quaternion.Slerp(_rigidbody.rotation, val4, 5f * Time.deltaTime)); } if (((NetworkBehaviour)this).IsOwner) { SyncPositionToClients(); } } private void SyncPositionToClients() { } private void HandlePhysics() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Invalid comparison between Unknown and I4 if ((Object)(object)_rigidbody == (Object)null || (Object)(object)_capsuleCollider == (Object)null) { return; } Vector3 val = ((Component)this).transform.position + _capsuleCollider.center - Vector3.up * (_capsuleCollider.height * 0.5f - _capsuleCollider.radius); Vector3 val2 = ((Component)this).transform.position + _capsuleCollider.center + Vector3.up * (_capsuleCollider.height * 0.5f - _capsuleCollider.radius); RaycastHit val3 = default(RaycastHit); _isGrounded = Physics.CapsuleCast(val, val2, _capsuleCollider.radius, Vector3.down, ref val3, _groundCheckDistance + 0.05f, _groundLayerMask); if (_isGrounded) { _verticalVelocity = 0f; if (((RaycastHit)(ref val3)).distance < _groundCheckDistance) { Vector3 position = ((Component)this).transform.position; position.y = ((RaycastHit)(ref val3)).point.y + _capsuleCollider.height * 0.5f; _rigidbody.MovePosition(position); } } else { _verticalVelocity += _gravity * Time.deltaTime; _verticalVelocity = Mathf.Max(_verticalVelocity, _terminalVelocity); } if (!((Object)(object)_targetPlayer != (Object)null) || (base.currentBehaviourStateIndex != 1 && base.currentBehaviourStateIndex != 2)) { return; } float num = ((Component)_targetPlayer).transform.position.y - ((Component)this).transform.position.y; if (!(num > 5f)) { return; } bool flag = false; if ((Object)(object)RoundManager.Instance != (Object)null) { NavMeshPath val4 = new NavMeshPath(); flag = NavMesh.CalculatePath(((Component)this).transform.position, ((Component)_targetPlayer).transform.position, -1, val4) && (int)val4.status == 0; } if (!flag || !_isGrounded) { _verticalVelocity = Mathf.Max(_verticalVelocity, 8f); ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora flying up: yDiff={num:F1}, grounded={_isGrounded}, hasPath={flag}, vVel={_verticalVelocity:F1}"); } } } private void TickManualMovementPhysics() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_01dd: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) if (!_manualMoveTarget.HasValue) { return; } Vector3 val = _manualMoveTarget.Value - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).magnitude < 0.5f) { _manualMoveTarget = null; _moveVelocity = Vector3.zero; return; } Vector3 val2 = ((Vector3)(ref val)).normalized; float manualMoveSpeed = _manualMoveSpeed; Vector3 val3 = ((Component)this).transform.position + _capsuleCollider.center - Vector3.up * (_capsuleCollider.height * 0.5f - _capsuleCollider.radius); Vector3 val4 = ((Component)this).transform.position + _capsuleCollider.center + Vector3.up * (_capsuleCollider.height * 0.5f - _capsuleCollider.radius); float num = manualMoveSpeed * Time.deltaTime + 0.5f; RaycastHit val5 = default(RaycastHit); if (Physics.CapsuleCast(val3, val4, _capsuleCollider.radius, val2, ref val5, num, _wallLayerMask)) { if (((RaycastHit)(ref val5)).normal.y > 0.7f) { if (_isGrounded && ((RaycastHit)(ref val5)).normal.y > 0.01f) { _verticalVelocity = Mathf.Max(_verticalVelocity, 5f); } } else { Vector3 val6 = Vector3.ProjectOnPlane(val2, ((RaycastHit)(ref val5)).normal); Vector3 normalized = ((Vector3)(ref val6)).normalized; if (!(((Vector3)(ref normalized)).sqrMagnitude > 0.01f)) { _manualMoveTarget = null; _moveVelocity = Vector3.zero; return; } RaycastHit val7 = default(RaycastHit); if (Physics.CapsuleCast(val3, val4, _capsuleCollider.radius, normalized, ref val7, num, _wallLayerMask)) { _manualMoveTarget = null; _moveVelocity = Vector3.zero; return; } val2 = normalized; } } if (_isGrounded) { Vector3 val8 = ((Component)this).transform.position + val2 * (manualMoveSpeed * Time.deltaTime + 0.5f); RaycastHit val9 = default(RaycastHit); if (Physics.Raycast(val8 + Vector3.up * 0.5f, Vector3.down, ref val9, 1.5f, _groundLayerMask)) { float num2 = ((RaycastHit)(ref val9)).point.y - ((Component)this).transform.position.y; if (num2 > 0.2f && num2 < 0.6f) { _verticalVelocity = Mathf.Max(_verticalVelocity, 8f); } } } _moveVelocity = val2 * manualMoveSpeed; Vector3 val10 = ((Component)this).transform.position + new Vector3(_moveVelocity.x, _verticalVelocity, _moveVelocity.z) * Time.deltaTime; _rigidbody.MovePosition(val10); } public override void DoAIInterval() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) DisableBasePathfinding(); ManualLogSource? log = TemerskieMod._log; if (log != null) { object[] obj = new object[4] { GetBehaviourStateLabel(), null, null, null }; PlayerControllerB? targetPlayer = _targetPlayer; obj[1] = ((targetPlayer != null) ? ((Object)targetPlayer).name : null) ?? "null"; obj[2] = base.enemyHP; obj[3] = ((Component)this).transform.position; log.LogInfo((object)string.Format("Zmora DoAIInterval - State: {0}, Target: {1}, HP: {2}, Pos: {3}", obj)); } if (base.isEnemyDead) { return; } if (!HasValidTarget()) { ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogWarning((object)"Zmora: No valid target"); } return; } switch (base.currentBehaviourStateIndex) { case 0: Phase1Roam(); break; case 1: Phase2Hunt(); break; case 2: Phase3Attack(); break; } UpdateVisibility(); } private bool HasValidTarget() { if ((Object)(object)_targetPlayer != (Object)null) { return true; } ResolveTargetPlayer(); return (Object)(object)_targetPlayer != (Object)null; } private void ResolveTargetPlayer() { _targetPlayer = null; ulong value = targetPlayerId.Value; if (value == ulong.MaxValue && pendingTargetPlayerId != ulong.MaxValue) { value = pendingTargetPlayerId; } if (value == ulong.MaxValue) { return; } PlayerControllerB[] array = Object.FindObjectsOfType(); PlayerControllerB[] array2 = array; foreach (PlayerControllerB val in array2) { if (((NetworkBehaviour)val).NetworkObjectId == value) { _targetPlayer = val; base.targetPlayer = val; ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora ResolveTargetPlayer: Found target {((Object)val).name} (NetworkObjectId: {value})"); } return; } } ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogWarning((object)$"Zmora ResolveTargetPlayer: Target ID {value} not found among {array.Length} players"); } } private bool SnapToNavMesh() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) if ((Object)(object)RoundManager.Instance == (Object)null) { return false; } Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, RoundManager.Instance.navHit, 50f, -1); if (navMeshPosition == Vector3.zero) { return false; } if ((Object)(object)_rigidbody != (Object)null) { _rigidbody.MovePosition(navMeshPosition); } else { ((Component)this).transform.position = navMeshPosition; } return true; } private void MoveTo(Vector3 target, float speed = 7f) { //IL_002f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fc: 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_0182: 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_0118: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RoundManager.Instance != (Object)null) { target = RoundManager.Instance.GetNavMeshPosition(target, RoundManager.Instance.navHit, 20f, -1); } if (target == Vector3.zero) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogWarning((object)"Zmora MoveTo: Invalid target position (got zero)"); } return; } float num = Mathf.Abs(target.y - ((Component)_targetPlayer).transform.position.y); if (num > 3f && (Object)(object)_targetPlayer != (Object)null) { ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)$"Zmora MoveTo: Navmesh Y diff {num:F1} - trying direct approach"); } target = ((Component)_targetPlayer).transform.position; } if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)_targetPlayer != (Object)null) { NavMeshPath val = new NavMeshPath(); if (!NavMesh.CalculatePath(((Component)this).transform.position, target, -1, val) || (int)val.status > 0) { ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogInfo((object)$"Zmora MoveTo: No valid navmesh path to target (status: {val.status}), using direct approach"); } target = ((Component)_targetPlayer).transform.position; } } _manualMoveTarget = target; _manualMoveSpeed = speed; ManualLogSource? log4 = TemerskieMod._log; if (log4 != null) { log4.LogInfo((object)$"Zmora MoveTo: target={target}, speed={speed}"); } } private void Phase1Roam() { //IL_0131: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0236: 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) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) if (!HasValidTarget()) { return; } _phaseTimer -= base.AIIntervalTime; _flickerTimer -= base.AIIntervalTime; ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora Phase1Roam - PhaseTimer: {_phaseTimer:F1}, FlickerTimer: {_flickerTimer:F1}, IsFlickering: {_isFlickering}"); } if (_flickerTimer <= 0f) { if (!_isFlickering) { SetVisible(visible: true); _isFlickering = true; _flickerTimer = Random.Range(0.8f, 2f); } else { SetVisible(visible: false); _isFlickering = false; _flickerTimer = Random.Range(3f, 6f); } } if (_isFlickering && PlayerIsLooking()) { SetVisible(visible: false); _isFlickering = false; _flickerTimer = Random.Range(3f, 6f); } if (!_hasRoamTarget || Vector3.Distance(((Component)this).transform.position, _roamTarget) < 2f) { Vector3 val = FindRoamPositionBehindCover(); if (val != Vector3.zero) { _roamTarget = val; _hasRoamTarget = true; ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)$"Zmora Roam - New target behind cover: {_roamTarget}"); } MoveTo(_roamTarget); } else { Vector3 val2 = ((Component)this).transform.position - ((Component)_targetPlayer).transform.position; Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.right; } Vector3 val4 = val3 * Random.Range(7f, 15f); _roamTarget = ((Component)_targetPlayer).transform.position + val4; _hasRoamTarget = true; ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogInfo((object)$"Zmora Roam - New target (fallback): {_roamTarget}"); } MoveTo(_roamTarget); } } if (_phaseTimer <= 0f) { ManualLogSource? log4 = TemerskieMod._log; if (log4 != null) { log4.LogInfo((object)"Zmora: Transitioning to HUNT phase"); } SetVisible(visible: true); _isFlickering = false; _phaseTimer = float.MaxValue; _huntTimer = 0f; _hasSeenPlayer = false; base.currentBehaviourStateIndex = 1; } } private void Phase2Hunt() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_012a: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_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_017d: 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_0181: 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_01c1: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: 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_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: 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_035f: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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_037c: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: 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_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) if (!HasValidTarget()) { return; } ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora Phase2Hunt - HuntTimer: {_huntTimer:F1}, HasSeenPlayer: {_hasSeenPlayer}, NoiseAge: {_noiseAge:F1}, HasHuntTarget: {_hasHuntTarget}, DistToTarget: {Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position):F1}"); } if (_noiseAge < 5f) { _noiseAge += base.AIIntervalTime; TryTeleportToNoise(); if (_teleportCooldown <= 0f) { MoveTo(_lastNoisePos); } } bool flag = false; float num = Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position); Vector3 val3; if (num < 25f) { Vector3 val = ((Component)this).transform.position + Vector3.up * 1.5f; Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1.5f; val3 = val2 - val; Vector3 normalized = ((Vector3)(ref val3)).normalized; float num2 = Vector3.Distance(val, val2); int mask = LayerMask.GetMask(new string[5] { "Default", "Terrain", "Room", "InteractableObject", "Colliders" }); RaycastHit val4 = default(RaycastHit); if (!Physics.Raycast(val, normalized, ref val4, num2, mask)) { flag = true; } } if (flag) { _hasSeenPlayer = true; ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)"Zmora: Can see player (LOS clear)"); } } _huntTimer += base.AIIntervalTime; bool flag2 = _huntTimer >= 30f; if (_huntTimer >= 10f && (_hasSeenPlayer || flag2) && num < 12f) { ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogInfo((object)$"Zmora: Transitioning to ATTACK phase (hunt timer >= 10s, seen: {_hasSeenPlayer}, force: {flag2})"); } base.currentBehaviourStateIndex = 2; _huntTimer = 0f; _hasSeenPlayer = false; } else { if (_hasHuntTarget && !(Vector3.Distance(((Component)this).transform.position, _huntTarget) < 2f)) { return; } Vector3 val5 = FindHuntPositionBehindCover(); if (val5 != Vector3.zero) { _huntTarget = val5; _hasHuntTarget = true; ManualLogSource? log4 = TemerskieMod._log; if (log4 != null) { log4.LogInfo((object)$"Zmora Hunt - New target behind cover: {_huntTarget}"); } MoveTo(_huntTarget); return; } val3 = ((Component)this).transform.position - ((Component)_targetPlayer).transform.position; Vector3 val6 = ((Vector3)(ref val3)).normalized; if (((Vector3)(ref val6)).sqrMagnitude < 0.01f) { val6 = Vector3.right; } Vector3 val7 = val6 * Random.Range(10f, 15f); _huntTarget = ((Component)_targetPlayer).transform.position + val7; _hasHuntTarget = true; ManualLogSource? log5 = TemerskieMod._log; if (log5 != null) { log5.LogInfo((object)$"Zmora Hunt - New target (fallback): {_huntTarget}"); } MoveTo(_huntTarget); } } private void Phase3Attack() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c8: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) if (!HasValidTarget()) { return; } ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora Phase3Attack - DistToTarget: {Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position):F1}, HasAttacked: {_hasAttacked}, IsRetreating: {_isRetreating}"); } float num = Vector3.Distance(((Component)this).transform.position, ((Component)_targetPlayer).transform.position); if (num > 20f) { ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)"Zmora: Transitioning back to HUNT phase (player too far)"); } _hasAttacked = false; _isRetreating = false; _noiseAge = float.MaxValue; base.currentBehaviourStateIndex = 1; return; } Vector3 val; if (num < 3f && !_hasAttacked) { _hasAttacked = true; _isRetreating = true; _retreatTimer = 0f; PlayerControllerB? targetPlayer = _targetPlayer; val = default(Vector3); targetPlayer.DamagePlayer(2, true, true, (CauseOfDeath)0, 0, false, val); ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogInfo((object)"Zmora: Attacked player in melee range! Starting retreat..."); } ((MonoBehaviour)this).Invoke("ResetAttack", 1f); } if (_isRetreating) { _retreatTimer += base.AIIntervalTime; val = ((Component)this).transform.position - ((Component)_targetPlayer).transform.position; Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.right; } Vector3 val3 = ((Component)this).transform.position + val2 * 10f; if ((Object)(object)RoundManager.Instance != (Object)null) { val3 = RoundManager.Instance.GetNavMeshPosition(val3, RoundManager.Instance.navHit, 8f, -1); } if (val3 != Vector3.zero) { MoveTo(val3, 12f); } ManualLogSource? log4 = TemerskieMod._log; if (log4 != null) { log4.LogInfo((object)$"Zmora: Retreating... DistToPlayer: {num:F1}, RetreatTimer: {_retreatTimer:F1}"); } if (num >= 10f || _retreatTimer >= 3f) { ManualLogSource? log5 = TemerskieMod._log; if (log5 != null) { log5.LogInfo((object)"Zmora: Finished retreat, transitioning to HUNT phase"); } _hasAttacked = false; _isRetreating = false; _noiseAge = float.MaxValue; base.currentBehaviourStateIndex = 1; _hasHuntTarget = false; } } else { MoveTo(((Component)_targetPlayer).transform.position, 10f); } } private void ResetAttack() { _hasAttacked = false; _isRetreating = false; } private Vector3 FindRoamPositionBehindCover() { //IL_01af: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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) if ((Object)(object)_targetPlayer == (Object)null || (Object)(object)RoundManager.Instance == (Object)null) { return Vector3.zero; } Vector3 position = ((Component)_targetPlayer).transform.position; Vector3 forward = ((Component)_targetPlayer).transform.forward; int mask = LayerMask.GetMask(new string[5] { "Default", "Terrain", "Room", "InteractableObject", "Colliders" }); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < 20; i++) { float num = Random.Range(0f, 360f); float num2 = Random.Range(7f, 15f); Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward; Vector3 val2 = position + val * num2; Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val2, RoundManager.Instance.navHit, 5f, -1); if (navMeshPosition == Vector3.zero) { continue; } Vector3 val3 = navMeshPosition - position; Vector3 normalized = ((Vector3)(ref val3)).normalized; float num3 = Vector3.Dot(forward, normalized); if (num3 > -0.3f) { continue; } try { if (Physics.Raycast(position + Vector3.up * 1.5f, normalized, ref val4, num2, mask) && ((RaycastHit)(ref val4)).distance < num2 * 0.8f) { return navMeshPosition; } } catch { } try { if (Physics.CheckSphere(navMeshPosition, 1.5f, mask)) { continue; } } catch { } return navMeshPosition; } return Vector3.zero; } private Vector3 FindHuntPositionBehindCover() { //IL_01af: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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) if ((Object)(object)_targetPlayer == (Object)null || (Object)(object)RoundManager.Instance == (Object)null) { return Vector3.zero; } Vector3 position = ((Component)_targetPlayer).transform.position; Vector3 forward = ((Component)_targetPlayer).transform.forward; int mask = LayerMask.GetMask(new string[5] { "Default", "Terrain", "Room", "InteractableObject", "Colliders" }); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < 15; i++) { float num = Random.Range(0f, 360f); float num2 = Random.Range(7f, 15f); Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward; Vector3 val2 = position + val * num2; Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val2, RoundManager.Instance.navHit, 5f, -1); if (navMeshPosition == Vector3.zero) { continue; } Vector3 val3 = navMeshPosition - position; Vector3 normalized = ((Vector3)(ref val3)).normalized; float num3 = Vector3.Dot(forward, normalized); if (num3 > -0.5f) { continue; } try { if (Physics.Raycast(position + Vector3.up * 1.5f, normalized, ref val4, num2, mask) && ((RaycastHit)(ref val4)).distance < num2 * 0.7f) { return navMeshPosition; } } catch { } try { if (Physics.CheckSphere(navMeshPosition, 1.5f, mask)) { continue; } } catch { } return navMeshPosition; } return Vector3.zero; } private bool PlayerIsLooking() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) if ((Object)(object)_targetPlayer == (Object)null) { return false; } Camera gameplayCamera = _targetPlayer.gameplayCamera; if ((Object)(object)gameplayCamera == (Object)null) { return false; } Vector3 val = ((Component)this).transform.position - ((Component)gameplayCamera).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Vector3.Dot(((Component)gameplayCamera).transform.forward, normalized); if (num < 0.6f) { return false; } try { RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)gameplayCamera).transform.position, normalized, ref val2, 50f)) { return (Object)(object)((RaycastHit)(ref val2)).collider != (Object)null && ((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)this).transform); } } catch { } return false; } private void UpdateVisibility() { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if (_myRenderers == null) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return; } bool flag = (Object)(object)val == (Object)(object)_targetPlayer; if (!flag && (Object)(object)_targetPlayer != (Object)null && val.isPlayerDead && (Object)(object)StartOfRound.Instance != (Object)null) { PlayerControllerB spectatedPlayerScript = val.spectatedPlayerScript; if ((Object)(object)spectatedPlayerScript != (Object)null && ((NetworkBehaviour)spectatedPlayerScript).NetworkObjectId == ((NetworkBehaviour)_targetPlayer).NetworkObjectId) { flag = true; } } bool enabled = flag && _currentVisible; if (flag && (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 2)) { enabled = true; } MeshRenderer[] myRenderers = _myRenderers; foreach (MeshRenderer val2 in myRenderers) { ((Renderer)val2).enabled = enabled; } if ((Object)(object)_smokeParticles != (Object)null) { EmissionModule emission = _smokeParticles.emission; ((EmissionModule)(ref emission)).enabled = enabled; } } private void SetVisible(bool visible) { _currentVisible = visible; } public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0) { //IL_0002: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) ((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID); if ((Object)(object)_targetPlayer == (Object)null) { return; } float num = Vector3.Distance(noisePosition, ((Component)_targetPlayer).transform.position); if (!(num < 30f)) { return; } _lastNoisePos = noisePosition; _noiseAge = 0f; ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora detected noise at {noisePosition} (loudness: {noiseLoudness:F2}), age reset"); } if (base.currentBehaviourStateIndex == 0 && noiseLoudness > 0.5f) { ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)$"Zmora heard loud noise ({noiseLoudness:F2}) in ROAM, switching to HUNT"); } base.currentBehaviourStateIndex = 1; _huntTimer = 0f; _hasSeenPlayer = false; } } private void TryTeleportToNoise() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009a: 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_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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_0103: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0161: Unknown result type (might be due to invalid IL or missing references) if (_teleportCooldown > 0f) { _teleportCooldown -= base.AIIntervalTime; } else { if (_noiseAge >= 5f || _lastNoisePos == Vector3.zero || (Object)(object)_targetPlayer == (Object)null) { return; } Vector3 val = ((Component)this).transform.position + Vector3.up * 1.5f; Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1.5f; Vector3 val3 = val2 - val; Vector3 normalized = ((Vector3)(ref val3)).normalized; float num = Vector3.Distance(val, val2); int mask = LayerMask.GetMask(new string[5] { "Default", "Terrain", "Room", "InteractableObject", "Colliders" }); RaycastHit val4 = default(RaycastHit); if (!Physics.Raycast(val, normalized, ref val4, num, mask)) { return; } Vector3 val5 = FindTeleportPositionNearNoise(); if (val5 != Vector3.zero) { _teleportCooldown = 3f; TeleportTo(val5); ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora teleported to {val5} near noise at {_lastNoisePos}"); } } } } private Vector3 FindTeleportPositionNearNoise() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00df: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01ad: 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_01c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RoundManager.Instance == (Object)null) { return Vector3.zero; } Vector3 lastNoisePos = _lastNoisePos; Vector3 position = ((Component)_targetPlayer).transform.position; RaycastHit val6 = default(RaycastHit); for (int i = 0; i < 10; i++) { float num = Random.Range(0f, 360f); float num2 = Random.Range(5f, 15f); Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward; Vector3 val2 = lastNoisePos + val * num2; float num3 = Vector3.Distance(val2, position); if (num3 < 5f) { continue; } Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val2, RoundManager.Instance.navHit, 5f, -1); if (navMeshPosition == Vector3.zero) { continue; } Vector3 val3 = navMeshPosition + _capsuleCollider.center - Vector3.up * (_capsuleCollider.height * 0.5f - _capsuleCollider.radius); Vector3 val4 = navMeshPosition + _capsuleCollider.center + Vector3.up * (_capsuleCollider.height * 0.5f - _capsuleCollider.radius); if (!Physics.CheckCapsule(val3, val4, _capsuleCollider.radius, _wallLayerMask)) { Vector3 val5 = lastNoisePos - navMeshPosition; Vector3 normalized = ((Vector3)(ref val5)).normalized; float num4 = Vector3.Distance(navMeshPosition, lastNoisePos); if (!Physics.CapsuleCast(val3, val4, _capsuleCollider.radius, normalized, ref val6, num4, _wallLayerMask)) { return navMeshPosition; } } } return Vector3.zero; } private void TeleportTo(Vector3 position) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rigidbody != (Object)null) { _rigidbody.MovePosition(position); } else { ((Component)this).transform.position = position; } _moveVelocity = Vector3.zero; _manualMoveTarget = null; } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); base.enemyHP -= force; if (base.enemyHP <= 0) { ((EnemyAI)this).KillEnemy(true); } } public override void OnCollideWithPlayer(Collider other) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); if (base.currentBehaviourStateIndex == 2 && !((Object)(object)_targetPlayer == (Object)null)) { PlayerControllerB component = ((Component)other).GetComponent(); if ((Object)(object)component == (Object)(object)_targetPlayer && !_hasAttacked) { _hasAttacked = true; _targetPlayer.DamagePlayer(2, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); ((MonoBehaviour)this).Invoke("ResetAttack", 1f); } } } internal string GetBehaviourStateLabel() { int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if (1 == 0) { } string result = currentBehaviourStateIndex switch { 0 => "Roam", 1 => "Hunt", 2 => "Attack", _ => "Unknown", }; if (1 == 0) { } return result; } public override void KillEnemy(bool destroy = false) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)$"Zmora KillEnemy destroy={destroy} pos={((Component)this).transform.position}"); } if (destroy && (Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.IsSpawned) { ((NetworkBehaviour)this).NetworkObject.Despawn(false); } ((EnemyAI)this).KillEnemy(false); } public override void OnDestroy() { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)"Zmora OnDestroy"); } ((EnemyAI)this).OnDestroy(); } } internal static class ZmoraSpawnContext { internal static EnemyType? NextEnemyType; internal static ulong NextTargetId = ulong.MaxValue; internal static void Consume(ZmoraAI ai) { if ((Object)(object)NextEnemyType != (Object)null) { ((EnemyAI)ai).enemyType = NextEnemyType; } if (NextTargetId != ulong.MaxValue) { ai.pendingTargetPlayerId = NextTargetId; } NextEnemyType = null; NextTargetId = ulong.MaxValue; } } [HarmonyPatch(typeof(EnemyAI), "EnableEnemyMesh")] [HarmonyPriority(800)] [HarmonyBefore(new string[] { "butterystancakes.lethalcompany.maskfixes" })] internal static class EnemyAIEnableEnemyMeshPatch { [HarmonyPrefix] private static bool Prefix(EnemyAI __instance) { if (!(__instance is ZmoraAI)) { return true; } if (__instance.meshRenderers == null || __instance.meshRenderers.Length == 0) { __instance.meshRenderers = ((Component)__instance).GetComponentsInChildren(true); } if (__instance.skinnedMeshRenderers == null || __instance.skinnedMeshRenderers.Length == 0) { __instance.skinnedMeshRenderers = ((Component)__instance).GetComponentsInChildren(true); } if ((Object)(object)__instance.creatureSFX == (Object)null) { __instance.creatureSFX = ((Component)__instance).GetComponent(); } if ((Object)(object)__instance.creatureAnimator == (Object)null) { __instance.creatureAnimator = ((Component)__instance).GetComponentInChildren(true); } return false; } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception) { if (__exception is NullReferenceException) { return null; } return __exception; } } [HarmonyPatch(typeof(EnemyAI), "DoAIInterval")] internal static class EnemyAIDoAIIntervalPatch { [HarmonyPrefix] private static bool Prefix(EnemyAI __instance) { return !(__instance is ZmoraAI); } } [HarmonyPatch(typeof(EnemyAI), "Update")] internal static class EnemyAIUpdatePatch { [HarmonyPrefix] private static bool Prefix(EnemyAI __instance) { return !(__instance is ZmoraAI); } } [HarmonyPatch(typeof(RoundManager), "SpawnEnemyGameObject", new Type[] { typeof(Vector3), typeof(float), typeof(int), typeof(EnemyType) })] internal static class RoundManagerSpawnPatch { [HarmonyPostfix] private static void AfterSpawn(EnemyType enemyType, NetworkObjectReference __result) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemyType == (Object)null || enemyType.enemyName != "Zmora") { return; } NetworkObjectReference val = __result; NetworkObject val2 = default(NetworkObject); if (!((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { return; } ZmoraAI zmoraAI = ((Component)val2).GetComponent() ?? ((Component)val2).GetComponentInChildren(); if ((Object)(object)zmoraAI == (Object)null) { ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogError((object)"Zmora spawned without ZmoraAI component"); } return; } ManualLogSource? log2 = TemerskieMod._log; if (log2 != null) { log2.LogInfo((object)$"Zmora AfterSpawn - netObj activeInHierarchy: {((Component)val2).gameObject.activeInHierarchy}, activeSelf: {((Component)val2).gameObject.activeSelf}, NetworkObject.IsSpawned: {val2.IsSpawned}"); } if (!((Component)val2).gameObject.activeInHierarchy) { ManualLogSource? log3 = TemerskieMod._log; if (log3 != null) { log3.LogWarning((object)"Zmora spawned inactive - activating!"); } ((Component)val2).gameObject.SetActive(true); } zmoraAI.ConfigureAfterSpawn(enemyType); zmoraAI.ApplyPendingTarget(); ManualLogSource? log4 = TemerskieMod._log; if (log4 != null) { log4.LogInfo((object)$"Zmora configured at {((Component)zmoraAI).transform.position}"); } } } internal class ZmoraDirectionUI : MonoBehaviour { private RectTransform? _arrow; private Image? _arrowImage; private Canvas? _canvas; private float _logTimer; private const float LogInterval = 2f; private void Awake() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); BuildUI(); } private void BuildUI() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00db: 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_0138: Unknown result type (might be due to invalid IL or missing references) _canvas = ((Component)this).gameObject.AddComponent(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 200; CanvasScaler val = ((Component)this).gameObject.AddComponent(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1080f); GameObject val2 = new GameObject("ZmoraArrow"); val2.transform.SetParent(((Component)this).transform, false); _arrow = val2.AddComponent(); _arrow.anchorMin = new Vector2(0.5f, 0.5f); _arrow.anchorMax = new Vector2(0.5f, 0.5f); _arrow.pivot = new Vector2(0.5f, 0.5f); _arrow.anchoredPosition = Vector2.zero; _arrow.sizeDelta = new Vector2(48f, 48f); _arrowImage = val2.AddComponent(); _arrowImage.sprite = CreateArrowSprite(); ((Graphic)_arrowImage).color = new Color(0.85f, 0.12f, 0.12f, 0.9f); ((Graphic)_arrowImage).raycastTarget = false; ((Component)_arrow).gameObject.SetActive(false); } private static Sprite CreateArrowSprite() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_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) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < array.Length; i++) { array[i] = Color.clear; } int num = 32; for (int j = 8; j < 60; j++) { float num2 = ((float)j - 8f) / 52f; int num3 = Mathf.RoundToInt(Mathf.Lerp(2f, 14f, 1f - num2)); for (int k = num - num3; k <= num + num3; k++) { array[j * 64 + k] = Color.white; } } val.SetPixels(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); } private void Update() { //IL_019c: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_00fb: 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) if ((Object)(object)_arrow == (Object)null || (Object)(object)_arrowImage == (Object)null) { return; } PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null || val.isPlayerDead) { ((Component)_arrow).gameObject.SetActive(false); _logTimer = 0f; return; } ZmoraAI zmoraAI = null; float num = float.MaxValue; ulong networkObjectId = ((NetworkBehaviour)val).NetworkObjectId; ZmoraAI[] array = Object.FindObjectsOfType(); foreach (ZmoraAI zmoraAI2 in array) { if (!((Object)(object)zmoraAI2 == (Object)null) && !((EnemyAI)zmoraAI2).isEnemyDead && !((Object)(object)((NetworkBehaviour)zmoraAI2).NetworkObject == (Object)null) && ((NetworkBehaviour)zmoraAI2).NetworkObject.IsSpawned && zmoraAI2.IsTargetingPlayer(networkObjectId)) { float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)zmoraAI2).transform.position); if (num2 < num) { num = num2; zmoraAI = zmoraAI2; } } } if ((Object)(object)zmoraAI == (Object)null) { ((Component)_arrow).gameObject.SetActive(false); _logTimer = 0f; return; } Camera gameplayCamera = val.gameplayCamera; if ((Object)(object)gameplayCamera == (Object)null) { ((Component)_arrow).gameObject.SetActive(false); return; } Vector3 val2 = ((Component)zmoraAI).transform.position - ((Component)gameplayCamera).transform.position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { ((Component)_arrow).gameObject.SetActive(false); return; } Vector3 forward = ((Component)gameplayCamera).transform.forward; forward.y = 0f; float num3 = Vector3.SignedAngle(forward, val2, Vector3.up); ((Transform)_arrow).localRotation = Quaternion.Euler(0f, 0f, 0f - num3); float num4 = Mathf.Clamp01(0.55f + Mathf.InverseLerp(40f, 8f, num) * 0.45f); ((Graphic)_arrowImage).color = new Color(0.85f, 0.12f, 0.12f, num4); ((Component)_arrow).gameObject.SetActive(true); _logTimer -= Time.deltaTime; if (_logTimer <= 0f) { _logTimer = 2f; LogZmoraPosition(zmoraAI, val, num, num3); } } private static void LogZmoraPosition(ZmoraAI zmora, PlayerControllerB player, float distance, float bearing) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)zmora).transform.position; string behaviourStateLabel = zmora.GetBehaviourStateLabel(); string text = $"[Zmora] ({position.x:F1}, {position.y:F1}, {position.z:F1}) dist={distance:F1}m bearing={bearing:F0}° state={behaviourStateLabel}"; ManualLogSource? log = TemerskieMod._log; if (log != null) { log.LogInfo((object)text); } if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.AddTextToChatOnServer(text, (int)player.playerClientId); } } } }