using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using HerobrineMod.NetcodePatcher; using Kittenji.HerobrineMod.Networking; using Kittenji.HerobrineMod.Skins; using Kittenji.HerobrineMod.Skins.Models; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Steamworks; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("Kittenji")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f175dd27623173ccdd4797b6f4335bfe90fe9976")] [assembly: AssemblyProduct("HerobrineMod")] [assembly: AssemblyTitle("HerobrineMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 Kittenji { internal static class KExtensions { internal static Transform GetExitPoint(this EntranceTeleport entranceTeleport) { if (!Object.op_Implicit((Object)(object)entranceTeleport) || !Object.op_Implicit((Object)(object)entranceTeleport.exitScript)) { return null; } return entranceTeleport.exitScript.entrancePoint; } } internal static class KUtility { internal static T InstantiateComponent(string name, bool ddol = true) where T : Component { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(name); if (ddol) { Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; } return val.AddComponent(); } internal static bool GetKey(Key key) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return ((ButtonControl)Keyboard.current[key]).isPressed; } internal static bool GetKeyDown(Key key) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return ((ButtonControl)Keyboard.current[key]).wasPressedThisFrame; } internal static bool GetKeyUp(Key key) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return ((ButtonControl)Keyboard.current[key]).wasReleasedThisFrame; } internal static IEnumerable GetAssemblyTypes() { try { return Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } } [Conditional("DEBUG")] internal static void GenerateConfigTable(ConfigFile Config) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("
Available Config Variables"); stringBuilder.AppendLine(); stringBuilder.AppendLine("| Settings | Value Type | Default Value | Description | Acceptable Values |"); stringBuilder.AppendLine("|-|-|-|-|-|"); foreach (IGrouping> item in from v in (IEnumerable>)Config group v by v.Key.Section) { stringBuilder.AppendLine("| **" + item.Key + "** | - | - | - | - |"); foreach (KeyValuePair item2 in item) { ConfigDefinition key = item2.Key; ConfigEntryBase value = item2.Value; stringBuilder.Append("| `"); stringBuilder.Append(key.Key); stringBuilder.Append("` | `"); stringBuilder.Append(value.SettingType.IsEnum ? "Enum" : value.SettingType.Name); stringBuilder.Append("` | "); string value2 = value.DefaultValue.ToString(); if (string.IsNullOrEmpty(value2)) { stringBuilder.Append('-'); } else { stringBuilder.Append('`'); stringBuilder.Append(value2); stringBuilder.Append('`'); } stringBuilder.Append(" | "); stringBuilder.Append(Regex.Replace(value.Description.Description, "\\r\\n?|\\n", "
")); stringBuilder.Append(" |"); if (value.SettingType.IsEnum) { string[] names = Enum.GetNames(value.SettingType); foreach (string text in names) { stringBuilder.Append(" `" + text + "`"); } } else if (value.Description.AcceptableValues != null) { if (value.Description.AcceptableValues is AcceptableValueList val) { string[] names = val.AcceptableValues; foreach (string text2 in names) { stringBuilder.Append(" `" + text2 + "`"); } } } else { stringBuilder.Append(" -"); } stringBuilder.AppendLine(" |"); } } stringBuilder.AppendLine(); stringBuilder.AppendLine("
"); File.WriteAllText(Config.ConfigFilePath.TrimEnd('\\', '/') + ".md", stringBuilder.ToString()); } } internal static class NavMeshUtils { private const string ColorProperty = "_Color"; public static void Update(int index, NavMeshPath navMeshPath) { } } internal class CompatibleDependencyAttribute : BepInDependency { public Type Handler; public CompatibleDependencyAttribute(string guid, Type handlerType) : base(guid, (DependencyFlags)2) { Handler = handlerType; } public static void Init(BaseUnityPlugin source) { foreach (CompatibleDependencyAttribute customAttribute in ((MemberInfo)((object)source).GetType()).GetCustomAttributes()) { if (Chainloader.PluginInfos.ContainsKey(((BepInDependency)customAttribute).DependencyGUID)) { customAttribute.Handler.GetMethod("Initialize", BindingFlags.Static | BindingFlags.NonPublic)?.Invoke(null, null); customAttribute.Handler = null; } } } } internal static class LethalConfigUtils { internal const string GUID = "ainavt.lc.lethalconfig"; internal static bool Enabled; private static void Initialize() { Enabled = true; Debug.Log((object)"Compatibility initialized for Lethal Config."); } public static ConfigEntry Register(this ConfigEntry entry, int min, int max, bool requireRestart = false) { AddSlider(entry, min, max, requireRestart); return entry; } public static ConfigEntry Register(this ConfigEntry entry, bool requireRestart = false) { AddInt(entry, requireRestart); return entry; } public static ConfigEntry Register(this ConfigEntry entry, bool requireRestart = false) { AddToggle(entry, requireRestart); return entry; } public static ConfigEntry Register(this ConfigEntry entry, bool requireRestart = false) { AddTextInput(entry, requireRestart); return entry; } public static void AddSlider(ConfigEntry entry, int min, int max, bool requireRestart = false) { if (Enabled) { AddSliderInternal(entry, min, max, requireRestart); } } public static void AddInt(ConfigEntry entry, bool requireRestart = false) { if (Enabled) { AddIntInternal(entry, requireRestart); } } public static void AddToggle(ConfigEntry entry, bool requireRestart = false) { if (Enabled) { AddToggleInternal(entry, requireRestart); } } public static void AddTextInput(ConfigEntry entry, bool requireRestart = false) { if (Enabled) { AddTextInputInternal(entry, requireRestart); } } public static void AddButton(Action buttonAction, string section, string name, string description, string buttonText) { if (Enabled) { AddButtonInternal(buttonAction, section, name, description, buttonText); } } private static void AddSliderInternal(ConfigEntry entry, int min, int max, bool requireRestart = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0020: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown IntSliderOptions val = new IntSliderOptions { RequiresRestart = requireRestart }; ((BaseRangeOptions)val).Min = min; ((BaseRangeOptions)val).Max = max; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry, val)); } private static void AddIntInternal(ConfigEntry entry, bool requireRestart = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(entry, requireRestart)); } private static void AddToggleInternal(ConfigEntry entry, bool requireRestart = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(entry, requireRestart)); } private static void AddTextInputInternal(ConfigEntry entry, bool requireRestart = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(entry, requireRestart)); } private static void AddButtonInternal(Action buttonAction, string section, string name, string description, string buttonText) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate { buttonAction?.Invoke(); })); } } internal static class NetcodeUtils { private static class Patch { internal static bool IsPatched; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] [HarmonyWrapSafe] private static void StartPatch() { foreach (GameObject prefab in m_Prefabs) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(prefab)) { NetworkManager.Singleton.AddNetworkPrefab(prefab); } } } } private static HashSet m_Prefabs = new HashSet(); internal static void InitNetcode(Harmony harmony) { foreach (Type assemblyType in KUtility.GetAssemblyTypes()) { MethodInfo[] methods = assemblyType.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { try { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } catch (FileNotFoundException) { } } } if (!Patch.IsPatched && harmony != null) { harmony.PatchAll(typeof(Patch)); Patch.IsPatched = true; } } internal static void RegisterNetworkPrefab(GameObject prefab) { if (!m_Prefabs.Contains(prefab)) { m_Prefabs.Add(prefab); } } internal static void RegisterNetworkPrefab(this EnemyType enemyType) { RegisterNetworkPrefab(enemyType.enemyPrefab); } internal static void RegisterNetworkPrefab(this Item item) { RegisterNetworkPrefab(item.spawnPrefab); } } internal static class ResourceUtils { internal static Stream Get(string name) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); if (manifestResourceNames.Length == 0) { throw new FileNotFoundException("Assembly does not contain any resource stream names."); } string text = manifestResourceNames.FirstOrDefault((string n) => n.EndsWith(name)); if (string.IsNullOrEmpty(text)) { throw new FileNotFoundException("Assembly does not contain a resource stream ending with '" + name + "'"); } return executingAssembly.GetManifestResourceStream(text); } internal static string GetString(string name) { using Stream stream = Get(name); using StreamReader streamReader = new StreamReader(stream); return streamReader.ReadToEnd(); } } internal class Assets { private readonly AssetBundle mainAssetBundle; private readonly string[] allAssetNames; internal Assets(string name = ".bundle") { mainAssetBundle = AssetBundle.LoadFromStream(ResourceUtils.Get(name)); allAssetNames = mainAssetBundle.GetAllAssetNames(); } public T Load(string name) where T : Object { if (name == null) { return default(T); } return mainAssetBundle.LoadAsset(name); } public T LoadByName(string name, bool nameOnly = false) where T : Object { string name2 = allAssetNames.FirstOrDefault((string x) => (nameOnly ? Path.GetFileNameWithoutExtension(x) : Path.GetFileName(x)).Equals(name, StringComparison.OrdinalIgnoreCase)); return Load(name2); } } internal class DynamicEnemyWithRarity : SpawnableEnemyWithRarity { public ConfigEntry Multiplier; public ConfigEntry ConfigEntry { get; private set; } public DynamicEnemyWithRarity(EnemyType newEnemy, int newRarity) : base(newEnemy, newRarity) { } public static DynamicEnemyWithRarity From(ConfigEntry config, EnemyType enemyDef, ConfigEntry mult = null) { DynamicEnemyWithRarity dynamicEnemyWithRarity = new DynamicEnemyWithRarity(enemyDef, 0) { enemyType = enemyDef, ConfigEntry = config, Multiplier = mult }; dynamicEnemyWithRarity.OnChanged(null, null); config.SettingChanged += dynamicEnemyWithRarity.OnChanged; if (mult != null) { mult.SettingChanged += dynamicEnemyWithRarity.OnChanged; } return dynamicEnemyWithRarity; } private void OnChanged(object sender, EventArgs args) { base.rarity = Mathf.Max(0, ConfigEntry.Value); if (Multiplier != null) { base.rarity *= Multiplier.Value; } } } internal static class Log { internal static ManualLogSource Source { get; set; } internal static void Print(LogLevel level, object message) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected I4, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 if (Source == null) { if ((int)level <= 16) { switch ((int)level) { default: if ((int)level != 16) { break; } Debug.Log(message); return; case 1: Debug.LogError(message); return; case 2: Debug.LogError(message); return; case 4: Debug.LogWarning(message); return; case 8: Debug.Log(message); return; case 3: case 5: case 6: case 7: break; case 0: return; } } else { if ((int)level == 32) { Debug.Log(message); return; } if ((int)level == 63) { Debug.Log(message); return; } } Debug.Log(message); } else { Source.Log(level, message); } } public static void Fatal(object data) { Print((LogLevel)1, data); } public static void Error(object data) { Print((LogLevel)2, data); } public static void Warning(object data) { Print((LogLevel)4, data); } public static void Message(object data) { Print((LogLevel)8, data); } public static void Info(object data) { Print((LogLevel)16, data); } [Conditional("DEBUG")] public static void Debug(object data) { Print((LogLevel)32, data); } } } namespace Kittenji.HerobrineMod { public class FortressLock : MonoBehaviour { public Transform stareLocation; public GameObject leavingEffect; public Transform spawnPoint; public Transform warpTarget; public Transform warpLimit; public Transform trackedObject; public Transform trackedHead; private Transform lockedTransform; private PlayerControllerB lockedPlayer; private Vector3 originLocation; private bool originInside; private float startTimestamp; private GameObject stareObject; private bool hasBeenLocked; public static FortressLock Instance { get; private set; } private void Awake() { stareObject = ((Component)stareLocation).gameObject; } public static bool LockPlayer(PlayerControllerB player) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { GameObject obj = Object.Instantiate(Plugin.FortressPrefab); obj.transform.position = new Vector3(500f, -500f, 100f); Instance = obj.GetComponent(); } if (Instance.hasBeenLocked) { return false; } Instance.SetLockedPlayer(player); return true; } private void OnDestroy() { ReleaseLockedPlayer(returnPlayer: false); } private void SetLockedPlayer(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_007c: 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) if ((Object)(object)player == (Object)null || player.isPlayerDead) { ReleaseLockedPlayer(returnPlayer: false); return; } player.DropAllHeldItemsAndSyncNonexact(); hasBeenLocked = true; ((Component)Instance).gameObject.SetActive(hasBeenLocked); lockedPlayer = player; lockedTransform = ((Component)lockedPlayer).transform; originLocation = lockedTransform.position; originInside = lockedPlayer.isInsideFactory; HerobrineAI.TryRelocatePlayer(player, spawnPoint.position, isInside: true); player.TeleportPlayer(spawnPoint.position, true, spawnPoint.eulerAngles.y, false, true); startTimestamp = Time.time + 3f; HideMonster(value: false); } private void ReleaseLockedPlayer(bool returnPlayer) { //IL_0047: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lockedPlayer != (Object)null) { if (returnPlayer) { lockedPlayer.takingFallDamage = false; lockedPlayer.fallValue = 0f; lockedPlayer.fallValueUncapped = 0f; HerobrineAI.TryRelocatePlayer(lockedPlayer, originLocation, originInside); lockedPlayer.TeleportPlayer(originLocation, true, Random.Range(-180f, 180f), false, true); Object.Instantiate(leavingEffect, originLocation, Quaternion.identity); } lockedPlayer = null; lockedTransform = null; } ((Component)Instance).gameObject.SetActive(false); } public void Update() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00aa: 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_0169: 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_0187: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)lockedTransform == (Object)null || (Object)(object)lockedPlayer == (Object)null || lockedPlayer.isInHangarShipRoom) { ((Component)Instance).gameObject.SetActive(false); } else { if (lockedPlayer.isPlayerDead) { return; } Vector3 position = lockedTransform.position; if (stareObject.activeSelf && Vector3.Distance(position, stareLocation.position) < 2f) { if (Time.time < startTimestamp) { lockedPlayer.KillPlayer(Vector3.up * 100f, true, (CauseOfDeath)0, Mathf.Max(Plugin.RagdollIndex, 0), default(Vector3), false); } HideMonster(value: true); } if (position.z > warpLimit.position.z && stareObject.activeSelf) { Vector3 velocity = lockedPlayer.playerRigidbody.velocity; float num = lockedTransform.eulerAngles.y; bool num2 = Vector3.Dot(Vector3.forward, lockedTransform.forward) < 0f; if (num2) { num += 180f; position.x += (warpLimit.position.x - position.x) * 2f; } position.z -= warpLimit.position.z - warpTarget.position.z; WarpTo(position, num); if (num2) { lockedPlayer.playerRigidbody.velocity = new Vector3(0f - velocity.x, velocity.y, 0f - velocity.z); } } if (position.y < warpLimit.position.y) { ReleaseLockedPlayer(returnPlayer: true); return; } trackedObject.position = position; trackedHead.position = ((Component)lockedPlayer.gameplayCamera).transform.position; } } private void HideMonster(bool value) { stareObject.SetActive(!value); leavingEffect.SetActive(value); } private void WarpTo(Vector3 pos, float yRot) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0031: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_005f: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)lockedPlayer).transform; Transform localVisor = lockedPlayer.localVisor; Vector3 val = transform.InverseTransformPoint(localVisor.position); Vector3 val2 = transform.InverseTransformVector(localVisor.forward); transform.position = pos; transform.rotation = Quaternion.Euler(0f, yRot, 0f); localVisor.position = transform.TransformPoint(val); localVisor.forward = transform.TransformVector(val2); } } public class ParticleCallback : MonoBehaviour { public interface ICallbackReceiver { void OnPartTrigger(); } private ICallbackReceiver Receiver; private void Awake() { Receiver = ((Component)this).gameObject.GetComponentInParent(); } private void OnParticleTrigger() { Receiver.OnPartTrigger(); } } public class HerobrineMinion : MonoBehaviour, ParticleCallback.ICallbackReceiver { public static HerobrineMinion Instance; public NavMeshAgent Agent; public Transform Trigger; public PlayerControllerB Target; [Header("Fire Audio")] public AudioSource FireAudio; public AudioClip FireClip; public Vector2 MinMaxPitch = new Vector2(0.9f, 1.2f); public Vector2 MinMaxTimer = new Vector2(0.3f, 1.5f); private float FireTimer; [Header("Other Audio")] public AudioSource HurtAudio; public AudioClip[] HurtClips; public ParticleSystem Particles; public float HurtInterval; private float HurtTimer; public Vector2 ChaseTimer = new Vector2(4f, 8f); public float Interval = 0.2f; private float Timer; private float Timeout; private bool IsChasing; private bool IsPlayerValid { get { if (Object.op_Implicit((Object)(object)Target) && Target.isPlayerControlled) { return !Target.isPlayerDead; } return false; } } public static bool Instantiate(Vector3 position, PlayerControllerB target) { //IL_0043: 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) if (!Object.op_Implicit((Object)(object)Instance)) { Instance = Object.Instantiate(Plugin.assets.LoadByName("FireAgent.prefab", nameOnly: false)).GetComponent(); } if (Instance.IsChasing) { return false; } ((Component)Instance).transform.position = position; Instance.Warp(position); Instance.Target = target; return true; } public static void OnDestroy() { if (Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)((Component)Instance).gameObject); Instance = null; } } private void Awake() { Instance = this; } public void Warp(Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)Agent).enabled = true; Agent.Warp(position); IsChasing = true; Particles.Play(); Timeout = Time.time + Random.Range(ChaseTimer.x, ChaseTimer.y); } private void Update() { //IL_001c: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) if (IsPlayerValid) { Trigger.position = ((Component)Target).transform.position; Trigger.rotation = ((Component)Target).transform.rotation; if (IsChasing) { if (Timer < Time.time) { Timer = Time.time + Interval; Agent.SetDestination(Trigger.position); } if (FireTimer < Time.time) { FireTimer = Time.time + Random.Range(MinMaxTimer.x, MinMaxTimer.y); FireAudio.pitch = Random.Range(MinMaxPitch.x, MinMaxPitch.y); FireAudio.PlayOneShot(FireClip); } } } if (IsChasing && (Vector3.Distance(Trigger.position, ((Component)this).transform.position) < 0.7f || Timeout < Time.time || !IsPlayerValid)) { IsChasing = false; ((Behaviour)Agent).enabled = false; Particles.Stop(); FireAudio.Stop(); if (Timeout > Time.time && IsPlayerValid) { HurtAudio.PlayOneShot(HurtClips[Random.Range(0, HurtClips.Length)]); Target.DamagePlayer(6, true, true, (CauseOfDeath)0, Mathf.Max(Plugin.RagdollIndex, 0), false, default(Vector3)); } } } public void OnPartTrigger() { //IL_005f: 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 (IsPlayerValid && HurtTimer < Time.time) { HurtTimer = Time.time + HurtInterval; HurtAudio.PlayOneShot(HurtClips[Random.Range(0, HurtClips.Length)]); Target.DamagePlayer(2, true, true, (CauseOfDeath)0, Mathf.Max(Plugin.RagdollIndex, 0), false, default(Vector3)); } } } public class HerobrineAI : EnemyAI { [CompilerGenerated] private sealed class d__58 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HerobrineAI <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__58(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; HerobrineAI herobrineAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!herobrineAI.IsInitialized) { <>2__current = null; <>1__state = 1; return true; } herobrineAI.CheckHauntingLocal(); herobrineAI.waitForInitCr = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__27 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HerobrineAI <>4__this; public float duration; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; HerobrineAI herobrineAI = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (!Object.op_Implicit((Object)(object)herobrineAI.JumpSInstance)) { herobrineAI.JumpSInstance = Object.Instantiate(herobrineAI.JumpSPrefab); herobrineAI.JumpSRenderer = herobrineAI.JumpSInstance.GetComponentInChildren(true); } herobrineAI.JumpSTime = Time.time + duration; ((Renderer)herobrineAI.JumpSRenderer).sharedMaterial = herobrineAI.JumpSMaterials[Random.Range(0, herobrineAI.JumpSMaterials.Length)]; herobrineAI.JumpSInstance.SetActive(true); StateInfo.PlayRandomClipAt(herobrineAI.AudioSFX, herobrineAI.JumpSClips); break; case 1: <>1__state = -1; break; } if (Time.time < herobrineAI.JumpSTime) { herobrineAI.JumpSInstance.transform.position = ((Component)herobrineAI.hauntingPlayer).transform.position + ((Component)herobrineAI.hauntingPlayer).transform.forward; herobrineAI.JumpSInstance.transform.forward = -((Component)herobrineAI.hauntingPlayer).transform.forward * 1.8f; <>2__current = null; <>1__state = 1; return true; } herobrineAI.JumpSInstance.SetActive(false); herobrineAI.JumpSCoroutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static ManualLogSource Logger; public static int LastHauntedID = -1; [Header("Custom Entity")] public Transform[] VisiblePoints; public HerobrineTracker Tracker; public SkinnedMeshRenderer MainRenderer; public Material MainMaterial; public Material SkinMaterial; public Vector4 AgentSpeeds = new Vector4(5.3f, 8f, 4f, 10f); public AudioClip[] HitAudioClips; public string[] SignalMessages = new string[17] { "U ARE DEAD", "I SEE YOU", "NOT SORRY", "GO AHEAD", "TRY N HIDE", "NO ESCAPE?", "NOT SAFE", "WHY RUN?", "DEAD MAN", "JESTER", "NO", "HELPLESS", "HOPELESS", "ENDLESS", "SCARED?", "RUN", "LOOK BHU" }; private SignalTranslator signalTranslator; [Header("Jumpscare Stuff")] public Vector2Int JumpSRarity = new Vector2Int(100, 100); public GameObject JumpSPrefab; public Material[] JumpSMaterials; public Vector2 JumpSDuration = new Vector2(0.2f, 0.4f); public AudioClip[] JumpSClips; private GameObject JumpSInstance; private SkinnedMeshRenderer JumpSRenderer; private Coroutine JumpSCoroutine; private float JumpSTime; [Header("Entity Rig")] public BoxCollider EntityHitbox; public ScanNodeProperties ScanNodeProps; public BoxCollider ScanNodeHitbox; public Vector4 ScanNodeIntervals = new Vector4(0.01f, 0.3f, 0f, 0f); public Transform EntityHead; public Transform EntityBody; public LookAtConstraint EntityLookAt; public Transform TurnCompass; public StateInfo[] StateInfos; [Header("Audio Clips")] public AudioSource AudioSFX; [Header("Dialogs")] public DialogMessages[] Dialogs; private static Dictionary NameToDialog; private bool lastVisibility; private bool isHauntingLocal; private bool isUsingPlayerSkin; private bool isInCompanyBuilding; public GameObject antiCheatObj; private float lastTargetRequestServer; private bool isNextTarget; private int lastTargetIndex = -1; private bool lastTargetWasRequested; private Coroutine waitForInitCr; private int stateActionCounter; private float stateActionTimer; private float stateActionTimeout; private float stateActionBoost; private bool seenByPlayer; private bool stateBusy; private bool stareFailed; private int totalTimesSeen; private float stateStartTime; private StateInfo currentStateInfo; private const float playerFOV = 60f; private bool effectNextFrame; private bool insideLastFrame; private float currentAgentSpeed; private NavMeshPath navMeshPath; private Texture2D lastSkinTex; private bool lastSkinSlim; public PlayerControllerB hauntingPlayer; private MinecraftPlayerNetworking minecraftPlayer; private bool hauntingLocalPlayer; private GameObject[] outsideNodes; private NavMeshHit navHit; private bool IsInitialized; private EntranceTeleport[] entranceList; private Transform currentExit; private NavMeshPath entrancePath; private float currentDist; private float traversedDist; private bool findingExit; private Vector3 currentPoint; private bool isNavStuck; private float navTimeout; private bool playerReceivedDamage; public string[] excludeTpEnemies; private static EntranceTeleport EntranceTP_Outside; private static EntranceTeleport EntranceTP_Inside; private static readonly int[] TPWeights = new int[5] { 96, 80, 20, 20, 20 }; private static Dictionary FriendWeights; private bool hasSignalTranslator => (Object)(object)signalTranslator != (Object)null; public PlayerControllerB PlayerSpawnedBy { get; set; } private float stateTime => Time.time - stateStartTime; private void JumpSAwake() { if (JumpSCoroutine == null) { JumpSCoroutine = ((MonoBehaviour)this).StartCoroutine(JumpSAction(Random.Range(JumpSDuration.x, JumpSDuration.y))); } } [IteratorStateMachine(typeof(d__27))] private IEnumerator JumpSAction(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__27(0) { <>4__this = this, duration = duration }; } private void SendDialog(string name, string tag = null) { if (NameToDialog == null) { NameToDialog = new Dictionary(); DialogMessages[] dialogs = Dialogs; foreach (DialogMessages dialogMessages in dialogs) { NameToDialog[((Object)dialogMessages).name] = dialogMessages; } } SendChatMessage(NameToDialog[name].GetRandom(tag)); } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); HerobrineMinion.OnDestroy(); if (Object.op_Implicit((Object)(object)antiCheatObj)) { Object.Destroy((Object)(object)antiCheatObj); } } private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_00cd: 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_00f7: Unknown result type (might be due to invalid IL or missing references) if (Logger == null) { Logger = new ManualLogSource("HerobrineAI"); Logger.Sources.Add((ILogSource)(object)Logger); } Logger.LogInfo((object)"Removed Herobrine"); entrancePath = new NavMeshPath(); navMeshPath = new NavMeshPath(); isInCompanyBuilding = Object.op_Implicit((Object)(object)StartOfRound.Instance) && Object.op_Implicit((Object)(object)StartOfRound.Instance.currentLevel) && StartOfRound.Instance.currentLevel.sceneName == "CompanyBuilding"; if (isInCompanyBuilding) { Logger.LogInfo((object)"In company building.."); } RedstoneTorchProp.wasSpawnedThisRound = true; signalTranslator = Object.FindObjectOfType(); antiCheatObj.transform.parent = null; antiCheatObj.transform.position = Vector3.zero; antiCheatObj.transform.rotation = Quaternion.identity; antiCheatObj.transform.localScale = Vector3.one; antiCheatObj.SetActive(false); } private void SpawnEffectByIndex(Vector3 pos, int index, bool sync = false) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)minecraftPlayer)) { minecraftPlayer.SpawnEffectByIndex(pos, index, sync); } } [ServerRpc] private void RequestNewTargetServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c2: 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: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1054030038u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1054030038u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Logger.LogInfo((object)"Herobrine wants a new target to haunt."); SetNewTargetOnServer(requested: true); } } private void SetNewTargetOnServer(bool requested) { if (!((NetworkBehaviour)this).IsServer || Time.unscaledTime < lastTargetRequestServer) { return; } Logger.LogInfo((object)"Requesting new target."); float num = 0f; int num2 = 0; int num3 = 0; int num4 = 0; PlayerStats[] allPlayerStats = StartOfRound.Instance.gameStats.allPlayerStats; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num5 = Mathf.Min(allPlayerStats.Length, allPlayerScripts.Length); for (int i = 0; i < num5; i++) { if (allPlayerStats[i].turnAmount > num2) { num2 = allPlayerStats[i].turnAmount; num3 = i; } if (allPlayerScripts[i].insanityLevel > num) { num = allPlayerScripts[i].insanityLevel; num4 = i; } } int[] array = new int[num5]; for (int i = 0; i < num5; i++) { PlayerControllerB val = allPlayerScripts[i]; if (!val.isPlayerControlled || val.isPlayerDead) { array[i] = 0; continue; } if (Object.op_Implicit((Object)(object)PlayerSpawnedBy) && PlayerSpawnedBy.isPlayerControlled && !PlayerSpawnedBy.isPlayerDead) { array[i] = (((Object)(object)PlayerSpawnedBy == (Object)(object)val) ? 100 : 0); continue; } array[i] += 100; if (num4 == i && num > 1f) { array[i] += 15; } if (num3 == i) { array[i] += 10; } if (val.hasBeenCriticallyInjured) { array[i] += 10; } if ((Object)(object)val.currentlyHeldObjectServer != (Object)null && val.currentlyHeldObjectServer.scrapValue > 150) { array[i] += 24; } if ((Object)(object)val.currentlyHeldObjectServer != (Object)null && (Object)(object)val.currentlyHeldObjectServer.itemProperties == (Object)(object)Plugin.ItemDef) { array[i] += 250; } if (!val.isInHangarShipRoom) { array[i] += 20; } if (val.isInsideFactory) { array[i] += 30; } if (!requested && LastHauntedID == (int)val.playerClientId) { array[i] = 1; } if (requested && lastTargetIndex == i) { array[i] = 1; } int friendWeights = GetFriendWeights(val.playerSteamId); if (friendWeights != 0) { Logger.LogMessage((object)$"Adding weight of '{friendWeights}' to friend '{val.playerUsername}'"); array[i] += friendWeights; } array[i] = Mathf.Max(0, array[i]); } int num6 = GetRandomIndexFromWeights(array); hauntingPlayer = allPlayerScripts[num6]; if (hauntingPlayer.isPlayerDead) { for (int j = 0; j < allPlayerScripts.Length; j++) { if (!allPlayerScripts[j].isPlayerDead) { hauntingPlayer = allPlayerScripts[j]; num6 = j; break; } } } if (hauntingPlayer.isPlayerControlled) { lastTargetIndex = num6; SyncNewTargetClientRpc((int)hauntingPlayer.playerClientId, requested); if (!isNextTarget) { LastHauntedID = num6; isNextTarget = true; } } else { Logger.LogWarning((object)"Could not find a target player."); } lastTargetRequestServer = Time.unscaledTime + 10f; } [ClientRpc] internal void SyncNewTargetClientRpc(int id, bool isReq) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1096127661u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isReq, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1096127661u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; lastTargetWasRequested = isReq; Logger.LogInfo((object)("Received target from server: " + id)); hauntingPlayer = StartOfRound.Instance.allPlayerScripts[id]; minecraftPlayer = ((Component)hauntingPlayer).GetComponent(); ((EnemyAI)this).ChangeOwnershipOfEnemy(hauntingPlayer.actualClientId); if (!IsInitialized && waitForInitCr != null) { Logger.LogInfo((object)"Not initialized"); waitForInitCr = ((MonoBehaviour)this).StartCoroutine(CheckAfterInit()); } else { CheckHauntingLocal(); } } } private void SendRandomSignal(int chance = 20) { if (hasSignalTranslator && Random.Range(0, 100) <= chance) { string text = SignalMessages[Random.Range(0, SignalMessages.Length)]; Logger.LogInfo((object)("Sending random signal: " + text)); signalTranslator.timeLastUsingSignalTranslator = Time.realtimeSinceStartup; if (signalTranslator.signalTranslatorCoroutine != null) { ((MonoBehaviour)HUDManager.Instance).StopCoroutine(signalTranslator.signalTranslatorCoroutine); } string text2 = text.Substring(0, Mathf.Min(text.Length, 10)); signalTranslator.signalTranslatorCoroutine = ((MonoBehaviour)HUDManager.Instance).StartCoroutine(HUDManager.Instance.DisplaySignalTranslatorMessage(text2, -signalTranslator.timesSendingMessage, signalTranslator)); } } [IteratorStateMachine(typeof(d__58))] private IEnumerator CheckAfterInit() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__58(0) { <>4__this = this }; } private void CheckHauntingLocal() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) hauntingLocalPlayer = (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)hauntingPlayer; SetEnemyVisible(enable: false); Tracker.SetEnabled(hauntingLocalPlayer); ((Behaviour)EntityLookAt).enabled = hauntingLocalPlayer; ((EnemyAI)this).SetClientCalculatingAI(hauntingLocalPlayer); if (!Object.op_Implicit((Object)(object)hauntingPlayer)) { return; } if (hauntingLocalPlayer) { Logger.LogInfo((object)("Haunting local player: " + hauntingPlayer.playerUsername)); ConstraintSource source = EntityLookAt.GetSource(0); ((ConstraintSource)(ref source)).sourceTransform = ((Component)hauntingPlayer.gameplayCamera).transform; EntityLookAt.SetSource(0, source); SwitchState(0); if (lastTargetWasRequested) { Logger.LogInfo((object)"Haunting local was requested!"); stateActionCounter = 0; stateActionTimer = 0f; } SendRandomSignal(); MinecraftPlayerNetworking component = ((Component)hauntingPlayer).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.SyncWithServer(); } } else { Logger.LogInfo((object)("Haunting remote player: " + hauntingPlayer.playerUsername)); } } private Vector3 GetEyeLevelPos(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) return pos += Vector3.up * Mathf.Abs(base.eye.position.y - ((Component)this).transform.position.y); } private bool PlayerCanSeePoint(Vector3 point, bool getEyeLevel = false, int range = 100, float proximity = 1f, float field = 60f) { //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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (getEyeLevel) { point = GetEyeLevelPos(point); } if (!Physics.Linecast(((Component)hauntingPlayer.gameplayCamera).transform.position, point, StartOfRound.Instance.collidersAndRoomMask)) { return hauntingPlayer.HasLineOfSightToPosition(point, field, range, proximity, -1); } return false; } private bool PlayerCanSeeTransform(Transform tran) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return PlayerCanSeePoint(tran.position); } private bool PlayerCanSeeEntity() { if (PlayerCanSeeTransform(base.eye)) { return VisiblePoints.Any(PlayerCanSeeTransform); } return false; } private void State_Stalking(bool isCreeping = false) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; if (stateBusy) { UpdateBodyRotation(); if (!seenByPlayer && PlayerCanSeeEntity()) { if (Random.Range(0, 100) < ((Vector2Int)(ref JumpSRarity))[base.currentBehaviourStateIndex]) { JumpSAwake(); } seenByPlayer = true; stateActionTimer = currentStateInfo.GetStaring(); stateActionTimeout = currentStateInfo.GetRange(); currentStateInfo.PlayRandomVanishClip(AudioSFX); totalTimesSeen++; } float num = Vector3.Distance(((Component)hauntingPlayer).transform.position, ((Component)this).transform.position); if ((seenByPlayer && num < stateActionTimeout) || num < currentStateInfo.MinRange) { stateActionTimer = 0f; } } if (!(time > stateActionTimer)) { return; } if (stateBusy) { stateActionTimer = (seenByPlayer ? currentStateInfo.GetInterval() : currentStateInfo.GetRetry()); stateBusy = false; if (seenByPlayer && (--stateActionCounter <= 0 || (isInCompanyBuilding && base.currentBehaviourStateIndex == 0))) { if (Random.Range(0, 100) < 80) { FlipLightsBreakerServerRpc(); RoundManager.Instance.FlickerLights(true, true); } if (base.currentBehaviourStateIndex == 0) { SendRandomSignal(30); } hauntingPlayer.JumpToFearLevel(1f, true); SwitchState(base.currentBehaviourStateIndex + 1); return; } SetEnemyVisible(enable: false); SendRandomSignal(4); if (seenByPlayer && Random.Range(0, 100) < (isCreeping ? 42 : 18)) { RoundManager.Instance.FlickerLights(true, true); MessWithLightsServerRpc(); hauntingPlayer.JumpToFearLevel((totalTimesSeen > 1) ? 0.6f : 0.2f, true); } if (seenByPlayer && Random.Range(0, 100) < (isCreeping ? 28 : 6)) { HerobrineMinion.Instantiate(((Component)this).transform.position, hauntingPlayer); } } else { TryFindingHauntPosition(staringMode: true, mustBeInLOS: true, Random.Range(0, 100) < (isCreeping ? 50 : 5), (Random.Range(0, 100) < (isCreeping ? 40 : 25)) ? Random.Range(3, 6) : 0); seenByPlayer = false; if (stareFailed) { stateActionTimer = currentStateInfo.GetRetry(); return; } stateBusy = true; stateActionTimer = currentStateInfo.GetStalking(); TurnCompass.LookAt(((Component)hauntingPlayer).transform.position); ((Component)this).transform.eulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, TurnCompass.eulerAngles.y, ((Component)this).transform.eulerAngles.z); } } private void State_Creeping() { State_Stalking(isCreeping: true); } private void State_Chasing() { //IL_0028: 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_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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_0211: 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_024e: 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_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: 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) if (effectNextFrame) { effectNextFrame = false; SpawnEffectByIndex(((Component)this).transform.position, 0); } float num = ((Vector3.Dot(((Component)this).transform.forward, ((Component)this).transform.position - ((Component)hauntingPlayer).transform.position) < 0f) ? 1f : 0f); EntityLookAt.weight = Mathf.Lerp(EntityLookAt.weight, num, 15f * Time.deltaTime); float time = Time.time; float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)hauntingPlayer).transform.position); if (insideLastFrame != hauntingPlayer.isInsideFactory && !hauntingPlayer.isInHangarShipRoom) { Vector3 val = TryFindingHauntPosition(staringMode: false, mustBeInLOS: false, Random.Range(0, 100) < 50, (Random.Range(0, 100) < 50) ? Random.Range(4, 10) : 0); ManualLogSource logger = Logger; Vector3 val2 = val; logger.LogInfo((object)("Trying to relocate and warp to: " + ((object)(Vector3)(ref val2)).ToString())); base.agent.Warp(val); SpawnEffectByIndex(val, 0); insideLastFrame = hauntingPlayer.isInsideFactory; } else if (time > stateActionTimer || num2 > 100f) { currentStateInfo.PlayRandomVanishClip(AudioSFX); SwitchState(1); if (Random.Range(0, 100) < 50) { RequestNewTargetServerRpc(); } return; } if (time > stateActionTimeout && (num2 > 30f || findingExit || (isNavStuck && Time.time + 2f > navTimeout))) { if (!PlayerCanSeePoint(base.eye.position, getEyeLevel: false, 100, 2f, 70f) || isNavStuck) { Vector3 val3 = Vector3.zero; if (findingExit && NavMesh.CalculatePath(((Component)hauntingPlayer).transform.position, currentPoint, -1, entrancePath)) { findingExit = false; NavMeshUtils.Update(2, entrancePath); val3 = GetPathPointOutOfLOV(entrancePath.corners, 3f); currentDist = 0f; } if ((val3 == Vector3.zero && num2 > 8f) || isNavStuck) { val3 = TryFindingHauntPosition(staringMode: false, mustBeInLOS: false, isNavStuck, isNavStuck ? 6 : 0); } if (val3 != Vector3.zero) { stateActionBoost = currentStateInfo.GetStaring(); base.agent.Warp(RoundManager.Instance.GetNavMeshPosition(val3, navHit, 5f, -1)); } } stateActionTimeout = currentStateInfo.GetStalking(); } if (time > stateActionBoost) { stateActionBoost = currentStateInfo.GetStaring(); float pathDistance = GetPathDistance(base.agent.path); Logger.LogInfo((object)("Path Distance: " + pathDistance)); if (!(pathDistance < 6f) && PlayerCanSeePoint(base.eye.position)) { float num3 = Mathf.Pow(Random.Range(0f, 1f), (pathDistance > 15f) ? 0.6f : 1.5f); float num4 = Mathf.Lerp(AgentSpeeds.z, pathDistance - 2f, num3); num4 = Mathf.Min(num4, pathDistance - 2f); Vector3 pointByDistance = GetPointByDistance(base.agent.path, num4); base.agent.Warp(pointByDistance); effectNextFrame = true; RoundManager.Instance.FlickerLights(true, true); } } } private static Vector3 GetPointByDistance(NavMeshPath path, float distance) { //IL_0015: 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_0078: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3[] corners = path.corners; float num = 0f; for (int i = 1; i < corners.Length; i++) { float num2 = Vector3.Distance(corners[i - 1], corners[i]); if (num + num2 >= distance) { float num3 = distance - num; Vector3 val = corners[i] - corners[i - 1]; Vector3 normalized = ((Vector3)(ref val)).normalized; return corners[i - 1] + normalized * num3; } num += num2; } return Vector3.zero; } private void UpdateAgentSpeed() { if (base.currentBehaviourStateIndex < 2) { currentAgentSpeed = 0f; } if (!hauntingPlayer.isHoldingObject) { currentAgentSpeed = AgentSpeeds.x; } else { Item val = hauntingPlayer.ItemSlots[hauntingPlayer.currentItemSlot]?.itemProperties; currentAgentSpeed = ((Object.op_Implicit((Object)(object)val) && val.isDefensiveWeapon) ? AgentSpeeds.y : AgentSpeeds.x); } base.agent.speed = currentAgentSpeed; } private Vector3 GetPathPointOutOfLOV(Vector3[] path, float stepLength) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00bd: 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_0038: 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_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) if (path.Length < 2) { return Vector3.zero; } Vector3 val = path[0]; int num = 1; bool flag = false; while (num < path.Length) { Vector3 val2 = path[num]; float num2 = Vector3.Magnitude(val2 - val); if (num2 >= stepLength) { val = Vector3.MoveTowards(val, val2, stepLength); if (!PlayerCanSeePoint(val, getEyeLevel: true, int.MaxValue, 10f)) { if (flag) { return val; } flag = true; } continue; } float num3 = stepLength - num2; val = val2; num++; if (num >= path.Length) { continue; } val2 = path[num]; val = Vector3.MoveTowards(val, val2, num3); if (!PlayerCanSeePoint(val, getEyeLevel: true, int.MaxValue, 10f)) { if (flag) { return val; } flag = true; } } val = path[^1]; if (!PlayerCanSeePoint(val, getEyeLevel: true, int.MaxValue, 10f)) { return val; } return Vector3.zero; } private void SwitchState(int index) { Logger.LogInfo((object)("Switching State Index: " + index)); currentStateInfo = StateInfos[index]; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(index); bool flag = index == 2; stateActionTimer = currentStateInfo.GetInterval(); stateActionCounter = currentStateInfo.GetCounter(); stateBusy = false; SetEnemyVisible(flag); ((Renderer)MainRenderer).enabled = true; base.creatureAnimator.SetBool("Walk", flag); if (flag) { stateActionTimeout = currentStateInfo.GetStalking(); stateActionBoost = currentStateInfo.GetStaring(); ((EnemyAI)this).SetMovingTowardsTargetPlayer(hauntingPlayer); currentStateInfo.PlayRandomVanishClip(AudioSFX); hauntingPlayer.JumpToFearLevel(1f, true); ResetTraversing(); insideLastFrame = hauntingPlayer.isInsideFactory; base.creatureSFX.Play(); } else { base.creatureSFX.Stop(); } base.movingTowardsTargetPlayer = flag; base.moveTowardsDestination = flag; isNavStuck = false; navTimeout = 0f; stateStartTime = Time.time; UpdateAgentSpeed(); base.isInsidePlayerShip = StartOfRound.Instance.hangarDoorsClosed && hauntingPlayer.isInsideFactory; } private void UpdateBodyRotation() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) float num = Quaternion.Angle(((Component)this).transform.rotation, EntityHead.rotation); EntityLookAt.weight = 1f; if (num > 40f) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.Euler(0f, EntityHead.eulerAngles.y, 0f), 4f * Time.deltaTime); } } public override void Update() { ((EnemyAI)this).Update(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { if (lastVisibility) { SetEnemyVisible(enable: false); } return; } if (((NetworkBehaviour)this).IsServer && (!Object.op_Implicit((Object)(object)hauntingPlayer) || !hauntingPlayer.isPlayerControlled)) { SetNewTargetOnServer(requested: false); return; } if (!((NetworkBehaviour)this).IsOwner) { if (lastVisibility) { SetEnemyVisible(enable: false); } return; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)hauntingPlayer) { if (Object.op_Implicit((Object)(object)hauntingPlayer)) { ((EnemyAI)this).ChangeOwnershipOfEnemy(hauntingPlayer.actualClientId); } return; } if (!hauntingLocalPlayer) { if (base.currentBehaviourStateIndex != 0) { SwitchState(0); } return; } switch (base.currentBehaviourStateIndex) { case 0: State_Stalking(); break; case 1: State_Creeping(); break; case 2: State_Chasing(); break; default: Logger.LogError((object)("Unregistered state: " + base.currentBehaviourStateIndex)); break; } if (((Collider)ScanNodeHitbox).enabled) { float time = Time.time; if (time > ScanNodeIntervals.z) { ScanNodeProps.headerText = "" + Random.Range(int.MinValue, int.MaxValue); ScanNodeIntervals.z = time + Random.Range(ScanNodeIntervals.x, ScanNodeIntervals.y); } if (time > ScanNodeIntervals.w) { ScanNodeProps.subText = "" + Random.Range(int.MinValue, int.MaxValue); ScanNodeIntervals.w = time + Random.Range(ScanNodeIntervals.x, ScanNodeIntervals.y); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitId = -1) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0077: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_0121: 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_00f0: 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_010f: 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_00ac: 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_00be: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner || base.currentBehaviourStateIndex != 2) { return; } Vector3 val = ((Component)this).transform.position; bool flag = false; for (int i = 0; i < 5; i++) { Vector3 insideUnitSphere = Random.insideUnitSphere; Vector3 val2 = ((Vector3)(ref insideUnitSphere)).normalized * Random.Range(8f, 15f); val2.y = 0f; if (NavMesh.SamplePosition(val + val2, ref navHit, 10f, -1) && Vector3.Distance(val, ((NavMeshHit)(ref navHit)).position) > 6f && base.agent.CalculatePath(((NavMeshHit)(ref navHit)).position, navMeshPath) && (int)navMeshPath.status == 0) { val = ((NavMeshHit)(ref navHit)).position; flag = true; break; } } if (!flag) { val = TryFindingHauntPosition(staringMode: false, mustBeInLOS: false); if (val == Vector3.zero) { val = ((Component)this).transform.position - ((Component)this).transform.forward * Random.Range(1.5f, 3f); } val = RoundManager.Instance.GetNavMeshPosition(val, navHit, 5f, -1); } base.agent.Warp(val); SpawnEffectByIndex(val, 0); StateInfo.PlayRandomClipAt(base.creatureVoice, HitAudioClips); stateActionTimeout = currentStateInfo.GetStalking(); } private void SetPlayerSkin(bool value) { isUsingPlayerSkin = value && MCSkinAPI.UsableSkins.Count > 0; if (isUsingPlayerSkin) { Logger.LogInfo((object)"Attempting to set random usable skin."); KeyValuePair keyValuePair = MCSkinAPI.UsableSkins[Random.Range(0, MCSkinAPI.UsableSkins.Count)]; if ((Object)(object)lastSkinTex != (Object)(object)keyValuePair.Key) { lastSkinTex = keyValuePair.Key; lastSkinSlim = keyValuePair.Value; SkinMaterial.mainTexture = (Texture)(object)lastSkinTex; } } MainRenderer.SetBlendShapeWeight(0, (float)((isUsingPlayerSkin && lastSkinSlim) ? 100 : 0)); ((Renderer)MainRenderer).sharedMaterial = (isUsingPlayerSkin ? SkinMaterial : MainMaterial); } public override void Start() { Logger.LogInfo((object)"Starting"); ((EnemyAI)this).Start(); if (!RoundManager.Instance.hasInitializedLevelRandomSeed) { RoundManager.Instance.InitializeRandomNumberGenerators(); } outsideNodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); SetEnemyVisible(enable: false); IsInitialized = true; if (((NetworkBehaviour)this).IsServer) { SetNewTargetOnServer(requested: false); } base.skinnedMeshRenderers = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[0]; base.meshRenderers = (MeshRenderer[])(object)new MeshRenderer[0]; } public override void DoAIInterval() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) if (base.moveTowardsDestination) { base.agent.SetDestination(base.destination); bool flag = (int)base.agent.pathStatus != 0 || Vector3.Distance(base.destination, base.agent.pathEndPosition) > 1f; if (isNavStuck != flag) { isNavStuck = flag; navTimeout = Time.time + 10f; } if (isNavStuck && Time.time > navTimeout) { PerformRandomTPOnPlayer(0); isNavStuck = false; navTimeout = 0f; } } ((EnemyAI)this).SyncPositionToClients(); if (hauntingLocalPlayer != isHauntingLocal) { isHauntingLocal = hauntingLocalPlayer && (Object)(object)hauntingPlayer != (Object)null && !hauntingPlayer.isPlayerDead; if (isHauntingLocal) { SetPlayerSkin(value: false); } } UpdateAgentSpeed(); if (!isHauntingLocal || !hauntingPlayer.isInsideFactory || base.currentBehaviourStateIndex != 2) { if ((Object)(object)currentExit != (Object)null) { ResetTraversing(); } return; } if (entranceList == null) { entranceList = Object.FindObjectsOfType(false); } if (findingExit) { return; } Transform val = null; float num = float.MaxValue; Vector3 val2 = Vector3.zero; for (int i = 0; i < entranceList.Length; i++) { EntranceTeleport val3 = entranceList[i]; if (!val3.isEntranceToBuilding) { continue; } Transform exitPoint = val3.GetExitPoint(); if (!Object.op_Implicit((Object)(object)exitPoint)) { continue; } Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(exitPoint.position, RoundManager.Instance.navHit, 1.75f, -1); if (NavMesh.CalculatePath(((Component)hauntingPlayer).transform.position, navMeshPosition, -1, entrancePath) && (int)entrancePath.status == 0) { float pathDistance = GetPathDistance(entrancePath); if (pathDistance < num) { num = pathDistance; val = exitPoint; val2 = navMeshPosition; } } } if ((Object)(object)currentExit != (Object)(object)val) { ResetTraversing(num, val); } else if (Object.op_Implicit((Object)(object)currentExit)) { traversedDist = Mathf.Max(currentDist - num, -1f); currentDist = Mathf.Max(currentDist, num); if (traversedDist > 5f) { findingExit = true; currentPoint = val2; traversedDist = 0f; currentDist = num; } } } private void ResetTraversing(float dist = 0f, Transform tr = null) { findingExit = false; currentDist = dist; traversedDist = 0f; currentExit = tr; if (entrancePath != null) { entrancePath.ClearCorners(); } } public override void OnCollideWithPlayer(Collider other) { if (!hauntingLocalPlayer) { return; } PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, true); if ((Object)(object)val == (Object)null || !((Object)(object)val == (Object)(object)hauntingPlayer)) { return; } if (base.currentBehaviourStateIndex == 2) { Plugin.OnTouchEffect.Run(this); currentStateInfo.PlayRandomVanishClip(AudioSFX); SwitchState(1); if (!hauntingPlayer.isPlayerDead) { GoSomewhereElse(); } } else if (stateBusy) { stateActionTimer = 0f; } } private void GoSomewhereElse() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) base.agent.Warp(base.allAINodes[Random.Range(0, base.allAINodes.Length)].transform.position); } public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false, bool tamperWithMeshes = false) { } public void SetEnemyVisible(bool enable) { ((Component)MainRenderer).gameObject.SetActive(enable); ((Component)MainRenderer).gameObject.layer = (enable ? 19 : 23); ((Renderer)MainRenderer).enabled = enable; ((Collider)EntityHitbox).enabled = enable; ((Collider)ScanNodeHitbox).enabled = enable && base.currentBehaviourStateIndex == 2; antiCheatObj.SetActive(((Collider)ScanNodeHitbox).enabled); if (lastVisibility != enable && enable) { SetPlayerSkin(Random.Range(0, 100) < Plugin.UseMCSkinChance.Value); } lastVisibility = enable; } private void SetHauntStarePosition(Vector3 newPosition) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_004a: 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_0077: Unknown result type (might be due to invalid IL or missing references) stareFailed = false; Vector3 randomNavMeshPositionInRadiusSpherical = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(newPosition, 1f, navHit); base.agent.Warp(randomNavMeshPositionInRadiusSpherical); base.moveTowardsDestination = false; base.destination = ((Component)this).transform.position; base.agent.SetDestination(base.destination); base.agent.speed = 0f; SetEnemyVisible(enable: true); ManualLogSource logger = Logger; Vector3 val = newPosition; logger.LogInfo((object)("Setting haunt pos: " + ((object)(Vector3)(ref val)).ToString())); } private static float GetPathDistance(NavMeshPath path) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3[] corners = path.corners; float num = 0f; for (int i = 1; i < corners.Length; i++) { num += Vector3.Distance(corners[i - 1], corners[i]); } return num; } private Vector3 TryFindingHauntPosition(bool staringMode = true, bool mustBeInLOS = true, bool behindPlayer = false, int randomDirectionSamples = 0, bool findNodes = true) { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b8: 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_0125: 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_012e: 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_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_0167: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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_02e3: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = (hauntingPlayer.isInsideFactory ? base.allAINodes : outsideNodes); if (behindPlayer) { Vector3 val = ((Component)hauntingPlayer).transform.position + Vector3.up; Vector3 val2 = -((Component)hauntingPlayer).transform.forward; RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val, val2, ref val3, 8f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { ((RaycastHit)(ref val3)).distance = 8f; } if (((RaycastHit)(ref val3)).distance > 3f) { float num = Random.Range(3f, ((RaycastHit)(ref val3)).distance); val += val2 * num; Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val, RoundManager.Instance.navHit, 2f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { navMeshPosition = RoundManager.Instance.GetNavMeshPosition(navMeshPosition, RoundManager.Instance.navHit, -1f, -1); } if (RoundManager.Instance.GotNavMeshPositionResult) { stareFailed = false; if (staringMode) { SetHauntStarePosition(navMeshPosition); } return navMeshPosition; } } } if (randomDirectionSamples > 0) { for (int i = 0; i < randomDirectionSamples; i++) { Vector3 insideUnitSphere = Random.insideUnitSphere; Vector3 val4 = ((Vector3)(ref insideUnitSphere)).normalized * Random.Range(5f, 15f); val4.y = 0f; if (NavMesh.SamplePosition(((Component)hauntingPlayer).transform.position + val4, ref navHit, 15f, -1) && !Physics.Linecast(((Component)hauntingPlayer.gameplayCamera).transform.position, GetEyeLevelPos(((NavMeshHit)(ref navHit)).position), StartOfRound.Instance.collidersAndRoomMaskAndDefault) && !PlayerCanSeePoint(((NavMeshHit)(ref navHit)).position, getEyeLevel: true, 100, isNavStuck ? 1f : 5f, 70f)) { stareFailed = false; if (staringMode) { SetHauntStarePosition(((NavMeshHit)(ref navHit)).position); } return ((NavMeshHit)(ref navHit)).position; } } } if (findNodes) { Vector3 position = ((Component)hauntingPlayer.gameplayCamera).transform.position; float num2 = float.MaxValue; Vector3 val5 = Vector3.zero; for (int j = 0; j < array.Length; j++) { Transform transform = array[j].transform; Vector3 eyeLevelPos = GetEyeLevelPos(transform.position); float num3 = Vector3.Distance(position, eyeLevelPos); if (num3 < num2 && num3 < 90f && (!mustBeInLOS || !Physics.Linecast(((Component)hauntingPlayer.gameplayCamera).transform.position, eyeLevelPos, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) && !PlayerCanSeePoint(eyeLevelPos, getEyeLevel: false, 100, 5f, 76f)) { num2 = num3; val5 = eyeLevelPos; } } stareFailed = val5 == Vector3.zero; if (!stareFailed) { if (staringMode) { SetHauntStarePosition(val5); } return val5; } } stareFailed = true; return Vector3.zero; } [ServerRpc] private void MessWithLightsServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c2: 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: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(925085408u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 925085408u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; MessWithLightsClientRpc(); } } [ClientRpc] private void MessWithLightsClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3374901806u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3374901806u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsOwner) { RoundManager.Instance.FlickerLights(true, true); GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.2f, true); } } } [ServerRpc] private void FlipLightsBreakerServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c2: 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: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1484250467u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1484250467u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; MessWithLightsClientRpc(); } } [ClientRpc] private void FlipLightsBreakerClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3234261868u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3234261868u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; BreakerBox val3 = Object.FindObjectOfType(); if ((Object)(object)val3 != (Object)null) { val3.SetSwitchesOff(); RoundManager.Instance.TurnOnAllLights(false); GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.2f, true); } } } private void FlickerLightsAndSync() { RoundManager.Instance.FlickerLights(true, true); MessWithLightsServerRpc(); } [WeightedMethod(140)] private void weight_KillPlayer() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Vector3 val; if (stateTime < 1f || Random.Range(0, 100) < 8) { weight_SparePlayer(); } else if (Random.Range(0, 100) < 35) { val = ((Component)hauntingPlayer).transform.position - ((Component)this).transform.position; Vector3 velocity = ((Vector3)(ref val)).normalized * Random.Range(15f, 30f); velocity.y = Random.Range(10f, 15f); minecraftPlayer.ExplodePlayer(velocity); } else { PlayerControllerB obj = hauntingPlayer; Vector3 zero = Vector3.zero; int num = Mathf.Max(Plugin.RagdollIndex, 1); val = default(Vector3); obj.KillPlayer(zero, true, (CauseOfDeath)0, num, val, false); } } [WeightedMethod(5)] private void weight_SparePlayer() { FlickerLightsAndSync(); SendDialog("SparePlayer"); } [WeightedMethod(10)] private bool weight_DropAllItems() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0063: 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) if (base.targetPlayer.ItemSlots.All((GrabbableObject itm) => (Object)(object)itm == (Object)null)) { return false; } base.targetPlayer.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); FlickerLightsAndSync(); SendDialog("DropAllItems"); return true; } [WeightedMethod(10)] private bool weight_DrainBattery() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown bool flag = false; for (int i = 0; i < base.targetPlayer.ItemSlots.Length; i++) { GrabbableObject val = base.targetPlayer.ItemSlots[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.itemProperties) && val.itemProperties.requiresBattery) { val.insertedBattery = new Battery(true, 0f); flag = true; } } if (flag) { FlickerLightsAndSync(); SendDialog("DrainBattery"); } return flag; } [WeightedMethod(20)] private bool weight_BreakPlayer() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (base.targetPlayer.health > 10 && !playerReceivedDamage) { weight_SparePlayer(); base.targetPlayer.DamagePlayer(base.targetPlayer.health - 5, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); playerReceivedDamage = true; return playerReceivedDamage; } return false; } [WeightedMethod(20)] private bool weight_FortressLock() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) Vector3 position = ((Component)base.targetPlayer).transform.position; if (FortressLock.LockPlayer(base.targetPlayer)) { SpawnEffectByIndex(position, 0, sync: true); SpawnEffectByIndex(((Component)base.targetPlayer).transform.position, 0); return true; } return false; } [WeightedMethod(20)] private void weight_RandomTelePlayer() { PerformRandomTPOnPlayer(GetRandomIndexFromWeights(TPWeights)); FlickerLightsAndSync(); } private void PerformRandomTPOnPlayer(int index, bool redirected = false) { //IL_01e5: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0075: 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_0083: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null || base.targetPlayer.isPlayerDead) { return; } bool flag; Vector3 position; switch (index) { default: return; case 0: case 1: { flag = index == 0; GameObject[] array = (flag ? RoundManager.Instance.insideAINodes : RoundManager.Instance.outsideAINodes); if (array.Length != 0) { position = array[Random.Range(0, array.Length)].transform.position; position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 10f, default(NavMeshHit)); SendDialog("TP_Relocate"); break; } return; } case 2: { Turret[] array2 = Object.FindObjectsOfType(false); if (array2 == null || array2.Length == 0) { PerformRandomTPOnPlayer(redirected ? Random.Range(0, 2) : 3, redirected: true); return; } Turret val2 = array2[Random.Range(0, array2.Length)]; if ((Object)(object)val2 == (Object)null) { return; } position = ((Component)val2).transform.position; flag = position.y < -80f; position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 2f, default(NavMeshHit)); SendDialog("TP_Turret"); break; } case 3: { Landmine[] array3 = Object.FindObjectsOfType(false); if (array3 == null || array3.Length == 0) { PerformRandomTPOnPlayer(redirected ? Random.Range(0, 2) : 2, redirected: true); return; } Landmine val3 = array3[Random.Range(0, array3.Length)]; if ((Object)(object)val3 == (Object)null) { return; } position = ((Component)val3).transform.position; flag = position.y < -80f; SendDialog("TP_Landmine"); break; } case 4: { List spawnedEnemies = RoundManager.Instance.SpawnedEnemies; spawnedEnemies = spawnedEnemies.FindAll((EnemyAI e) => Object.op_Implicit((Object)(object)e) && Object.op_Implicit((Object)(object)e.enemyType) && Array.IndexOf(excludeTpEnemies, e.enemyType.enemyName) < 0); if (spawnedEnemies == null || spawnedEnemies.Count == 0) { PerformRandomTPOnPlayer(Random.Range(0, 2), redirected: true); return; } EnemyAI val = spawnedEnemies[Random.Range(0, spawnedEnemies.Count)]; position = ((Component)val).transform.position; flag = position.y < -80f; position = RoundManager.Instance.GetRandomNavMeshPositionInRadiusSpherical(position, 8f, default(NavMeshHit)); SendDialog("TP_Monster", val.enemyType.enemyName); break; } } if (!base.targetPlayer.isPlayerDead) { SpawnEffectByIndex(((Component)base.targetPlayer).transform.position, 1, sync: true); TryRelocatePlayer(base.targetPlayer, position, flag); SpawnEffectByIndex(position, 1, sync: true); } } public static void TryRelocatePlayer(PlayerControllerB targetPlayer, Vector3 position, bool isInside) { //IL_005c: 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) if (targetPlayer.isInsideFactory != isInside) { if (!Object.op_Implicit((Object)(object)EntranceTP_Outside)) { EntranceTP_Outside = RoundManager.FindMainEntranceScript(true); } if (!Object.op_Implicit((Object)(object)EntranceTP_Inside)) { EntranceTP_Inside = RoundManager.FindMainEntranceScript(false); } EntranceTeleport val = (isInside ? EntranceTP_Outside : EntranceTP_Inside); if ((Object)(object)val != (Object)null) { val.TeleportPlayer(); } } ((Component)targetPlayer).transform.position = position; ((Component)targetPlayer).transform.eulerAngles = new Vector3(0f, Random.Range(-180f, 180f), 0f); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } private static int GetRandomIndexFromWeights(int[] weights) { int num = weights.Sum(); int num2 = Random.Range(0, num); int num3 = 0; for (int i = 0; i < weights.Length; i++) { num3 += weights[i]; if (num2 <= num3) { return i; } } return 0; } private static void SendChatMessage(string chatMessage, bool isChat = true) { HUDManager.Instance.AddChatMessage(chatMessage, "Herobrine", -1, false); } private static int GetFriendWeights(ulong sid) { if (FriendWeights == null) { FriendWeights = new Dictionary(); string[] array = ResourceUtils.GetString("friends.txt").Split(new char[2] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (string text in array) { if (!text.StartsWith('#')) { string[] array2 = text.Split(' ', StringSplitOptions.RemoveEmptyEntries); string s = array2[0]; string s2 = array2[1]; if (ulong.TryParse(s, out var result) && int.TryParse(s2, out var result2)) { FriendWeights[result] = result2; } } } } if (!FriendWeights.ContainsKey(sid)) { return 0; } return FriendWeights[sid]; } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1054030038u, new RpcReceiveHandler(__rpc_handler_1054030038), "RequestNewTargetServerRpc"); ((NetworkBehaviour)this).__registerRpc(1096127661u, new RpcReceiveHandler(__rpc_handler_1096127661), "SyncNewTargetClientRpc"); ((NetworkBehaviour)this).__registerRpc(925085408u, new RpcReceiveHandler(__rpc_handler_925085408), "MessWithLightsServerRpc"); ((NetworkBehaviour)this).__registerRpc(3374901806u, new RpcReceiveHandler(__rpc_handler_3374901806), "MessWithLightsClientRpc"); ((NetworkBehaviour)this).__registerRpc(1484250467u, new RpcReceiveHandler(__rpc_handler_1484250467), "FlipLightsBreakerServerRpc"); ((NetworkBehaviour)this).__registerRpc(3234261868u, new RpcReceiveHandler(__rpc_handler_3234261868), "FlipLightsBreakerClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_1054030038(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineAI)(object)target).RequestNewTargetServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1096127661(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int id = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref id); bool isReq = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isReq, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineAI)(object)target).SyncNewTargetClientRpc(id, isReq); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_925085408(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineAI)(object)target).MessWithLightsServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3374901806(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineAI)(object)target).MessWithLightsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1484250467(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineAI)(object)target).FlipLightsBreakerServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3234261868(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineAI)(object)target).FlipLightsBreakerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HerobrineAI"; } } [CreateAssetMenu(menuName = "ScriptableObjects/Kittenji/Herobrine/Sound Material")] public class HerobrineSoundMaterial : ScriptableObject { public string[] Names; public AudioClip[] Clips; public void PlayAt(AudioSource source) { AudioClip val = Clips[Random.Range(0, Clips.Length)]; source.spatialize = false; source.pitch = Random.Range(0.93f, 1.07f); source.PlayOneShot(val); WalkieTalkie.TransmitOneShotAudio(source, val, 1f); } public bool Any(RaycastHit hit) { return ((IEnumerable)Names).Any((Func)((Component)((RaycastHit)(ref hit)).collider).CompareTag); } } public class HerobrineAnimSFX : MonoBehaviour { public AudioSource Output; public HerobrineSoundMaterial[] Materials; public Vector3 Offset = new Vector3(0f, 0.1f, 0f); public float Distance = 0.3f; public LayerMask WalkLayers = LayerMask.op_Implicit(268437769); private int currentMaterialIndex; private Ray interactRay; private RaycastHit hit; private HerobrineSoundMaterial CurrentMaterial => Materials[currentMaterialIndex]; public void PlayAudio1RandomClip() { GetCurrentMaterialStandingOn(); CurrentMaterial.PlayAt(Output); } private void GetCurrentMaterialStandingOn() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) interactRay = new Ray(((Component)this).transform.position + Vector3.up, Vector3.down); if (!Physics.Raycast(interactRay, ref hit, 5f, LayerMask.op_Implicit(WalkLayers), (QueryTriggerInteraction)1) || CurrentMaterial.Any(hit)) { return; } for (int i = 0; i < Materials.Length; i++) { if (Materials[i].Any(hit)) { currentMaterialIndex = i; break; } } } } public class HerobrineTracker : MonoBehaviour { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Animator animator; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 4; break; case 1: <>1__state = -1; break; } if (5__2 > 0) { 5__2--; animator.SetTrigger("Flicker"); <>2__current = (object)new WaitForSeconds(0.05f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public int closeDoorChance = 10; public int flickerLightChance = 10; [SerializeField] private HerobrineAI entity; [SerializeField] private SphereCollider trigger; private Coroutine flickerLightCoroutine; public void SetEnabled(bool value) { ((Collider)trigger).enabled = value; } private void Awake() { if (!Object.op_Implicit((Object)(object)entity)) { entity = ((Component)this).GetComponentInParent(); } if (!Object.op_Implicit((Object)(object)trigger)) { trigger = ((Component)this).GetComponent(); } } private void FixedUpdate() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (((Collider)trigger).enabled) { ((Component)this).transform.position = ((Component)entity.hauntingPlayer).transform.position; } } private void OnTriggerEnter(Collider other) { if (!((Collider)trigger).enabled || ((EnemyAI)entity).currentBehaviourStateIndex == 2 || ((Component)other).gameObject.layer != 16) { return; } Animator component = ((Component)other).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component) && Random.Range(0, 100) < flickerLightChance) { if (flickerLightCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(flickerLightCoroutine); } flickerLightCoroutine = ((MonoBehaviour)this).StartCoroutine(FlickerLightAnimator(component)); } } [IteratorStateMachine(typeof(d__9))] private IEnumerator FlickerLightAnimator(Animator animator) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { animator = animator }; } private void OnTriggerExit(Collider other) { if (!((Collider)trigger).enabled || ((EnemyAI)entity).currentBehaviourStateIndex == 2 || ((Component)other).gameObject.layer != 9) { return; } DoorLock component = ((Component)other).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null) && !component.isLocked && component.isDoorOpened) { AnimatedObjectTrigger component2 = ((Component)other).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component2) && Random.Range(0, 100) < closeDoorChance) { component2.TriggerAnimationNonPlayer(false, false, false); } } } } public class MinecraftRagdoll : MonoBehaviour { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MinecraftRagdoll <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown int num = <>1__state; MinecraftRagdoll minecraftRagdoll = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; minecraftRagdoll.minecraftPlayer = ((Component)minecraftRagdoll.bodyInfo.playerScript).GetComponent(); ((Renderer)minecraftRagdoll.skinnedMeshRenderer).sharedMaterial = minecraftRagdoll.material; minecraftRagdoll.skinnedMeshRenderer.SetBlendShapeWeight(0, 0f); if (Object.op_Implicit((Object)(object)minecraftRagdoll.minecraftPlayer) && minecraftRagdoll.minecraftPlayer.skin != null && minecraftRagdoll.minecraftPlayer.skin.isLoaded && ((minecraftRagdoll.minecraftPlayer.skin.isLocal && Plugin.RagdollSkinTexture.Value) || (!minecraftRagdoll.minecraftPlayer.skin.isLocal && Plugin.ReceiveSkinTextures.Value))) { minecraftRagdoll.minecraftPlayer.Apply(minecraftRagdoll.skinnedMeshRenderer); } ((Behaviour)minecraftRagdoll).enabled = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Material material; public AudioSource deathAudio; public AudioClip deathClip; private DeadBodyInfo bodyInfo; private MinecraftPlayerNetworking minecraftPlayer; private SkinnedMeshRenderer skinnedMeshRenderer; private static Light NightVisionProxy; private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) bodyInfo = ((Component)this).GetComponent(); skinnedMeshRenderer = ((Component)this).GetComponent(); deathAudio.PlayOneShot(deathClip); if (!Object.op_Implicit((Object)(object)NightVisionProxy)) { GameObject val = new GameObject("HEROBRINE: NIGHT VISION PROXY"); val.SetActive(false); NightVisionProxy = val.AddComponent(); } bodyInfo.nightVisionRadar = NightVisionProxy; } private void Start() { ((MonoBehaviour)this).StartCoroutine(SetMaterial()); } [IteratorStateMachine(typeof(d__9))] private IEnumerator SetMaterial() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this }; } } [BepInPlugin("Kittenji.HerobrineMod", "HerobrineMod", "1.3.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [CompatibleDependency("ainavt.lc.lethalconfig", typeof(LethalConfigUtils))] public class Plugin : BaseUnityPlugin { public const string pluginGUID = "Kittenji.HerobrineMod"; public const string pluginName = "HerobrineMod"; public const string pluginVersion = "1.3.9"; public static readonly Harmony harmony = new Harmony("Kittenji.HerobrineMod"); internal static readonly Assets assets = new Assets(); private const string depGUID = "dev.kittenji.NavMeshInCompany"; private static Dictionary> RiskDefaults = new Dictionary> { { "D", new Tuple(2, "Spawn rarity for moons with a Risk Level of 'D'") }, { "C", new Tuple(3, "Spawn rarity for moons with a Risk Level of 'C'") }, { "B", new Tuple(3, "Spawn rarity for moons with a Risk Level of 'B'") }, { "A", new Tuple(8, "Spawn rarity for moons with a Risk Level of 'A'") }, { "S", new Tuple(15, "Spawn rarity for moons with a Risk Level of 'S'") }, { "S+", new Tuple(30, "Spawn rarity for moons with a Risk Level of 'S+'") }, { "SSS", new Tuple(40, "Spawn rarity for modded moons with a Risk Level of 'SSS'.") }, { "Other", new Tuple(15, "Spawn rarity for moons with an unkown Risk Level or any other Risk Level.") } }; internal static readonly Dictionary RiskMult = new Dictionary(); internal static readonly Dictionary RiskToRarity = new Dictionary(); public static ConfigEntry TorchMinValue; public static ConfigEntry TorchMaxValue; public static ConfigEntry ReplaceDressGirl; public static ConfigEntry MinecraftMoonMult; public static ConfigEntry UseMCSkinChance; public static ConfigEntry RagdollSkinTexture; public static ConfigEntry ReceiveSkinTextures; public static ConfigEntry MinecraftUsernameOverride; public static string[] MinecraftUsernames; public static WeightedList OnTouchEffect; public static bool HasCompanyNav { get; private set; } public static EnemyType EnemyDef { get; private set; } public static Item ItemDef { get; private set; } public static GameObject FortressPrefab { get; private set; } public static GameObject RagdollPrefab { get; private set; } public static GameObject DevFollowerPrefab { get; private set; } public static int RagdollIndex { get; internal set; } = 0; public static EffectsManager EffectPrefabs { get; private set; } private void InitAssets() { EnemyDef = assets.LoadByName("Herobrine.asset", nameOnly: false); ItemDef = assets.LoadByName("RedstoneTorch.asset", nameOnly: false); RagdollPrefab = assets.LoadByName("MCRagdollPrefab.prefab", nameOnly: false); FortressPrefab = assets.LoadByName("NetherFortress.prefab", nameOnly: false); DevFollowerPrefab = assets.LoadByName("DevFollower.prefab", nameOnly: false); EffectPrefabs = assets.LoadByName("EffectPrefabs.asset", nameOnly: false); } private void InitConfig() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown ReplaceDressGirl = ((BaseUnityPlugin)this).Config.Bind("Configuration", "Replace Ghost Girl", false, "By default Herobrine is it's own entity can spawn separated from the Ghost Girl entity so both of them can exist in the game.\nSet this value to 'true' if you want the Ghost Girl to be removed from the game."); TorchMinValue = ((BaseUnityPlugin)this).Config.Bind("Configuration", "Redstone Torch Value Min", 50, (ConfigDescription)null).Register(); TorchMaxValue = ((BaseUnityPlugin)this).Config.Bind("Configuration", "Redstone Torch Value Max", 100, (ConfigDescription)null).Register(); MinecraftMoonMult = ((BaseUnityPlugin)this).Config.Bind("Configuration", "Minecraft Moon Multiplier", 5, "Attempts to multiply the spawn rate for this entity on Minecraft moons.").Register(); UseMCSkinChance = ((BaseUnityPlugin)this).Config.Bind("Minecraft Skin", "Use Player Skin Chance", 25, new ConfigDescription("This entity will try to find your minecraft skin using your display name in game.\nThis value controls the chance for this to happen.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())).Register(0, 100); RagdollSkinTexture = ((BaseUnityPlugin)this).Config.Bind("Minecraft Skin", "Ragdoll Skin Texture", true, "If enabled, your Minecraft skin texture will be applied to your ragdoll on death by Herobrine.").Register(); ReceiveSkinTextures = ((BaseUnityPlugin)this).Config.Bind("Minecraft Skin", "Receive Skin Textures", true, "If enabled, player death ragdolls will receive the user's preferred minecraft skin texture. Disable this if you don't trust the players you're playing with.").Register(); MinecraftUsernameOverride = ((BaseUnityPlugin)this).Config.Bind("Minecraft Skin", "Minecraft Username Override", string.Empty, "Overrides the Minecraft username used to find and download your minecraft skin. Use this if your Steam username doesn't match your Minecraft username.").Register(); MinecraftUsernameOverride.SettingChanged += delegate { ProcessMinecraftUsernames(); }; string[] array = RiskDefaults.Keys.ToArray(); foreach (string text in array) { Tuple tuple = RiskDefaults[text]; ConfigEntry config = ((BaseUnityPlugin)this).Config.Bind("Spawn Rarity Per Risk Level", "Risk Level " + text, tuple.Item1, tuple.Item2).Register(); RiskToRarity[text] = DynamicEnemyWithRarity.From(config, EnemyDef); } RiskDefaults.Clear(); RiskDefaults = null; ((Dictionary)((object)((BaseUnityPlugin)this).Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(((BaseUnityPlugin)this).Config, null)).Clear(); ((BaseUnityPlugin)this).Config.Save(); } private static void TorchValue_SettingChanged(object sender, EventArgs e) { ItemDef.minValue = Mathf.Max(TorchMinValue.Value, 15); ItemDef.maxValue = Mathf.Max(TorchMaxValue.Value, 20); } internal static void ProcessMinecraftUsernames(GameNetworkManager instance = null) { if ((Object)(object)instance == (Object)null) { instance = GameNetworkManager.Instance; } if (Object.op_Implicit((Object)(object)instance)) { if (!string.IsNullOrWhiteSpace(MinecraftUsernameOverride.Value)) { MinecraftUsernames = MinecraftUsernameOverride.Value.Split(',', StringSplitOptions.RemoveEmptyEntries).Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); } else { MinecraftUsernames = null; } ((MonoBehaviour)instance).StartCoroutine(MCSkinAPI.FetchSkins(MinecraftUsernames)); } } private void Awake() { HasCompanyNav = Chainloader.PluginInfos.ContainsKey("dev.kittenji.NavMeshInCompany"); CompatibleDependencyAttribute.Init((BaseUnityPlugin)(object)this); Log.Source = ((BaseUnityPlugin)this).Logger; Log.Info("Contains Company Navigation: " + HasCompanyNav); InitAssets(); InitConfig(); OnTouchEffect = WeightedMethodAttribute.Initialize(typeof(HerobrineAI)); NetcodeUtils.InitNetcode(harmony); EnemyDef.RegisterNetworkPrefab(); ItemDef.RegisterNetworkPrefab(); TorchValue_SettingChanged(null, null); harmony.PatchAll(); Debug.Log((object)"[!] Removed Herobrine"); } } public class RedstoneTorchProp : GrabbableObject { public static bool wasSpawnedThisRound; public GameObject itemEffects; public bool wasHeldOnServer { get; private set; } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); if (((NetworkBehaviour)this).IsServer && !wasHeldOnServer) { wasHeldOnServer = true; ForceSpawnEnemy(); } itemEffects.SetActive(true); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); itemEffects.SetActive(true); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); itemEffects.SetActive(false); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); itemEffects.SetActive(true); } public override void ChargeBatteries() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner && !StartOfRound.Instance.inShipPhase && Object.op_Implicit((Object)(object)base.playerHeldBy) && !((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController) && Random.Range(0, 100) < 30) { ((Component)base.playerHeldBy).GetComponent()?.ExplodePlayer(); } } public override void OnDestroy() { ((GrabbableObject)this).OnDestroy(); if (Object.op_Implicit((Object)(object)StartOfRound.Instance) && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null && StartOfRound.Instance.currentLevel.sceneName == "CompanyBuilding") { ForceSpawnEnemy(); } } private void ForceSpawnEnemy() { //IL_00aa: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || !Object.op_Implicit((Object)(object)base.playerHeldBy) || base.playerHeldBy.isInHangarShipRoom || wasSpawnedThisRound || base.isInShipRoom || !Object.op_Implicit((Object)(object)RoundManager.Instance) || !Object.op_Implicit((Object)(object)StartOfRound.Instance) || StartOfRound.Instance.inShipPhase) { return; } Log.Info("Trying to force spawn enemy by: " + base.playerHeldBy.playerUsername); wasSpawnedThisRound = true; GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes; Vector3 val = ((outsideAINodes != null && outsideAINodes.Length != 0) ? outsideAINodes[Random.Range(0, outsideAINodes.Length)].transform.position : ((Component)base.playerHeldBy).transform.position); NetworkObjectReference val2 = RoundManager.Instance.SpawnEnemyGameObject(val, 0f, -1, Plugin.EnemyDef); NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref val2)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent().PlayerSpawnedBy = base.playerHeldBy; } if (Object.op_Implicit((Object)(object)RoundManager.Instance) && RoundManager.Instance.allEnemyVents != null) { EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents; for (int i = 0; i < allEnemyVents.Length; i++) { EnemyVent val4 = allEnemyVents[i]; if (Object.op_Implicit((Object)(object)val4) && val4.occupied && (Object)(object)val4.enemyType == (Object)(object)Plugin.EnemyDef) { val4.OpenVentClientRpc(); Log.Info("Removed from vent #" + i); } } } EnemyType enemyDef = Plugin.EnemyDef; enemyDef.numberSpawned++; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "RedstoneTorchProp"; } } [CreateAssetMenu(menuName = "ScriptableObjects/Kittenji/Herobrine/Dialog Messages")] public class DialogMessages : ScriptableObject { private const string TAG_REPLACEMENT = "{T}"; public string[] Lines; public string GetRandom(string tag = null) { string text = Lines[Random.Range(0, Lines.Length)]; if (!string.IsNullOrEmpty(tag) && text.Contains("{T}", StringComparison.OrdinalIgnoreCase)) { text = text.Replace("{T}", tag, StringComparison.OrdinalIgnoreCase); } return text; } } [CreateAssetMenu(menuName = "ScriptableObjects/Kittenji/Herobrine/State Info")] public class StateInfo : ScriptableObject { public Vector2 Interval; public Vector2 Stalking; public Vector2 Staring; public Vector2Int Counter; public Vector3 Range = new Vector3(1f, 5f, 7f); public float Retry = 5f; public AudioClip[] VanishClips; public float MinRange => Range.x; public float GetInterval() { return Time.time + Random.Range(Interval.x, Interval.y); } public float GetStalking() { return Time.time + Random.Range(Stalking.x, Stalking.y); } public float GetStaring() { return Time.time + Random.Range(Staring.x, Staring.y); } public float GetRange() { return Random.Range(Range.y, Range.z); } public float GetRetry() { return Time.time + Retry; } public int GetCounter() { return Random.Range(((Vector2Int)(ref Counter)).x, ((Vector2Int)(ref Counter)).y + 1); } public void PlayRandomVanishClip(AudioSource source, bool oneShot = true, bool world = false) { PlayRandomClipAt(source, VanishClips, oneShot, world); } public static void PlayRandomClipAt(AudioSource source, AudioClip[] clips, bool oneShot = true, bool world = false) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (clips.Length == 0) { return; } int num = Random.Range(0, clips.Length); AudioClip val = clips[num]; if (world) { AudioSource.PlayClipAtPoint(val, ((Component)source).transform.position, source.volume); return; } if (oneShot) { source.PlayOneShot(val); return; } if (source.isPlaying) { source.Stop(); } source.clip = val; source.Play(); } } [CreateAssetMenu(menuName = "ScriptableObjects/Kittenji/Herobrine/Effects Manager")] public class EffectsManager : ScriptableObject { public GameObject[] Prefabs; public static EffectsManager Instance => Plugin.EffectPrefabs; } [AttributeUsage(AttributeTargets.Method)] public class WeightedMethodAttribute : Attribute { public int Weight { get; private set; } public WeightedMethodAttribute(int weight) { Weight = weight; } public static WeightedList Initialize(Type type) { WeightedList weightedList = new WeightedList(); MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { WeightedMethodAttribute customAttribute = methodInfo.GetCustomAttribute(inherit: false); if (customAttribute != null) { weightedList.Add(methodInfo, customAttribute.Weight); } } return weightedList; } } public struct WeightedInfo { public int weight; public int index; } public class WeightedList { private List m_Methods = new List(); private List m_Weights = new List(); private List m_Infos = new List(); private List m_Temp = new List(); public void Clear() { m_Methods.Clear(); m_Weights.Clear(); m_Infos.Clear(); } public void Add(MethodInfo method, int weight) { m_Methods.Add(method); m_Weights.Add(weight); m_Infos.Add(new WeightedInfo { weight = weight, index = m_Weights.Count - 1 }); } public int Get(List weights) { if (weights.Count == 0) { return -1; } int num = weights.Sum((WeightedInfo a) => a.weight); int num2 = Random.Range(0, num); int num3 = 0; for (int i = 0; i < weights.Count; i++) { num3 += weights[i].weight; if (num2 <= num3) { return i; } } return -1; } public object Run() { return Run(null, null); } public object Run(object obj) { return Run(obj, null); } public object Run(object obj, params object[] args) { m_Temp.Clear(); m_Temp.AddRange(m_Infos); object obj2; while (true) { int num = Get(m_Temp); if (num < 0) { return null; } MethodInfo methodInfo = m_Methods[m_Temp[num].index]; Log.Info(" --- Running Weighted Method: " + methodInfo.Name); obj2 = methodInfo.Invoke(obj, args); if (obj2 == null || !(obj2 is bool) || (bool)obj2) { break; } m_Temp.RemoveAt(num); } return obj2; } } } namespace Kittenji.HerobrineMod.Skins { public class LauncherSkins { public class SkinData { private const string base64Start = "data:image/png;base64,"; public DateTime created { get; set; } public string id { get; set; } public string modelImage { get; set; } public string name { get; set; } public string skinImage { get; set; } public bool slim { get; set; } public string textureId { get; set; } public DateTime updated { get; set; } public byte[] GetSkinBytes() { if (skinImage.IndexOf("data:image/png;base64,") == -1) { return null; } string text = skinImage.Substring("data:image/png;base64,".Length).Trim(); if (text.Length < 1) { return null; } try { return Convert.FromBase64String(text); } catch (Exception) { return null; } } } private static readonly string DataLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".minecraft", "launcher_custom_skins.json"); public Dictionary customSkins { get; set; } public int version { get; set; } public SkinData GetMostRecent() { if (customSkins == null || customSkins.Count == 0) { return null; } foreach (SkinData item in customSkins.Values.OrderByDescending((SkinData x) => x.updated)) { if (!string.IsNullOrEmpty(item.textureId)) { return item; } } return null; } public static bool TryGet(out LauncherSkins skins) { try { if (!File.Exists(DataLocation)) { skins = null; return false; } LauncherSkins launcherSkins = JsonConvert.DeserializeObject(File.ReadAllText(DataLocation)); skins = launcherSkins; return true; } catch (Exception) { skins = null; return false; } } } public static class MCSkinAPI { [CompilerGenerated] private sealed class d__11 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string[] names; private bool 5__2; private int 5__3; private string <_username>5__4; private string 5__5; private UnityWebRequest 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: try { } finally { <>m__Finally1(); } break; case -4: case 2: try { } finally { <>m__Finally2(); } break; case -5: case 3: try { } finally { <>m__Finally3(); } break; } <_username>5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //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_011b: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; ClearPlayerSkins(); 5__2 = false; if (names != null && names.Length != 0) { goto IL_00a9; } if (SteamClient.IsValid) { 5__2 = true; string text2 = UsernamePattern.Replace(SteamUsername, string.Empty).Trim(); names = new string[2] { text2.Replace(" ", string.Empty), text2.Replace(" ", "_") }; goto IL_00a9; } result = false; goto end_IL_0000; case 1: { <>1__state = -3; if (!IsReqOk(5__6)) { <>m__Finally1(); goto IL_03e2; } string text = 5__6.downloadHandler.text; <>m__Finally1(); 5__6 = null; USER uSER = TryDeserialize(text); if (uSER == null) { goto IL_03e2; } 5__6 = UnityWebRequest.Get("https://sessionserver.mojang.com/session/minecraft/profile/" + uSER.id); <>1__state = -4; <>2__current = 5__6.SendWebRequest(); <>1__state = 2; result = true; goto end_IL_0000; } case 2: { <>1__state = -4; if (!IsReqOk(5__6)) { <>m__Finally2(); goto IL_03e2; } string text = 5__6.downloadHandler.text; <>m__Finally2(); 5__6 = null; PROFILE pROFILE = TryDeserialize(text); if (pROFILE == null || pROFILE.properties == null || pROFILE.properties.Length == 0) { goto IL_03e2; } TEXTURE tEXTURE; try { tEXTURE = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(Convert.FromBase64String(pROFILE.properties[0].value))); if (tEXTURE == null) { goto IL_03e2; } } catch { goto IL_03e2; } 5__5 = tEXTURE.textures.SKIN.url.Replace("http:", "https:"); 5__6 = UnityWebRequestTexture.GetTexture(5__5); <>1__state = -5; <>2__current = 5__6.SendWebRequest(); <>1__state = 3; result = true; goto end_IL_0000; } case 3: { <>1__state = -5; if (IsReqOk(5__6)) { try { Texture2D content = DownloadHandlerTexture.GetContent(5__6); (Texture2D, bool) tuple = ConvertSkin(content); content = tuple.Item1; bool item = tuple.Item2; string textureId = 5__5.Substring(5__5.LastIndexOf('/')).Trim('/'); AddPlayerSkin(content, item, textureId); if (5__2) { result = false; goto IL_03c5; } } catch (Exception ex) { Log.Error("Exception ocurred while converting skin for: " + <_username>5__4); Debug.LogException(ex); } <>m__Finally3(); 5__6 = null; <_username>5__4 = null; 5__5 = null; } else { <>m__Finally3(); } goto IL_03e2; } IL_00a9: 5__3 = 0; break; IL_03e2: 5__3++; break; IL_03c5: <>m__Finally3(); goto end_IL_0000; } if (5__3 < names.Length) { <_username>5__4 = names[5__3].Trim(); <_username>5__4.ToLowerInvariant(); if (!5__2 || !LauncherSkins.TryGet(out var skins)) { goto IL_0152; } LauncherSkins.SkinData mostRecent = skins.GetMostRecent(); if (mostRecent == null) { goto IL_0152; } byte[] skinBytes = mostRecent.GetSkinBytes(); if (skinBytes == null || skinBytes.Length == 0) { goto IL_0152; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { filterMode = (FilterMode)0 }; ImageConversion.LoadImage(val, skinBytes); bool isSlim; (val, isSlim) = ConvertSkin(val); AddPlayerSkin(val, isSlim, mostRecent.textureId); result = false; } else { result = false; } goto end_IL_0000; IL_0152: 5__6 = UnityWebRequest.Get("https://api.mojang.com/users/profiles/minecraft/" + <_username>5__4); <>1__state = -3; <>2__current = 5__6.SendWebRequest(); <>1__state = 1; result = true; end_IL_0000:; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__6 != null) { ((IDisposable)5__6).Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (5__6 != null) { ((IDisposable)5__6).Dispose(); } } private void <>m__Finally3() { <>1__state = -1; if (5__6 != null) { ((IDisposable)5__6).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string API_USERS = "https://api.mojang.com/users/profiles/minecraft/"; private const string API_PROFILE = "https://sessionserver.mojang.com/session/minecraft/profile/"; public const string API_TEXTURE = "https://textures.minecraft.net/texture/"; private static readonly Regex UsernamePattern = new Regex("[^ _0-9A-Za-z]"); public static readonly List> UsableSkins = new List>(); private static string SteamUsername => SteamClient.Name; public static MinecraftSkin PlayerSkin { get; private set; } = new MinecraftSkin(); [IteratorStateMachine(typeof(d__11))] public static IEnumerator FetchSkins(string[] names) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { names = names }; } private static void ClearPlayerSkins() { if (UsableSkins.Count > 0) { foreach (KeyValuePair usableSkin in UsableSkins) { if (Object.op_Implicit((Object)(object)usableSkin.Key)) { Object.Destroy((Object)(object)usableSkin.Key); } } UsableSkins.Clear(); } PlayerSkin.Destroy(); } private static void AddPlayerSkin(Texture2D original, bool isSlim, string textureId) { UsableSkins.Add(new KeyValuePair(original, isSlim)); if (PlayerSkin.textureId != textureId) { PlayerSkin.SetTextureID(textureId, isSlim); PlayerSkin.texture = original; PlayerSkin.isLoaded = true; PlayerSkin.isLocal = true; } } private static bool IsReqOk(UnityWebRequest request) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)request.result == 1) { return request.responseCode == 200; } return false; } public static T TryDeserialize(string data) where T : class { try { return JsonConvert.DeserializeObject(data); } catch { return null; } } public static (Texture2D, bool) ConvertSkin(Texture2D original) { //IL_0019: 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_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_0055: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_008e: Unknown result type (might be due to invalid IL or missing references) ((Texture)original).filterMode = (FilterMode)0; bool num = ((Texture)original).height == 32; bool item = !num && original.GetPixel(50, 45).a < 0.5f; if (num) { Log.Info("Attempting to convert skin texture from '64x32' to '64x64'"); Texture2D val = new Texture2D(64, 64, original.format, false) { filterMode = (FilterMode)0 }; Color32[] pixels = val.GetPixels32(); Color32[] pixels2 = original.GetPixels32(); Color32 val2 = Color32.op_Implicit(Color.clear); for (int i = 0; i < pixels.Length; i++) { pixels[i] = ((i < pixels2.Length) ? val2 : pixels2[i % pixels2.Length]); } val.SetPixels32(pixels); val.Clear(0, 0, 8, 8); val.Clear(24, 0, 40, 8); val.Clear(32, 8, 32, 8); val.Clear(0, 16, 4, 4); val.Clear(12, 16, 8, 4); val.Clear(36, 16, 8, 4); val.Clear(52, 16, 12, 4); val.Clear(56, 20, 8, 12); val.Copy(4, 4, 4, 16, 20, 48); val.Copy(4, 4, 8, 16, 24, 48); val.Copy(4, 12, 8, 20, 16, 52); val.Copy(4, 12, 4, 20, 20, 52); val.Copy(4, 12, 0, 20, 24, 52); val.Copy(4, 12, 12, 20, 28, 52); val.Copy(4, 4, 44, 16, 36, 48); val.Copy(4, 4, 48, 16, 40, 48); val.Copy(4, 12, 48, 20, 32, 52); val.Copy(4, 12, 44, 20, 36, 52); val.Copy(4, 12, 40, 20, 40, 52); val.Copy(4, 12, 52, 20, 44, 52); val.Apply(); Object.Destroy((Object)(object)original); original = val; } Texture2D item2 = ResizeTexture(original, ((Texture)original).width * 8, ((Texture)original).height * 8); Object.Destroy((Object)(object)original); return (item2, item); } private static Texture2D ResizeTexture(Texture2D source, int newWidth, int newHeight) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(newWidth, newHeight, source.format, false) { filterMode = (FilterMode)0 }; float num = ((Texture)val).width; float num2 = ((Texture)val).height; for (int i = 0; i < ((Texture)val).height; i++) { for (int j = 0; j < ((Texture)val).width; j++) { int num3 = Mathf.FloorToInt((float)j / num * (float)((Texture)source).width); int num4 = Mathf.FloorToInt((float)i / num2 * (float)((Texture)source).height); val.SetPixel(j, i, source.GetPixel(num3, num4)); } } val.Apply(); return val; } } internal static class MCSkinAPIExtensions { internal static void Copy(this Texture2D skin, int sizeX, int sizeY, int coorX, int coorY, int destX, int destY) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) coorY = ((Texture)skin).height - (coorY + sizeY); destY = ((Texture)skin).height - (destY + sizeY); Color[] pixels = skin.GetPixels(coorX, coorY, sizeX, sizeY); for (int i = 0; i < sizeY; i++) { for (int j = 0; j < sizeX / 2; j++) { int num = j + i * sizeX; int num2 = sizeX - 1 - j + i * sizeX; Color val = pixels[num]; pixels[num] = pixels[num2]; pixels[num2] = val; } } skin.SetPixels(destX, destY, sizeX, sizeY, pixels); } internal static void Clear(this Texture2D skin, int x, int y, int sizeX, int sizeY) { //IL_001d: 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_0027: Unknown result type (might be due to invalid IL or missing references) y = ((Texture)skin).height - (y + sizeY); Color32[] array = (Color32[])(object)new Color32[sizeX * sizeY]; for (int i = 0; i < array.Length; i++) { array[i] = Color32.op_Implicit(Color.clear); } skin.SetPixels32(x, y, sizeX, sizeY, array); } } public class MinecraftSkin { [CompilerGenerated] private sealed class d__14 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MinecraftSkin <>4__this; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Invalid comparison between Unknown and I4 try { int num = <>1__state; MinecraftSkin minecraftSkin = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; minecraftSkin.Destroy(); string text = "https://textures.minecraft.net/texture/" + minecraftSkin.textureId; 5__2 = UnityWebRequestTexture.GetTexture(text); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; } case 1: <>1__state = -3; if ((int)5__2.result == 1 && 5__2.responseCode == 200) { try { Texture2D content = DownloadHandlerTexture.GetContent(5__2); (Texture2D, bool) tuple = MCSkinAPI.ConvertSkin(content); content = tuple.Item1; bool item = tuple.Item2; minecraftSkin.texture = content; minecraftSkin.isSlim = item; minecraftSkin.isLoaded = true; } catch (Exception ex) { Debug.LogException(ex); } } <>m__Finally1(); 5__2 = null; return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Texture2D texture; public bool isSlim; public bool isLoaded; public bool isLocal; public string textureId { get; private set; } public string encodedId { get; private set; } public void SetTextureID(string textureId, bool isSlim, bool decode = false) { if (string.IsNullOrEmpty(textureId)) { this.textureId = null; encodedId = null; } else if (decode) { this.textureId = DecodeTextureID(textureId); encodedId = textureId; } else { this.textureId = textureId; encodedId = EncodeTextureID(textureId); } isLoaded = false; this.isSlim = isSlim; } public void Destroy() { if (Object.op_Implicit((Object)(object)texture) && !isLocal) { Object.Destroy((Object)(object)texture); texture = null; textureId = null; encodedId = null; isLoaded = false; } } [IteratorStateMachine(typeof(d__14))] public IEnumerator Download() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } public static string EncodeTextureID(string textureID) { byte[] array = new byte[textureID.Length / 2]; for (int i = 0; i < array.Length; i++) { array[i] = Convert.ToByte(textureID.Substring(i * 2, 2), 16); } return Convert.ToBase64String(array); } public static string DecodeTextureID(string textureID) { return BitConverter.ToString(Convert.FromBase64String(textureID)).Replace("-", string.Empty).ToLowerInvariant(); } } } namespace Kittenji.HerobrineMod.Skins.Models { [Serializable] public class PROFILE : USER { public PROPERTY[] properties; } [Serializable] public class PROPERTY { public string name; public string value; } [Serializable] public class SKIN { public string url; } [Serializable] public class TEXTURE { public long timestamp; public string profileId; public string profileName; public TEXTURES textures; } [Serializable] public class TEXTURES { public SKIN SKIN; } [Serializable] public class USER { public string name; public string id; } } namespace Kittenji.HerobrineMod.Patches { [HarmonyPatch] internal static class GeneralGamePatches { [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void StartPatch(GameNetworkManager __instance) { Plugin.ProcessMinecraftUsernames(__instance); } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] [HarmonyWrapSafe] private static void StartPatch(PlayerControllerB __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] [HarmonyWrapSafe] private static void ConnectClientToPlayerObjectPatch(PlayerControllerB __instance) { MinecraftPlayerNetworking minecraftPlayerNetworking; if (!Object.op_Implicit((Object)(object)(minecraftPlayerNetworking = ((Component)__instance).gameObject.GetComponent()))) { minecraftPlayerNetworking = ((Component)__instance).gameObject.AddComponent(); } minecraftPlayerNetworking.Connect(); } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int numFrames; public StartOfRound __instance; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Time.frameCount + numFrames + 1; break; case 1: <>1__state = -1; break; } if (Time.frameCount < 5__2) { <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)__instance)) { Log.Info("Registering spawnables in instance 'delayed'."); RegisterSpawnables(__instance); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly string[,] PossibleMinecraftMoons = new string[3, 2] { { "Taiga", "Taiga" }, { "The End", "The End" }, { "Minecraft Village", "Minecraft Village" } }; private static bool DressGirlMatch(SpawnableEnemyWithRarity e) { if (Object.op_Implicit((Object)(object)e.enemyType) && Object.op_Implicit((Object)(object)e.enemyType.enemyPrefab)) { return ((Object)e.enemyType.enemyPrefab).name == "DressGirl"; } return false; } private static bool IsPossibleMCMoon(string assetName, string planetName) { for (int i = 0; i < PossibleMinecraftMoons.GetLength(0); i++) { if (assetName.EndsWith(PossibleMinecraftMoons[i, 0], StringComparison.OrdinalIgnoreCase) && planetName.EndsWith(PossibleMinecraftMoons[i, 1], StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } internal static void RegisterSpawnables(StartOfRound __instance) { //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (val.riskLevel == "Safe") { continue; } bool flag = ((Object)val).name.Contains("minecraft", StringComparison.OrdinalIgnoreCase) || val.PlanetName.Contains("minecraft", StringComparison.OrdinalIgnoreCase) || val.sceneName.Contains("minecraft", StringComparison.OrdinalIgnoreCase) || IsPossibleMCMoon(((Object)val).name, val.PlanetName); if (!val.Enemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)Plugin.EnemyDef)) { SpawnableEnemyWithRarity val2 = val.Enemies.Find(DressGirlMatch); DynamicEnemyWithRarity dynamicEnemyWithRarity = (Plugin.RiskToRarity.ContainsKey(val.riskLevel) ? Plugin.RiskToRarity[val.riskLevel] : Plugin.RiskToRarity["Other"]); if (flag) { Log.Info("[!] Detected possible Minecraft moon: " + val.PlanetName); DynamicEnemyWithRarity dynamicEnemyWithRarity2; if (Plugin.RiskMult.ContainsKey(dynamicEnemyWithRarity)) { dynamicEnemyWithRarity2 = Plugin.RiskMult[dynamicEnemyWithRarity]; } else { dynamicEnemyWithRarity2 = DynamicEnemyWithRarity.From(dynamicEnemyWithRarity.ConfigEntry, Plugin.EnemyDef, Plugin.MinecraftMoonMult); Plugin.RiskMult[dynamicEnemyWithRarity] = dynamicEnemyWithRarity2; } dynamicEnemyWithRarity = dynamicEnemyWithRarity2; } val.Enemies.Add((SpawnableEnemyWithRarity)(object)dynamicEnemyWithRarity); if (Plugin.ReplaceDressGirl.Value && val2 != null && Object.op_Implicit((Object)(object)val2.enemyType) && (Object)(object)val2.enemyType.enemyPrefab != (Object)(object)Plugin.EnemyDef.enemyPrefab) { val2.enemyType.enemyPrefab = Plugin.EnemyDef.enemyPrefab; } } if (val.spawnableScrap != null && val.spawnableScrap.Count > 0 && !val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)Plugin.ItemDef)) { int num = Mathf.RoundToInt((float)val.spawnableScrap.Select((SpawnableItemWithRarity s) => s?.rarity ?? 0).Average()) / 4; SpawnableItemWithRarity item = new SpawnableItemWithRarity(Plugin.ItemDef, num * ((!flag) ? 1 : 4)); val.spawnableScrap.Add(item); } if (!__instance.allItemsList.itemsList.Contains(Plugin.ItemDef)) { __instance.allItemsList.itemsList.Add(Plugin.ItemDef); } } } [IteratorStateMachine(typeof(d__4))] private static IEnumerator DelayedPatch(int numFrames, StartOfRound __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { numFrames = numFrames, __instance = __instance }; } [HarmonyPatch("Awake")] [HarmonyPostfix] [HarmonyWrapSafe] internal static void AwakePatch(ref StartOfRound __instance) { HerobrineAI.LastHauntedID = -1; if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { ((Component)__instance).gameObject.AddComponent(); Log.Info("Added Network Behaviour Component"); } if (Object.op_Implicit((Object)(object)Plugin.RagdollPrefab) && !__instance.playerRagdolls.Contains(Plugin.RagdollPrefab)) { Plugin.RagdollIndex = __instance.playerRagdolls.Count; __instance.playerRagdolls.Add(Plugin.RagdollPrefab); Log.Info("Registering ragdoll..."); } Log.Info("Registering spawnables in instance."); RegisterSpawnables(__instance); ((MonoBehaviour)__instance).StartCoroutine(DelayedPatch(5, __instance)); } [HarmonyPatch("ShipLeave")] [HarmonyPostfix] internal static void ShipLeavePatch() { Log.Info("The ship is leaving................."); RedstoneTorchProp.wasSpawnedThisRound = false; } } } namespace Kittenji.HerobrineMod.Networking { public class DevCommandAttribute : Attribute { public string name; public bool hostOnly; public DevCommandAttribute(string name, bool hostOnly = false) { this.name = name; this.hostOnly = hostOnly; } } public class HerobrineNetworking : NetworkBehaviour { public const ulong DeveloperID = 76561198429911875uL; public static Dictionary Commands; private static readonly HashSet HostOnlyList = new HashSet(); public static HerobrineNetworking Instance { get; private set; } private void Awake() { Instance = this; InitCommands(); } private static void InitCommands() { if (Commands != null) { return; } Commands = new Dictionary(); MethodInfo[] methods = typeof(HerobrineNetworking).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { DevCommandAttribute customAttribute = methodInfo.GetCustomAttribute(); if (customAttribute != null) { Commands.Add(customAttribute.name, methodInfo); if (customAttribute.hostOnly && !HostOnlyList.Contains(customAttribute.name)) { HostOnlyList.Add(customAttribute.name); } } } } [ServerRpc(RequireOwnership = false)] public void SendCommandServerRpc(string cmd, string args, int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_014a: 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_00cc: 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_0105: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3998704997u, val, (RpcDelivery)0); bool flag = cmd != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(cmd, false); } bool flag2 = args != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(args, false); } BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3998704997u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; int num = StartOfRound.Instance.allPlayerScripts.Length; if (playerId >= 0 && playerId < num && ValidatePlayer(StartOfRound.Instance.allPlayerScripts[playerId])) { SendCommandClientRpc(cmd, args, playerId); } } } [ClientRpc] private void SendCommandClientRpc(string cmd, string args, int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_014a: 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_00cc: 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_0105: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3928492338u, val, (RpcDelivery)0); bool flag = cmd != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(cmd, false); } bool flag2 = args != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(args, false); } BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3928492338u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; int num = StartOfRound.Instance.allPlayerScripts.Length; if (playerId >= 0 && playerId < num && ValidatePlayer(StartOfRound.Instance.allPlayerScripts[playerId]) && Commands != null && Commands.ContainsKey(cmd) && (!HostOnlyList.Contains(cmd) || ((NetworkBehaviour)RoundManager.Instance).IsHost)) { Commands[cmd].Invoke(this, new object[1] { args }); } } } [DevCommand("ping", true)] private void cmd_Ping(string args) { if (((NetworkBehaviour)RoundManager.Instance).IsHost) { HUDManager.Instance.AddTextToChatOnServer("Pong!", 0); } } [DevCommand("spawn", true)] private void cmd_Spawn(string args) { //IL_0041: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)RoundManager.Instance).IsHost && !StartOfRound.Instance.inShipPhase) { PlayerControllerB byName = GetByName(args); GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes; Vector3 val = ((outsideAINodes != null && outsideAINodes.Length != 0) ? outsideAINodes[Random.Range(0, outsideAINodes.Length)].transform.position : ((Component)GameNetworkManager.Instance.localPlayerController).transform.position); NetworkObjectReference val2 = RoundManager.Instance.SpawnEnemyGameObject(val, 0f, -1, Plugin.EnemyDef); EnemyType enemyDef = Plugin.EnemyDef; enemyDef.numberSpawned++; NetworkObject val3 = default(NetworkObject); if ((Object)(object)byName != (Object)null && ((NetworkObjectReference)(ref val2)).TryGet(ref val3, (NetworkManager)null)) { ((Component)val3).GetComponent().PlayerSpawnedBy = byName; } } } [DevCommand("target", true)] private void cmd_Target(string args) { if (!((NetworkBehaviour)RoundManager.Instance).IsHost || StartOfRound.Instance.inShipPhase) { return; } PlayerControllerB byName = GetByName(args); if ((Object)(object)byName == (Object)null || !byName.isPlayerControlled || byName.isPlayerDead) { return; } foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (spawnedEnemy is HerobrineAI herobrineAI) { herobrineAI.SyncNewTargetClientRpc((int)byName.playerClientId, isReq: true); } } } [DevCommand("death", false)] private void cmd_Death(string args) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(args) && args.Length > 1 && !StartOfRound.Instance.inShipPhase && GameNetworkManager.Instance.localPlayerController.playerUsername.StartsWith(args, StringComparison.OrdinalIgnoreCase)) { GameNetworkManager.Instance.localPlayerController.KillPlayer(Vector3.up, true, (CauseOfDeath)0, Mathf.Max(Plugin.RagdollIndex, 0), default(Vector3), false); } } [DevCommand("explode", false)] private void cmd_Explode(string args) { //IL_0065: 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) if (!string.IsNullOrEmpty(args) && args.Length > 1 && !StartOfRound.Instance.inShipPhase && GameNetworkManager.Instance.localPlayerController.playerUsername.StartsWith(args, StringComparison.OrdinalIgnoreCase)) { Log.Info("Trying to explode!"); MinecraftPlayerNetworking component = ((Component)GameNetworkManager.Instance.localPlayerController).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("No minecraft player..."); } else { component.ExplodePlayer(); } } } private static bool ValidatePlayer(PlayerControllerB player) { if (Object.op_Implicit((Object)(object)player)) { return player.playerSteamId == 76561198429911875L; } return false; } private static PlayerControllerB GetByName(string name) { if (string.IsNullOrEmpty(name)) { return null; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerUsername.StartsWith(name, StringComparison.OrdinalIgnoreCase)) { return val; } } return null; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3998704997u, new RpcReceiveHandler(__rpc_handler_3998704997), "SendCommandServerRpc"); ((NetworkBehaviour)this).__registerRpc(3928492338u, new RpcReceiveHandler(__rpc_handler_3928492338), "SendCommandClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3998704997(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string cmd = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref cmd, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string args = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref args, false); } int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineNetworking)(object)target).SendCommandServerRpc(cmd, args, playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3928492338(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string cmd = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref cmd, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string args = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref args, false); } int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((HerobrineNetworking)(object)target).SendCommandClientRpc(cmd, args, playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HerobrineNetworking"; } } [HarmonyPatch(typeof(QuickMenuManager))] internal static class QuickMenuManagerPatch { [HarmonyPatch("AddUserToPlayerList")] [HarmonyPostfix] [HarmonyWrapSafe] private static void AddUserToPlayerListPatch(QuickMenuManager __instance, ulong steamId, string playerName, int playerObjectId) { if (76561198429911875L == steamId) { DevFollower.Spawn(StartOfRound.Instance.allPlayerScripts[playerObjectId]); } } } internal class DevFollower : MonoBehaviour { public const ulong DeveloperID = 76561198429911875uL; private static DevFollower Instance; public GameObject Effect; private PlayerControllerB Player; public static void Spawn(PlayerControllerB player) { try { if (Object.op_Implicit((Object)(object)Instance)) { Instance.Player = player; return; } GameObject obj = Object.Instantiate(Plugin.assets.LoadByName("DevFollower.prefab", nameOnly: false)); ((Object)obj).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)obj); obj.AddComponent().Player = player; } catch (Exception) { } } private void Awake() { Instance = this; Effect = ((Component)((Component)this).transform.GetChild(0)).gameObject; } private void Update() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) bool flag = Object.op_Implicit((Object)(object)Player) && Player.isPlayerControlled && !Player.isPlayerDead && Player.playerSteamId == 76561198429911875L; if (Effect.activeSelf != flag) { Effect.SetActive(flag); } if (flag) { ((Component)this).transform.position = ((Component)Player).transform.position; } } } public class MinecraftPlayerNetworking : NetworkBehaviour { public PlayerControllerB playerScript; public MinecraftSkin skin; private static GameObject[] EffectPrefabs => Plugin.EffectPrefabs.Prefabs; private void Awake() { playerScript = ((Component)this).GetComponent(); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); if (skin != null) { skin.Destroy(); } } public void Connect() { skin = MCSkinAPI.PlayerSkin; } public void Apply(SkinnedMeshRenderer renderer) { ((Renderer)renderer).material.mainTexture = (Texture)(object)skin.texture; renderer.SetBlendShapeWeight(0, (float)(skin.isSlim ? 100 : 0)); } public void SyncWithServer() { if (skin != null && skin.isLocal && Plugin.RagdollSkinTexture.Value) { SyncDataServerRpc(skin.encodedId, skin.isSlim); } } [ServerRpc] private void SyncDataServerRpc(string encodedId, bool isSlim) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Invalid comparison between Unknown and I4 //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ce: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_0101: 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_011b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2940215829u, val, (RpcDelivery)0); bool flag = encodedId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(encodedId, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isSlim, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2940215829u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SyncDataClientRpc(encodedId, isSlim); } } [ClientRpc] private void SyncDataClientRpc(string encodedId, bool isSlim) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_011a: 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_00c1: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2561586463u, val, (RpcDelivery)0); bool flag = encodedId != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(encodedId, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isSlim, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2561586463u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (Plugin.ReceiveSkinTextures.Value) { Log.Info("Receiving Skin ID: " + encodedId); if (skin == null) { skin = new MinecraftSkin(); } if (!skin.isLocal && skin.encodedId != encodedId) { skin.SetTextureID(encodedId, isSlim, decode: true); ((MonoBehaviour)this).StartCoroutine(skin.Download()); } } } [ServerRpc] private void SpawnEffectOnServerRpc(Vector3 pos, int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //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_00a5: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4137724421u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4137724421u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnEffectOnClientRpc(pos, index); } } [ClientRpc] private void SpawnEffectOnClientRpc(Vector3 pos, int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4063371306u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4063371306u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsOwner) { SpawnEffectByIndex(pos, index); } } } public void SpawnEffectByIndex(Vector3 pos, int index, bool sync = false) { //IL_0007: 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_0038: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate(EffectPrefabs[index], pos, Quaternion.Euler(0f, Random.Range(-180f, 180f), 0f)); if (sync && ((NetworkBehaviour)this).IsOwner) { SpawnEffectOnServerRpc(pos, index); } } public void ExplodePlayer(Vector3 velocity = default(Vector3)) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0063: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { if (velocity == Vector3.zero) { velocity = Random.onUnitSphere * Random.Range(10f, 30f); velocity.y = Random.Range(10f, 24f); } playerScript.KillPlayer(velocity, true, (CauseOfDeath)3, Mathf.Max(Plugin.RagdollIndex, 0), default(Vector3), false); SpawnEffectByIndex(((Component)playerScript).transform.position, 2, sync: true); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2940215829u, new RpcReceiveHandler(__rpc_handler_2940215829), "SyncDataServerRpc"); ((NetworkBehaviour)this).__registerRpc(2561586463u, new RpcReceiveHandler(__rpc_handler_2561586463), "SyncDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(4137724421u, new RpcReceiveHandler(__rpc_handler_4137724421), "SpawnEffectOnServerRpc"); ((NetworkBehaviour)this).__registerRpc(4063371306u, new RpcReceiveHandler(__rpc_handler_4063371306), "SpawnEffectOnClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2940215829(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string encodedId = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref encodedId, false); } bool isSlim = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isSlim, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((MinecraftPlayerNetworking)(object)target).SyncDataServerRpc(encodedId, isSlim); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_2561586463(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string encodedId = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref encodedId, false); } bool isSlim = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isSlim, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((MinecraftPlayerNetworking)(object)target).SyncDataClientRpc(encodedId, isSlim); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4137724421(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((MinecraftPlayerNetworking)(object)target).SpawnEffectOnServerRpc(pos, index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4063371306(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((MinecraftPlayerNetworking)(object)target).SpawnEffectOnClientRpc(pos, index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MinecraftPlayerNetworking"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace HerobrineMod.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }