Decompiled source of Football v1.1.11
BepInEx/plugins/FootballEntity.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using EmotesAPI; using FootballEntity.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using Kittenji.FootballEntity.Compatibility; using Kittenji.FootballEntity.Language; using Kittenji.FootballEntity.SimonSays; using Kittenji.FootballEntity.SimonSays.Actions; using Kittenji.FootballEntity.Visualizer; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("Kittenji")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dce4011a3e674367fbc3b969732c6526cbbdbaa3")] [assembly: AssemblyProduct("FootballEntity")] [assembly: AssemblyTitle("FootballEntity")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 KUtility { internal static T InstantiateComponent<T>(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<T>(); } 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<Type> 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("<details><summary>Available Config Variables</summary>"); stringBuilder.AppendLine(); stringBuilder.AppendLine("| Settings | Value Type | Default Value | Description | Acceptable Values |"); stringBuilder.AppendLine("|-|-|-|-|-|"); foreach (IGrouping<string, KeyValuePair<ConfigDefinition, ConfigEntryBase>> item in from v in (IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)Config group v by v.Key.Section) { stringBuilder.AppendLine("| **" + item.Key + "** | - | - | - | - |"); foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> 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", "<br>")); 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<string> val) { string[] names = val.AcceptableValues; foreach (string text2 in names) { stringBuilder.Append(" `" + text2 + "`"); } } } else { stringBuilder.Append(" -"); } stringBuilder.AppendLine(" |"); } } stringBuilder.AppendLine(); stringBuilder.AppendLine("</details>"); 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<CompatibleDependencyAttribute>()) { 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<int> Register(this ConfigEntry<int> entry, int min, int max, bool requireRestart = false) { AddSlider(entry, min, max, requireRestart); return entry; } public static ConfigEntry<int> Register(this ConfigEntry<int> entry, bool requireRestart = false) { AddInt(entry, requireRestart); return entry; } public static ConfigEntry<bool> Register(this ConfigEntry<bool> entry, bool requireRestart = false) { AddToggle(entry, requireRestart); return entry; } public static ConfigEntry<string> Register(this ConfigEntry<string> entry, bool requireRestart = false) { AddTextInput(entry, requireRestart); return entry; } public static void AddSlider(ConfigEntry<int> entry, int min, int max, bool requireRestart = false) { if (Enabled) { AddSliderInternal(entry, min, max, requireRestart); } } public static void AddInt(ConfigEntry<int> entry, bool requireRestart = false) { if (Enabled) { AddIntInternal(entry, requireRestart); } } public static void AddToggle(ConfigEntry<bool> entry, bool requireRestart = false) { if (Enabled) { AddToggleInternal(entry, requireRestart); } } public static void AddTextInput(ConfigEntry<string> 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<int> 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<int>)val).Min = min; ((BaseRangeOptions<int>)val).Max = max; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry, val)); } private static void AddIntInternal(ConfigEntry<int> 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<bool> 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<string> 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<GameObject> m_Prefabs = new HashSet<GameObject>(); 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<T>(string name) where T : Object { if (name == null) { return default(T); } return mainAssetBundle.LoadAsset<T>(name); } public T LoadByName<T>(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<T>(name2); } } internal class DynamicEnemyWithRarity : SpawnableEnemyWithRarity { public ConfigEntry<int> Multiplier; public ConfigEntry<int> ConfigEntry { get; private set; } public static DynamicEnemyWithRarity From(ConfigEntry<int> config, EnemyType enemyDef, ConfigEntry<int> mult = null) { DynamicEnemyWithRarity dynamicEnemyWithRarity = new DynamicEnemyWithRarity { 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.FootballEntity { public class FootballAI : EnemyAI { public struct WeightedInfo { public int weight; public int index; } public static int LastHauntedID = -1; private static FootballAI Instance; private static ManualLogSource Logger; [Header("Custom Entity")] public Transform[] VisiblePoints; public SkinnedMeshRenderer MainRenderer; public Material IdleMaterial; public Material TalkMaterial; public float AgentSpeed = 6f; [Header("Entity Rig")] public BoxCollider EntityHitbox; public BoxCollider ScanNodeHitbox; public Transform TurnCompass; public StateInfo[] StateInfos; [Header("Audio Clips")] public AudioSource AudioSFX; [Header("Simon Says")] public AudioClip[] VoiceTargets; private bool IsSpecialTarget; public int lastGiggle; public AudioClip AudioRight; public AudioClip AudioWrong; public AudioClip AudioStart; public Transform PlayerFollower; public AudioSource MusicSource; public AudioClip[] MusicClips; public SSActionInfo[] ActionInfos; private List<WeightedInfo> m_Infos = new List<WeightedInfo>(); private List<WeightedInfo> m_Temp = new List<WeightedInfo>(); private Vector2Int SSActionCount = new Vector2Int(3, 7); private Vector2Int SSActionAdd = new Vector2Int(1, 3); private int CurrentCount; private SSActionInfo[] CurrentActions; private int CurrentIndex; private int CurrentAdd; private bool PlayTutorial = true; private bool isSpeaking; private float sampleTime; private bool isDistanced; private bool isNextTarget; private SSActionInfo currentAction; private Coroutine SimonSaysCoroutine; private static Dictionary<AudioClip, float[]> AudioClipSampleData = new Dictionary<AudioClip, float[]>(); private bool lastVisibility; private bool isHauntingLocal; private float lastTargetRequestServer; private int lastTargetIndex = -1; private bool lastTargetWasRequested; private Coroutine waitForInitCr; private bool wasHauntedLast; private int stateActionCounter; private float stateActionTimer; private float stateActionTimeout; private bool seenByPlayer; private bool stateBusy; private bool stareFailed; private int totalTimesSeen; private float stateStartTime; private StateInfo currentStateInfo; private const float playerFOV = 60f; private float currentAgentSpeed; private float relocateTimer; private Random entityRandom; public GameObject antiCheatObj; public PlayerControllerB hauntingPlayer; private bool hauntingLocalPlayer; private GameObject[] outsideNodes; private NavMeshHit navHit; private bool IsInitialized; private Vector3 currentPoint; private bool isNavStuck; private float navTimeout; public GameObject[] EffectPrefabs; private static EntranceTeleport EntranceTP_Outside; private static EntranceTeleport EntranceTP_Inside; public PlayerControllerB PlayerSpawnedBy { get; set; } private float stateTime => Time.time - stateStartTime; public AudioClip GetRandomGiggle() { AudioClip[] audio = Lang.Get("SS_GIGGLE").Audio; int num = Random.Range(0, audio.Length); if (num == lastGiggle) { num = (num + 1) % audio.Length; } lastGiggle = num; return audio[num]; } private static AudioClip GetRandomClip(AudioClip[] clips) { return clips[Random.Range(0, clips.Length)]; } public void PlayRandomMusicSync(bool start = true) { int num = MusicClips.Length - 1; int num2 = (start ? Random.Range(0, (!Plugin.StreamerMode.Value) ? num : 0) : (-1)); if (num2 > -1 && Random.Range(0, 100) < 2) { num2 = num; } PlayMusicLocal(num2); } [ServerRpc] private void PlayMusicServerRpc(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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //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_00b7: 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_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(3736966122u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3736966122u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayMusicClientRpc(index); } } [ClientRpc] private void PlayMusicClientRpc(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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1544376578u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1544376578u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner) { PlayMusicLocal(index); } } } private void PlayMusicLocal(int index, bool sync = true) { Log.Info("Playing music index: " + index); if (((NetworkBehaviour)this).IsOwner && sync) { PlayMusicServerRpc(index); } if (Plugin.StreamerMode.Value && index > -1) { index = ((index >= MusicClips.Length - 1) ? index : 0); } if (MusicSource.isPlaying) { MusicSource.Stop(); } if (index < 0) { SSDisplayUI.SetSong(null); return; } AudioClip val = MusicClips[index]; MusicSource.loop = ((Object)val).name.Contains("loop", StringComparison.OrdinalIgnoreCase); MusicSource.clip = val; MusicSource.Play(); SSDisplayUI.SetSong(((Object)val).name.Replace("_loop", string.Empty), MusicSource); } public int GetWeightIndex(List<WeightedInfo> 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 SSActionInfo GetWeightedAction() { m_Temp.Clear(); m_Temp.AddRange(m_Infos); SSActionInfo sSActionInfo; while (true) { int weightIndex = GetWeightIndex(m_Temp); if (weightIndex < 0) { return null; } sSActionInfo = ActionInfos[m_Temp[weightIndex].index]; if (sSActionInfo.IsValid(this) && (sSActionInfo.AllowDuplicate || !CurrentActions.Contains(sSActionInfo))) { break; } m_Temp.RemoveAt(weightIndex); } return sSActionInfo; } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); SSDisplayUI.SetVisible(value: false); ResetSimonSays(); if (Object.op_Implicit((Object)(object)antiCheatObj)) { Object.Destroy((Object)(object)antiCheatObj); } } private void State_Playing() { if (!isDistanced) { UpdateBodyRotation(); } bool flag = base.creatureVoice.isPlaying; if (flag && AudioClipSampleData.ContainsKey(base.creatureVoice.clip)) { if (Time.time < sampleTime) { return; } flag = Mathf.Abs(AudioClipSampleData[base.creatureVoice.clip][base.creatureVoice.timeSamples * base.creatureVoice.clip.channels] * 100f) > 0.1f; sampleTime = Time.time + 0.1f; } if (isSpeaking != flag) { isSpeaking = flag; ((Renderer)MainRenderer).sharedMaterial = (isSpeaking ? TalkMaterial : IdleMaterial); } } private void ResetSimonSays() { if (SimonSaysCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(SimonSaysCoroutine); } PlayMusicLocal(-1, sync: false); if ((Object)(object)currentAction != (Object)null) { currentAction.OnEnd(this); currentAction = null; } } private void ActionFailed() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) SwitchState(0); hauntingPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 1, default(Vector3)); } private IEnumerator SimonSaysGame() { LanguageToken languageToken = Lang.Get("SS_START"); SSDisplayUI.SetText(languageToken.Text, languageToken.Info); if (PlayTutorial) { PlayTutorial = false; yield return PlayLangAudioAndWait("SS_START", 0); } yield return PlayLangAudioAndWait("SS_START", 1); SSDisplayUI.SetVisible(value: false); bool isFailed = false; for (int i = 0; i < CurrentCount; i++) { SSActionInfo action = CurrentActions[i]; if (!action.IsValid(this)) { continue; } action.OnInit(); yield return PlayAudioAndWait(AudioStart, 0f, base.creatureSFX); bool playedIntro = i == 0 || action.ForceVoiceIntro || Random.Range(0, 100) > 30; if (playedIntro) { yield return PlayLangAudioAndWait("SS_INTRO"); } else if (Random.Range(0, 100) < 40) { yield return PlayLangAudioAndWait("SS_INTRO_FAKE"); } else { yield return (object)new WaitForSeconds((float)Random.Range(0, 1)); } SSDisplayUI.SetText(action.Message, action.DisplayTime ? string.Empty : action.Help); if (action.EmoteIndex > 0) { base.creatureAnimator.SetInteger("Emote", action.EmoteIndex); } action.OnAwake(this); yield return PlayLangAudioAndWait(action.LangKey, -1, action.Delay); currentAction = action; action.OnStart(this); float startTime = Time.time + action.Duration; int seconds = -1; do { yield return null; if (action.DisplayTime) { int num = Mathf.FloorToInt(startTime - Time.time); if (seconds != num) { string help = action.Help; int num2; seconds = (num2 = num); SSDisplayUI.SetDesc(string.Format(help, num2)); SSDisplayUI.Ping((float)Mathf.Min(num, 4) / 4f + 0.25f); } } } while (!(Time.time > startTime) && !action.OnUpdate(this) && hauntingPlayer.isPlayerControlled && !hauntingPlayer.isPlayerDead); bool followedOrders = action.OnEnd(this); currentAction = null; SSDisplayUI.SetVisible(value: false); base.creatureAnimator.SetInteger("Emote", 0); Logger.LogInfo((object)("SS Action: " + ((Object)action).name)); Logger.LogInfo((object)("Should Obey: " + playedIntro)); Logger.LogInfo((object)("Followed Orders: " + followedOrders)); if (followedOrders != playedIntro) { isFailed = true; if (Random.Range(0, 100) < 10) { yield return PlayAudioAndWait(GetRandomGiggle()); } yield return PlayLangAudioAndWait("SS_END_LOSER"); yield return PlayAudioAndWait(Object.op_Implicit((Object)(object)action.AudioOverrideFailure) ? action.AudioOverrideFailure : AudioWrong, 0f, base.creatureSFX); ActionFailed(); break; } if (Random.Range(0, 100) < 8) { yield return PlayAudioAndWait(GetRandomGiggle()); } yield return PlayAudioAndWait(Object.op_Implicit((Object)(object)action.AudioOverrideSuccess) ? action.AudioOverrideSuccess : AudioRight, 0f, base.creatureSFX); if (followedOrders && action.CanEndGame) { break; } } if (!isFailed) { yield return PlayLangAudioAndWait("SS_END_WINNER"); } yield return PlayAudioAndWait(GetRandomGiggle()); SpawnEffectByIndex(((Component)this).transform.position, 0); SwitchState(1, 10f); Logger.LogInfo((object)"Player won Simon Says event, requesting a new target."); RequestNewTargetServerRpc(); } private void StartPlaying() { Logger.LogInfo((object)"Let's play a little game"); CurrentIndex = -1; CurrentCount = Random.Range(((Vector2Int)(ref SSActionCount)).x, ((Vector2Int)(ref SSActionCount)).y) + CurrentAdd; CurrentAdd += Random.Range(((Vector2Int)(ref SSActionAdd)).x, ((Vector2Int)(ref SSActionAdd)).y); CurrentActions = new SSActionInfo[CurrentCount]; for (int i = 0; i < CurrentCount; i++) { CurrentActions[i] = GetWeightedAction(); } SwitchState(3); SetEnemyVisible(enable: true); SSDisplayUI.SetVisible(value: false); if (SimonSaysCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(SimonSaysCoroutine); } SimonSaysCoroutine = ((MonoBehaviour)this).StartCoroutine(SimonSaysGame()); antiCheatObj.SetActive(false); } private WaitForSeconds PlayAudioAndWait(AudioClip clip, float add = 0f, AudioSource source = null) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if ((Object)(object)clip == (Object)null) { return null; } bool flag = false; if ((Object)(object)source == (Object)null) { source = base.creatureVoice; flag = true; } if (source.isPlaying) { source.Stop(); } source.clip = clip; if (flag && !AudioClipSampleData.ContainsKey(clip)) { float[] array = new float[clip.samples * clip.channels]; clip.GetData(array, 0); AudioClipSampleData.Add(clip, array); } source.Play(); return new WaitForSeconds(clip.length + add); } private WaitForSeconds PlayLangAudioAndWait(string key, int audioInd = -1, float add = 0f, AudioSource source = null) { LanguageToken languageToken = Lang.Get(key); string key2 = languageToken.Parent.Key; if (audioInd < 0) { audioInd = languageToken.GetRandomAudioIndex(); } AudioClip audio = languageToken.GetAudio(audioInd); if (Object.op_Implicit((Object)(object)audio)) { PlayLangAudioServerRpc(key2, key, audioInd); } return PlayAudioAndWait(audio, add, source); } [ServerRpc] private void PlayLangAudioServerRpc(string lang, string key, int ind) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Invalid comparison between Unknown and I4 //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_010c: 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_0133: 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) 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(1118763606u, val, (RpcDelivery)0); bool flag = lang != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(lang, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(key, false); } BytePacker.WriteValueBitPacked(val2, ind); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1118763606u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayLangAudioClientRpc(lang, key, ind); } } [ClientRpc] private void PlayLangAudioClientRpc(string lang, string key, int ind) { //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_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) //IL_019f: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(788754222u, val, (RpcDelivery)0); bool flag = lang != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(lang, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(key, false); } BytePacker.WriteValueBitPacked(val2, ind); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 788754222u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || ((NetworkBehaviour)this).IsOwner) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && localPlayerController.isPlayerDead && localPlayerController.hasBegunSpectating && Object.op_Implicit((Object)(object)localPlayerController.spectatedPlayerScript) && ((Object)(object)localPlayerController.spectatedPlayerScript == (Object)(object)hauntingPlayer || Vector3.Distance(((Component)localPlayerController.spectatedPlayerScript).transform.position, ((Component)hauntingPlayer).transform.position) < 10f)) { AudioClip audio = Lang.Get(lang, key).GetAudio(ind); if (Object.op_Implicit((Object)(object)audio)) { PlayAudioAndWait(audio); } } } private void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_00c6: 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_00f0: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Instance)) { ((Component)this).gameObject.SetActive(false); return; } Instance = this; if (Logger == null) { Logger = new ManualLogSource("FootballAI"); Logger.Sources.Add((ILogSource)(object)Logger); } Logger.LogInfo((object)"Football says hi!"); for (int i = 0; i < ActionInfos.Length; i++) { SSActionInfo sSActionInfo = ActionInfos[i]; sSActionInfo.InitActionListener(); m_Infos.Add(new WeightedInfo { index = i, weight = sSActionInfo.Weight }); } CurrentActions = new SSActionInfo[0]; antiCheatObj.transform.parent = null; antiCheatObj.transform.position = Vector3.zero; antiCheatObj.transform.rotation = Quaternion.identity; antiCheatObj.transform.localScale = Vector3.one; antiCheatObj.SetActive(false); } [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_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(2987807880u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2987807880u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Logger.LogInfo((object)"Football wants a new target to play with."); SetNewTargetOnServer(requested: true); } } private void SetNewTargetOnServer(bool requested) { if (!((NetworkBehaviour)this).IsServer || Time.unscaledTime < lastTargetRequestServer) { return; } Logger.LogInfo((object)"Requesting new target."); if (entityRandom == null) { entityRandom = new Random(StartOfRound.Instance.randomMapSeed + 304); } float num = 0f; int num2 = 0; PlayerStats[] allPlayerStats = StartOfRound.Instance.gameStats.allPlayerStats; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num3 = Mathf.Min(allPlayerStats.Length, allPlayerScripts.Length); for (int i = 0; i < num3; i++) { if (allPlayerStats[i].turnAmount > num2) { num2 = allPlayerStats[i].turnAmount; } if (allPlayerScripts[i].insanityLevel > num) { num = allPlayerScripts[i].insanityLevel; } } int[] array = new int[num3]; for (int i = 0; i < num3; 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 (!val.isInHangarShipRoom) { array[i] += 20; } if (val.isInsideFactory) { array[i] += 20; } if (val.playerUsername.Equals("SaltySandi", StringComparison.OrdinalIgnoreCase)) { array[i] += 50; } if (!requested && LastHauntedID == (int)val.playerClientId) { array[i] = 1; } if (requested && lastTargetIndex == i) { array[i] = 1; Logger.LogMessage((object)("Ignoring last target: " + lastTargetIndex)); } } int num4 = GetRandomIndexFromWeights(array); hauntingPlayer = allPlayerScripts[num4]; if (hauntingPlayer.isPlayerDead) { for (int j = 0; j < allPlayerScripts.Length; j++) { if (!allPlayerScripts[j].isPlayerDead) { hauntingPlayer = allPlayerScripts[j]; num4 = j; break; } } } Logger.LogInfo((object)("New target: " + (object)hauntingPlayer)); if (hauntingPlayer.isPlayerControlled) { lastTargetIndex = num4; SyncNewTargetClientRpc((int)hauntingPlayer.playerClientId, requested); if (!isNextTarget) { LastHauntedID = num4; isNextTarget = true; } } PlayerSpawnedBy = null; lastTargetRequestServer = Time.unscaledTime + 10f; } [ClientRpc] private 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(118545674u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, id); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isReq, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 118545674u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { lastTargetWasRequested = isReq; Logger.LogInfo((object)("Received target from server: " + id)); ((EnemyAI)this).ChangeOwnershipOfEnemy((hauntingPlayer = StartOfRound.Instance.allPlayerScripts[id]).actualClientId); if (!IsInitialized && waitForInitCr != null) { Logger.LogInfo((object)"Not initialized"); waitForInitCr = ((MonoBehaviour)this).StartCoroutine(CheckAfterInit()); } else { CheckHauntingLocal(); } } } private IEnumerator CheckAfterInit() { while (!IsInitialized) { yield return null; } CheckHauntingLocal(); waitForInitCr = null; } private void CheckHauntingLocal() { hauntingLocalPlayer = (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)hauntingPlayer; SetEnemyVisible(enable: false); ((EnemyAI)this).SetClientCalculatingAI(hauntingLocalPlayer); SwitchState(0); string username; if (Object.op_Implicit((Object)(object)hauntingPlayer)) { if (hauntingLocalPlayer) { username = hauntingPlayer.playerUsername; Logger.LogInfo((object)("Haunting local player: " + username)); bool flag = VoiceTargets.Any(specialMatch); if (IsSpecialTarget != flag && flag) { IsSpecialTarget = flag; Logger.LogInfo((object)("Is special target: " + IsSpecialTarget)); int num = Mathf.Clamp(Array.FindIndex(VoiceTargets, specialMatch), 0, VoiceTargets.Length - 1); int num2 = Mathf.Clamp(Array.FindLastIndex(VoiceTargets, specialMatch) + 1, num, VoiceTargets.Length); base.creatureVoice.PlayOneShot(VoiceTargets[Random.Range(num, num2)]); } if (lastTargetWasRequested) { Logger.LogInfo((object)"Haunting local was requested!"); SwitchState(1, wasHauntedLast ? 30 : 0); } } else { Logger.LogInfo((object)("Haunting remote player: " + hauntingPlayer.playerUsername)); } } wasHauntedLast = hauntingLocalPlayer; bool specialMatch(AudioClip v) { return ((Object)v).name.StartsWith(username, StringComparison.OrdinalIgnoreCase); } } 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 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); } 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025c: 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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; if (stateBusy) { UpdateBodyRotation(); if (!seenByPlayer && PlayerCanSeeEntity()) { seenByPlayer = true; hauntingPlayer.JumpToFearLevel(0.3f, true); stateActionTimer = currentStateInfo.GetStaring(); stateActionTimeout = currentStateInfo.GetRange(); currentStateInfo.PlayRandomVanishClip(AudioSFX); totalTimesSeen++; if (Random.Range(0, 100) < 40) { base.creatureVoice.PlayOneShot(GetRandomGiggle()); } } 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) { if (Random.Range(0, 100) < 80) { MessWithLightsServerRpc(); RoundManager.Instance.FlickerLights(true, true); } SwitchState(base.currentBehaviourStateIndex + 1); hauntingPlayer.JumpToFearLevel(1f, true); } else { SetEnemyVisible(enable: false); if (seenByPlayer && Random.Range(0, 100) < (isCreeping ? 40 : 15)) { RoundManager.Instance.FlickerLights(true, true); MessWithLightsServerRpc(); } } } 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_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_0099: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0110: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float num = Vector3.Distance(((Component)this).transform.position, ((Component)hauntingPlayer).transform.position); if (time > stateActionTimer || num > 100f) { currentStateInfo.PlayRandomVanishClip(AudioSFX); SwitchState(1); } else { if (!(time > stateActionTimeout) || (!(num > 30f) && (!isNavStuck || !(Time.time + 2f > navTimeout)))) { return; } if (!hauntingPlayer.HasLineOfSightToPosition(base.eye.position, 70f, 100, 2f) || isNavStuck) { Vector3 val = Vector3.zero; if ((val == Vector3.zero && num > 8f) || isNavStuck) { val = TryFindingHauntPosition(staringMode: false, mustBeInLOS: false, isNavStuck, isNavStuck ? 6 : 0); } if (val != Vector3.zero) { base.agent.Warp(RoundManager.Instance.GetNavMeshPosition(val, navHit, 5f, -1)); } } stateActionTimeout = currentStateInfo.GetStalking(); } } private void UpdateAgentSpeed() { //IL_0017: 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_006f: 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) if (base.currentBehaviourStateIndex == 3) { float num = Vector3.Distance(((Component)hauntingPlayer).transform.position, ((Component)this).transform.position); bool flag = num > (isDistanced ? 5f : 8.6f); if (num > 32f && relocateTimer < Time.time) { relocateTimer = Time.time + 1f; TryFindingHauntPosition(staringMode: true, mustBeInLOS: false, behindPlayer: true, 6, findNodes: false); isDistanced = false; flag = true; } if (isDistanced != flag) { isDistanced = flag; if (isDistanced) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(hauntingPlayer); } else { ((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false); } base.movingTowardsTargetPlayer = isDistanced; base.moveTowardsDestination = isDistanced; } } currentAgentSpeed = ((base.currentBehaviourStateIndex == 2) ? AgentSpeed : ((base.currentBehaviourStateIndex == 3 && isDistanced) ? (AgentSpeed * 1.5f) : 0f)); base.agent.speed = currentAgentSpeed; base.creatureAnimator.SetBool("Walk", currentAgentSpeed > float.Epsilon); } private void SwitchState(int index, float add = 0f) { Logger.LogInfo((object)("Switching State Index: " + index + " | Add: " + add)); currentStateInfo = StateInfos[index]; ResetSimonSays(); ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(index); bool flag = index == 2; stateActionTimer = currentStateInfo.GetInterval() + add; stateActionCounter = currentStateInfo.GetCounter(); stateBusy = false; SetEnemyVisible(flag); ((Renderer)MainRenderer).enabled = true; ((Renderer)MainRenderer).sharedMaterial = IdleMaterial; isSpeaking = false; base.creatureVoice.Stop(); base.creatureSFX.Stop(); if (flag) { stateActionTimeout = currentStateInfo.GetStalking(); ((EnemyAI)this).SetMovingTowardsTargetPlayer(hauntingPlayer); currentStateInfo.PlayRandomVanishClip(AudioSFX); hauntingPlayer.JumpToFearLevel(1f, true); } base.movingTowardsTargetPlayer = flag; base.moveTowardsDestination = flag; isNavStuck = false; navTimeout = 0f; isDistanced = false; stateStartTime = Time.time; UpdateAgentSpeed(); SSDisplayUI.SetVisible(value: false); base.creatureAnimator.SetInteger("Emote", 0); } private void UpdateBodyRotation() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) TurnCompass.LookAt(((Component)hauntingPlayer).transform); ((Component)this).transform.eulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, TurnCompass.eulerAngles.y, ((Component)this).transform.eulerAngles.z); } public override void Update() { //IL_00c9: 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) ((EnemyAI)this).Update(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { if (lastVisibility) { SetEnemyVisible(enable: false); } return; } if (((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex > 0 && Object.op_Implicit((Object)(object)hauntingPlayer) && (hauntingPlayer.isPlayerDead || !hauntingPlayer.isPlayerControlled || Object.op_Implicit((Object)(object)hauntingPlayer.inAnimationWithEnemy))) { SwitchState(0); } if (((NetworkBehaviour)this).IsServer && (!Object.op_Implicit((Object)(object)hauntingPlayer) || !hauntingPlayer.isPlayerControlled)) { SetNewTargetOnServer(requested: false); return; } if ((Object)(object)hauntingPlayer != (Object)null) { PlayerFollower.position = ((Component)hauntingPlayer).transform.position; PlayerFollower.rotation = ((Component)hauntingPlayer).transform.rotation; } 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; } switch (base.currentBehaviourStateIndex) { case 0: State_Stalking(); break; case 1: State_Creeping(); break; case 2: State_Chasing(); break; case 3: State_Playing(); break; default: Logger.LogError((object)("Unregistered state: " + base.currentBehaviourStateIndex)); break; } } 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); } Logger.LogInfo((object)"Has Started"); 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) 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) { isNavStuck = false; navTimeout = 0f; } } ((EnemyAI)this).SyncPositionToClients(); if (hauntingLocalPlayer != isHauntingLocal) { isHauntingLocal = hauntingLocalPlayer && (Object)(object)hauntingPlayer != (Object)null && !hauntingPlayer.isPlayerDead; if (isHauntingLocal) { Logger.LogInfo((object)"Is Haunting Local"); } } UpdateAgentSpeed(); } 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) { if (base.currentBehaviourStateIndex == 2) { StartPlaying(); } else if (stateBusy) { stateActionTimer = 0f; } } } public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false) { } private 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 > 1; antiCheatObj.SetActive(((Collider)ScanNodeHitbox).enabled); if (lastVisibility != enable && enable) { Logger.LogInfo((object)"I am now visible"); } 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) 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); } 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: 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_026b: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d5: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = (hauntingPlayer.isInsideFactory ? base.allAINodes : outsideNodes); if (array == null || array.Length == 0 || (Object)(object)array[0] == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return Vector3.zero; } 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; } private bool GetLocationFromPosition(Vector3 position, out Vector3 location, NavMeshPath path) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 1.75f, -1); if (!NavMesh.CalculatePath(((Component)hauntingPlayer).transform.position, position, -1, path)) { location = Vector3.zero; return false; } location = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, -1f, -1); return true; } [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_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(1357969639u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1357969639u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2092296283u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2092296283u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner) { RoundManager.Instance.FlickerLights(true, true); GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.2f, true); } } } [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_011c: 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)((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(2028845924u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2028845924u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { 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_00df: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1435501649u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1435501649u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner) { SpawnEffectByIndex(pos, index); } } } public void SpawnEffectByIndex(Vector3 pos, int index, bool sync = false) { //IL_0008: 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_0039: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate<GameObject>(EffectPrefabs[index], pos, Quaternion.Euler(0f, Random.Range(-180f, 180f), 0f)); if (sync && ((NetworkBehaviour)this).IsOwner) { SpawnEffectOnServerRpc(pos, index); } } public static void TryRelocatePlayer(PlayerControllerB targetPlayer, Vector3 position, bool isInside) { //IL_0051: 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) 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); } (isInside ? EntranceTP_Outside : EntranceTP_Inside).TeleportPlayer(); } ((Component)targetPlayer).transform.position = position; ((Component)targetPlayer).transform.eulerAngles = new Vector3(0f, Random.Range(-180f, 180f), 0f); HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_FootballAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3736966122u, new RpcReceiveHandler(__rpc_handler_3736966122)); NetworkManager.__rpc_func_table.Add(1544376578u, new RpcReceiveHandler(__rpc_handler_1544376578)); NetworkManager.__rpc_func_table.Add(1118763606u, new RpcReceiveHandler(__rpc_handler_1118763606)); NetworkManager.__rpc_func_table.Add(788754222u, new RpcReceiveHandler(__rpc_handler_788754222)); NetworkManager.__rpc_func_table.Add(2987807880u, new RpcReceiveHandler(__rpc_handler_2987807880)); NetworkManager.__rpc_func_table.Add(118545674u, new RpcReceiveHandler(__rpc_handler_118545674)); NetworkManager.__rpc_func_table.Add(1357969639u, new RpcReceiveHandler(__rpc_handler_1357969639)); NetworkManager.__rpc_func_table.Add(2092296283u, new RpcReceiveHandler(__rpc_handler_2092296283)); NetworkManager.__rpc_func_table.Add(2028845924u, new RpcReceiveHandler(__rpc_handler_2028845924)); NetworkManager.__rpc_func_table.Add(1435501649u, new RpcReceiveHandler(__rpc_handler_1435501649)); } private static void __rpc_handler_3736966122(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_0070: 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_009d: 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 { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((FootballAI)(object)target).PlayMusicServerRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1544376578(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((FootballAI)(object)target).PlayMusicClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1118763606(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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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<bool>(ref flag, default(ForPrimitives)); string lang = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref lang, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string key = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false); } int ind = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref ind); target.__rpc_exec_stage = (__RpcExecStage)1; ((FootballAI)(object)target).PlayLangAudioServerRpc(lang, key, ind); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_788754222(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<bool>(ref flag, default(ForPrimitives)); string lang = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref lang, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string key = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false); } int ind = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref ind); target.__rpc_exec_stage = (__RpcExecStage)2; ((FootballAI)(object)target).PlayLangAudioClientRpc(lang, key, ind); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2987807880(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; ((FootballAI)(object)target).RequestNewTargetServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_118545674(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<bool>(ref isReq, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((FootballAI)(object)target).SyncNewTargetClientRpc(id, isReq); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1357969639(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; ((FootballAI)(object)target).MessWithLightsServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2092296283(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)2; ((FootballAI)(object)target).MessWithLightsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2028845924(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; ((FootballAI)(object)target).SpawnEffectOnServerRpc(pos, index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1435501649(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)2; ((FootballAI)(object)target).SpawnEffectOnClientRpc(pos, index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "FootballAI"; } } [BepInPlugin("Kittenji.FootballEntity", "FootballEntity", "1.1.11")] [CompatibleDependency("com.weliveinasociety.CustomEmotesAPI", typeof(CustomEmotesAPI_Compatibility))] [CompatibleDependency("ainavt.lc.lethalconfig", typeof(LethalConfigUtils))] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { internal static void RegisterSpawnables(StartOfRound __instance) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)__instance)) { return; } SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val in levels) { if (val.riskLevel == "Safe") { continue; } if (!val.Enemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)EnemyDef)) { DynamicEnemyWithRarity item = (RiskToRarity.ContainsKey(val.riskLevel) ? RiskToRarity[val.riskLevel] : RiskToRarity["Other"]); val.Enemies.Add((SpawnableEnemyWithRarity)(object)item); } if (val.spawnableScrap != null && val.spawnableScrap.Count > 0 && !val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)ItemDef)) { int rarity = Mathf.RoundToInt((float)val.spawnableScrap.Select((SpawnableItemWithRarity s) => s?.rarity ?? 0).Average()) / 4; SpawnableItemWithRarity item2 = new SpawnableItemWithRarity { spawnableItem = ItemDef, rarity = rarity }; val.spawnableScrap.Add(item2); } if (!__instance.allItemsList.itemsList.Contains(ItemDef)) { __instance.allItemsList.itemsList.Add(ItemDef); } } } private static IEnumerator DelayedPatch(int numFrames, StartOfRound __instance) { int targetFrames = Time.frameCount + numFrames + 1; while (Time.frameCount < targetFrames) { yield