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+114353458759e3921bc0c10109b44811e5602af8")]
[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]
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 DynamicEnemyWithRarity(EnemyType newEnemy, int newRarity)
: base(newEnemy, newRarity)
{
}
public static DynamicEnemyWithRarity From(ConfigEntry<int> config, EnemyType enemyDef, ConfigEntry<int> mult = null)
{
DynamicEnemyWithRarity dynamicEnemyWithRarity = new DynamicEnemyWithRarity(enemyDef, 0)
{
enemyType = enemyDef,
ConfigEntry = config,
Multiplier = mult
};
dynamicEnemyWithRarity.OnChanged(null, null);
config.SettingChanged += dynamicEnemyWithRarity.OnChanged;
if (mult != null)
{
mult.SettingChanged += dynamicEnemyWithRarity.OnChanged;
}
return dynamicEnemyWithRarity;
}
private void OnChanged(object sender, EventArgs args)
{
base.rarity = Mathf.Max(0, ConfigEntry.Value);
if (Multiplier != null)
{
base.rarity *= Multiplier.Value;
}
}
}
internal static class Log
{
internal static ManualLogSource Source { get; set; }
internal static void Print(LogLevel level, object message)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected I4, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
if (Source == null)
{
if ((int)level <= 16)
{
switch ((int)level)
{
default:
if ((int)level != 16)
{
break;
}
Debug.Log(message);
return;
case 1:
Debug.LogError(message);
return;
case 2:
Debug.LogError(message);
return;
case 4:
Debug.LogWarning(message);
return;
case 8:
Debug.Log(message);
return;
case 3:
case 5:
case 6:
case 7:
break;
case 0:
return;
}
}
else
{
if ((int)level == 32)
{
Debug.Log(message);
return;
}
if ((int)level == 63)
{
Debug.Log(message);
return;
}
}
Debug.Log(message);
}
else
{
Source.Log(level, message);
}
}
public static void Fatal(object data)
{
Print((LogLevel)1, data);
}
public static void Error(object data)
{
Print((LogLevel)2, data);
}
public static void Warning(object data)
{
Print((LogLevel)4, data);
}
public static void Message(object data)
{
Print((LogLevel)8, data);
}
public static void Info(object data)
{
Print((LogLevel)16, data);
}
[Conditional("DEBUG")]
public static void Debug(object data)
{
Print((LogLevel)32, data);
}
}
}
namespace Kittenji.FootballEntity
{
public class FootballAI : EnemyAI
{
public struct WeightedInfo
{
public int weight;
public int index;
}
[CompilerGenerated]
private sealed class <CheckAfterInit>d__72 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public FootballAI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CheckAfterInit>d__72(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
FootballAI footballAI = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (!footballAI.IsInitialized)
{
<>2__current = null;
<>1__state = 1;
return true;
}
footballAI.CheckHauntingLocal();
footballAI.waitForInitCr = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SimonSaysGame>d__55 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public FootballAI <>4__this;
private float <startTime>5__2;
private int <seconds>5__3;
private bool <isFailed>5__4;
private int <i>5__5;
private SSActionInfo <action>5__6;
private bool <playedIntro>5__7;
private bool <followedOrders>5__8;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SimonSaysGame>d__55(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<action>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Expected O, but got Unknown
int num = <>1__state;
FootballAI footballAI = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
LanguageToken languageToken = Lang.Get("SS_START");
SSDisplayUI.SetText(languageToken.Text, languageToken.Info);
if (footballAI.PlayTutorial)
{
footballAI.PlayTutorial = false;
<>2__current = footballAI.PlayLangAudioAndWait("SS_START", 0);
<>1__state = 1;
return true;
}
goto IL_00b0;
}
case 1:
<>1__state = -1;
goto IL_00b0;
case 2:
<>1__state = -1;
SSDisplayUI.SetVisible(value: false);
<isFailed>5__4 = false;
<i>5__5 = 0;
goto IL_0590;
case 3:
<>1__state = -1;
<playedIntro>5__7 = <i>5__5 == 0 || <action>5__6.ForceVoiceIntro || Random.Range(0, 100) > 30;
if (<playedIntro>5__7)
{
<>2__current = footballAI.PlayLangAudioAndWait("SS_INTRO");
<>1__state = 4;
return true;
}
if (Random.Range(0, 100) < 40)
{
<>2__current = footballAI.PlayLangAudioAndWait("SS_INTRO_FAKE");
<>1__state = 5;
return true;
}
<>2__current = (object)new WaitForSeconds((float)Random.Range(0, 1));
<>1__state = 6;
return true;
case 4:
<>1__state = -1;
goto IL_0202;
case 5:
<>1__state = -1;
goto IL_0202;
case 6:
<>1__state = -1;
goto IL_0202;
case 7:
<>1__state = -1;
footballAI.currentAction = <action>5__6;
<action>5__6.OnStart(footballAI);
<startTime>5__2 = Time.time + <action>5__6.Duration;
<seconds>5__3 = -1;
goto IL_02d0;
case 8:
<>1__state = -1;
if (<action>5__6.DisplayTime)
{
int num2 = Mathf.FloorToInt(<startTime>5__2 - Time.time);
if (<seconds>5__3 != num2)
{
SSDisplayUI.SetDesc(string.Format(<action>5__6.Help, <seconds>5__3 = num2));
SSDisplayUI.Ping((float)Mathf.Min(num2, 4) / 4f + 0.25f);
}
}
if (!(Time.time > <startTime>5__2) && !<action>5__6.OnUpdate(footballAI) && footballAI.hauntingPlayer.isPlayerControlled && !footballAI.hauntingPlayer.isPlayerDead)
{
goto IL_02d0;
}
<followedOrders>5__8 = <action>5__6.OnEnd(footballAI);
footballAI.currentAction = null;
SSDisplayUI.SetVisible(value: false);
((EnemyAI)footballAI).creatureAnimator.SetInteger("Emote", 0);
Logger.LogInfo((object)("SS Action: " + ((Object)<action>5__6).name));
Logger.LogInfo((object)("Should Obey: " + <playedIntro>5__7));
Logger.LogInfo((object)("Followed Orders: " + <followedOrders>5__8));
if (<followedOrders>5__8 != <playedIntro>5__7)
{
<isFailed>5__4 = true;
if (Random.Range(0, 100) < 10)
{
<>2__current = footballAI.PlayAudioAndWait(footballAI.GetRandomGiggle());
<>1__state = 9;
return true;
}
goto IL_0460;
}
if (Random.Range(0, 100) < 8)
{
<>2__current = footballAI.PlayAudioAndWait(footballAI.GetRandomGiggle());
<>1__state = 12;
return true;
}
goto IL_0515;
case 9:
<>1__state = -1;
goto IL_0460;
case 10:
<>1__state = -1;
<>2__current = footballAI.PlayAudioAndWait(Object.op_Implicit((Object)(object)<action>5__6.AudioOverrideFailure) ? <action>5__6.AudioOverrideFailure : footballAI.AudioWrong, 0f, ((EnemyAI)footballAI).creatureSFX);
<>1__state = 11;
return true;
case 11:
<>1__state = -1;
footballAI.ActionFailed();
goto IL_05a1;
case 12:
<>1__state = -1;
goto IL_0515;
case 13:
<>1__state = -1;
if (!<followedOrders>5__8 || !<action>5__6.CanEndGame)
{
<action>5__6 = null;
goto IL_057e;
}
goto IL_05a1;
case 14:
<>1__state = -1;
goto IL_05d2;
case 15:
{
<>1__state = -1;
footballAI.SpawnEffectByIndex(((Component)footballAI).transform.position, 0);
footballAI.SwitchState(1, 10f);
Logger.LogInfo((object)"Player won Simon Says event, requesting a new target.");
footballAI.RequestNewTargetServerRpc();
return false;
}
IL_0590:
if (<i>5__5 < footballAI.CurrentCount)
{
<action>5__6 = footballAI.CurrentActions[<i>5__5];
if (<action>5__6.IsValid(footballAI))
{
<action>5__6.OnInit();
<>2__current = footballAI.PlayAudioAndWait(footballAI.AudioStart, 0f, ((EnemyAI)footballAI).creatureSFX);
<>1__state = 3;
return true;
}
goto IL_057e;
}
goto IL_05a1;
IL_05a1:
if (!<isFailed>5__4)
{
<>2__current = footballAI.PlayLangAudioAndWait("SS_END_WINNER");
<>1__state = 14;
return true;
}
goto IL_05d2;
IL_02d0:
<>2__current = null;
<>1__state = 8;
return true;
IL_05d2:
<>2__current = footballAI.PlayAudioAndWait(footballAI.GetRandomGiggle());
<>1__state = 15;
return true;
IL_057e:
<i>5__5++;
goto IL_0590;
IL_0202:
SSDisplayUI.SetText(<action>5__6.Message, <action>5__6.DisplayTime ? string.Empty : <action>5__6.Help);
if (<action>5__6.EmoteIndex > 0)
{
((EnemyAI)footballAI).creatureAnimator.SetInteger("Emote", <action>5__6.EmoteIndex);
}
<action>5__6.OnAwake(footballAI);
<>2__current = footballAI.PlayLangAudioAndWait(<action>5__6.LangKey, -1, <action>5__6.Delay);
<>1__state = 7;
return true;
IL_0460:
<>2__current = footballAI.PlayLangAudioAndWait("SS_END_LOSER");
<>1__state = 10;
return true;
IL_00b0:
<>2__current = footballAI.PlayLangAudioAndWait("SS_START", 1);
<>1__state = 2;
return true;
IL_0515:
<>2__current = footballAI.PlayAudioAndWait(Object.op_Implicit((Object)(object)<action>5__6.AudioOverrideSuccess) ? <action>5__6.AudioOverrideSuccess : footballAI.AudioRight, 0f, ((EnemyAI)footballAI).creatureSFX);
<>1__state = 13;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public 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_0114: 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_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))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
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)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1544376578u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1544376578u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!((NetworkBehaviour)this).IsOwner)
{
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), false);
}
[IteratorStateMachine(typeof(<SimonSaysGame>d__55))]
private IEnumerator SimonSaysGame()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SimonSaysGame>d__55(0)
{
<>4__this = this
};
}
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_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
//IL_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))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(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 != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (((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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(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))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
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)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(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 == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
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();
}
}
}
[IteratorStateMachine(typeof(<CheckAfterInit>d__72))]
private IEnumerator CheckAfterInit()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CheckAfterInit>d__72(0)
{
<>4__this = this
};
}
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, -1);
}
return false;
}
private bool PlayerCanSeeTransform(Transform tran)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return PlayerCanSeePoint(tran.position);
}
private bool PlayerCanSeeEntity()
{
if (PlayerCanSeeTransform(base.eye))
{
return VisiblePoints.Any(PlayerCanSeeTransform);
}
return false;
}
private void State_Stalking(bool isCreeping = false)
{
//IL_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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
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, -1) || 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();
}
private PlayerControllerB CustomPlayerCollisionConditions(Collider other)
{
if (base.isEnemyDead)
{
return null;
}
if (!base.ventAnimationFinished)
{
return null;
}
if (base.stunNormalizedTimer >= 0f)
{
return null;
}
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component == (Object)null || (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
return null;
}
if (!CustomPlayerIsTargetable(component))
{
return null;
}
return component;
}
private bool CustomPlayerIsTargetable(PlayerControllerB playerScript)
{
if (playerScript.isPlayerControlled && !playerScript.isPlayerDead && (Object)(object)playerScript.inAnimationWithEnemy == (Object)null)
{
return playerScript.sinkingValue < 0.73f;
}
return false;
}
public override void OnCollideWithPlayer(Collider other)
{
if (!hauntingLocalPlayer)
{
return;
}
PlayerControllerB val = CustomPlayerCollisionConditions(other);
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, bool tamperWithMeshes = 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(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))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
MessWithLightsClientRpc();
}
}
[ClientRpc]
private void MessWithLightsClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2092296283u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2092296283u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!((NetworkBehaviour)this).IsOwner)
{
RoundManager.Instance.FlickerLights(true, true);
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.2f, true);
}
}
}
[ServerRpc]
private void SpawnEffectOnServerRpc(Vector3 pos, int index)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Invalid comparison between Unknown and I4
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((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))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SpawnEffectOnClientRpc(pos, index);
}
}
[ClientRpc]
private void SpawnEffectOnClientRpc(Vector3 pos, int index)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (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 == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!((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();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3736966122u, new RpcReceiveHandler(__rpc_handler_3736966122), "PlayMusicServerRpc");
((NetworkBehaviour)this).__registerRpc(1544376578u, new RpcReceiveHandler(__rpc_handler_1544376578), "PlayMusicClientRpc");
((NetworkBehaviour)this).__registerRpc(1118763606u, new RpcReceiveHandler(__rpc_handler_1118763606), "PlayLangAudioServerRpc");
((NetworkBehaviour)this).__registerRpc(788754222u, new RpcReceiveHandler(__rpc_handler_788754222), "PlayLangAudioClientRpc");
((NetworkBehaviour)this).__registerRpc(2987807880u, new RpcReceiveHandler(__rpc_handler_2987807880), "RequestNewTargetServerRpc");
((NetworkBehaviour)this).__registerRpc(118545674u, new RpcReceiveHandler(__rpc_handler_118545674), "SyncNewTargetClientRpc");
((NetworkBehaviour)this).__registerRpc(1357969639u, new RpcReceiveHandler(__rpc_handler_1357969639), "MessWithLightsServerRpc");
((NetworkBehaviour)this).__registerRpc(2092296283u, new RpcReceiveHandler(__rpc_handler_2092296283), "MessWithLightsClientRpc");
((NetworkBehaviour)this).__registerRpc(2028845924u, new RpcReceiveHandler(__rpc_handler_2028845924), "SpawnEffectOnServerRpc");
((NetworkBehaviour)this).__registerRpc(1435501649u, new RpcReceiveHandler(__rpc_handler_1435501649), "SpawnEffectOnClientRpc");
((EnemyAI)this).__initializeRpcs();
}
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)1;
((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)1;
((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)