using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("CarsonJF")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Eyecatching Catchphrase Hotkey Operations (TTS via Hotkeys!)")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+668d0aa0e12e12e8381b39a65314487cbeae522d")]
[assembly: AssemblyProduct("ECHO")]
[assembly: AssemblyTitle("ECHO")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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 ECHO
{
[BepInPlugin("CarsonJF.ECHO", "E.C.H.O.", "1.0")]
public class ECHO : BaseUnityPlugin
{
internal class EyeStateData
{
public float Timer;
public bool IsSpeaking;
public bool IsInitialized;
}
internal static class CustomEyeStates
{
public static Dictionary<int, EyeOverrideState> HotkeyEyeStates = new Dictionary<int, EyeOverrideState>();
public static Dictionary<EyeOverrideState, (Color eyeColor, Color pupilColor, Color lightColor, float lightIntensity)> CustomStates = new Dictionary<EyeOverrideState, (Color, Color, Color, float)>();
public static Dictionary<int, EyeStateData> HotkeyData = new Dictionary<int, EyeStateData>();
}
[HarmonyPatch(typeof(PlayerHealth), "EyeMaterialSetup")]
private class EyeMaterialSetupPatch
{
private static void Postfix(PlayerHealth __instance)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if (CustomEyeStates.CustomStates.TryGetValue(__instance.overrideEyeState, out (Color, Color, Color, float) value))
{
(__instance.overrideEyeMaterialColor, __instance.overridePupilMaterialColor, __instance.overrideEyeLightColor, __instance.overrideEyeLightIntensity) = value;
}
}
}
[HarmonyPatch(typeof(ChatManager), "Update")]
private class ChatManagerUpdatePatch
{
private static void Postfix(ChatManager __instance)
{
foreach (KeyValuePair<int, EyeStateData> item in CustomEyeStates.HotkeyData.ToList())
{
int key = item.Key;
EyeStateData value = item.Value;
if (value.Timer > 0f)
{
value.Timer -= Time.deltaTime;
}
if (value.Timer <= 0f)
{
if (value.IsInitialized)
{
ApplyEyeOverride((EyeOverrideState)0);
}
CustomEyeStates.HotkeyData.Remove(key);
}
}
}
}
[HarmonyPatch(typeof(ChatManager), "StatePossessed")]
private class ECHO_StatePossessed_EyeFix
{
public static void Postfix(ChatManager __instance)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<int, EyeStateData> hotkeyDatum in CustomEyeStates.HotkeyData)
{
int key = hotkeyDatum.Key;
EyeStateData value = hotkeyDatum.Value;
if (value.IsSpeaking && CustomEyeStates.HotkeyEyeStates.TryGetValue(key, out var value2))
{
ApplyEyeOverride(value2);
}
}
}
}
[HarmonyPatch(typeof(ChatManager), "PossessChatCustomLogic")]
public class ECHO_PossessChatCustomLogicUnified
{
public static bool Prefix(ChatManager __instance)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<int, EyeStateData> hotkeyDatum in CustomEyeStates.HotkeyData)
{
int key = hotkeyDatum.Key;
EyeStateData value = hotkeyDatum.Value;
if (value.IsSpeaking && CustomEyeStates.HotkeyEyeStates.TryGetValue(key, out var value2))
{
ApplyEyeOverride(value2);
}
}
return true;
}
public static void Postfix(ChatManager __instance)
{
PlayerAvatar playerAvatar = __instance.playerAvatar;
if (playerAvatar == null || !(playerAvatar.voiceChat?.ttsVoice?.isSpeaking).GetValueOrDefault())
{
return;
}
foreach (KeyValuePair<int, EyeStateData> hotkeyDatum in CustomEyeStates.HotkeyData)
{
int key = hotkeyDatum.Key;
EyeStateData value = hotkeyDatum.Value;
if (value.IsInitialized && !value.IsSpeaking)
{
value.IsSpeaking = true;
}
value.Timer = 0.2f;
}
}
}
[HarmonyPatch(typeof(ChatManager), "StateSend")]
private class ChatCommandPatch
{
private static bool Prefix(ChatManager __instance)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
string chatMessage = __instance.chatMessage;
if (chatMessage.Equals("/echo reload", StringComparison.OrdinalIgnoreCase))
{
Instance.ReloadConfig();
ChatManager.instance.PossessChatScheduleStart(5);
ChatManager.instance.PossessChat((PossessChatID)0, ":)", 2f, Color.green, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
return false;
}
return true;
}
}
[CompilerGenerated]
private sealed class <InitializeSpeakingState>d__31 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int hotkeyIndex;
public ECHO <>4__this;
private EyeStateData <data>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <InitializeSpeakingState>d__31(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<data>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (CustomEyeStates.HotkeyData.TryGetValue(hotkeyIndex, out <data>5__1))
{
<data>5__1.IsInitialized = true;
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private ConfigEntry<int> numberOfHotkeysConfig = null;
private List<(int index, ConfigEntry<KeyCode> keyConfig, ConfigEntry<bool> ctrlRequired, ConfigEntry<bool> altRequired, ConfigEntry<bool> shiftRequired, ConfigEntry<string> messageConfig, ConfigEntry<string> colorConfig, ConfigEntry<string> pupilColorConfig, ConfigEntry<float> lightIntensityConfig, ConfigEntry<float> pupilSizeConfig, ConfigEntry<bool> randomizeConfig)> hotkeyConfigs = null;
private Dictionary<int, int> currentMessageIndex = new Dictionary<int, int>();
internal static ECHO Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
internal static void ApplyEyeOverride(EyeOverrideState eyeState)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
PlayerAvatar playerAvatar = ChatManager.instance.playerAvatar;
if (playerAvatar != null)
{
PlayerHealth playerHealth = playerAvatar.playerHealth;
if (playerHealth != null)
{
playerHealth.EyeMaterialOverride(eyeState, 0.25f, 0);
}
}
}
private Color HexToColor(string hex)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
hex = hex.TrimStart('#');
if (int.TryParse(hex.Substring(0, 2), NumberStyles.HexNumber, null, out var result) && int.TryParse(hex.Substring(2, 2), NumberStyles.HexNumber, null, out var result2) && int.TryParse(hex.Substring(4, 2), NumberStyles.HexNumber, null, out var result3))
{
return new Color((float)result / 255f, (float)result2 / 255f, (float)result3 / 255f, 1f);
}
Logger.LogWarning((object)("Invalid hex color '" + hex + "'. Defaulting to cyan."));
return Color.cyan;
}
private void Awake()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Expected O, but got Unknown
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Expected O, but got Unknown
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
numberOfHotkeysConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NumberOfHotkeys", 5, new ConfigDescription("Number of hotkeys to configure (1-99). MUST RESTART GAME AFTER CHANGING THIS.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), Array.Empty<object>()));
CleanupUnusedHotkeys(numberOfHotkeysConfig.Value);
hotkeyConfigs = new List<(int, ConfigEntry<KeyCode>, ConfigEntry<bool>, ConfigEntry<bool>, ConfigEntry<bool>, ConfigEntry<string>, ConfigEntry<string>, ConfigEntry<string>, ConfigEntry<float>, ConfigEntry<float>, ConfigEntry<bool>)>();
for (int i = 1; i <= numberOfHotkeysConfig.Value; i++)
{
ConfigEntry<KeyCode> item = ((BaseUnityPlugin)this).Config.Bind<KeyCode>($"Hotkey {i}", "Key", (KeyCode)107, "Main key to trigger this catchphrase.");
ConfigEntry<bool> item2 = ((BaseUnityPlugin)this).Config.Bind<bool>($"Hotkey {i}", "CtrlRequired", false, "Require Ctrl to be held.");
ConfigEntry<bool> item3 = ((BaseUnityPlugin)this).Config.Bind<bool>($"Hotkey {i}", "AltRequired", false, "Require Alt to be held.");
ConfigEntry<bool> item4 = ((BaseUnityPlugin)this).Config.Bind<bool>($"Hotkey {i}", "ShiftRequired", false, "Require Shift to be held.");
ConfigEntry<string> item5 = ((BaseUnityPlugin)this).Config.Bind<string>($"Hotkey {i}", "Message", $"This is catchphrase {i}", "Message content (use || to separate multiple lines).");
ConfigEntry<string> item6 = ((BaseUnityPlugin)this).Config.Bind<string>($"Hotkey {i}", "Color", "00FFFF", "Hex eye color.");
ConfigEntry<string> item7 = ((BaseUnityPlugin)this).Config.Bind<string>($"Hotkey {i}", "PupilColor", "FFFFFF", "Hex pupil color.");
ConfigEntry<float> item8 = ((BaseUnityPlugin)this).Config.Bind<float>($"Hotkey {i}", "LightIntensity", 5f, new ConfigDescription("Intensity of the eye light effect.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
ConfigEntry<float> item9 = ((BaseUnityPlugin)this).Config.Bind<float>($"Hotkey {i}", "PupilSize", 3f, new ConfigDescription("Size of the pupil during TTS.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>()));
ConfigEntry<bool> item10 = ((BaseUnityPlugin)this).Config.Bind<bool>($"Hotkey {i}", "RandomizeLines", false, "Randomly select from available lines instead of sequential playback.");
hotkeyConfigs.Add((i, item, item2, item3, item4, item5, item6, item7, item8, item9, item10));
}
RegisterCustomEyeStates();
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
Logger.LogMessage((object)"Hit me up on Discord!: @CarsonJF");
}
internal void ReloadConfig()
{
((BaseUnityPlugin)this).Config.Reload();
RegisterCustomEyeStates();
Logger.LogInfo((object)"E.C.H.O. configuration reloaded.");
}
private void RegisterCustomEyeStates()
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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)
foreach (var hotkeyConfig in hotkeyConfigs)
{
int item = hotkeyConfig.index;
ConfigEntry<KeyCode> item2 = hotkeyConfig.keyConfig;
ConfigEntry<bool> item3 = hotkeyConfig.ctrlRequired;
ConfigEntry<bool> item4 = hotkeyConfig.altRequired;
ConfigEntry<bool> item5 = hotkeyConfig.shiftRequired;
ConfigEntry<string> item6 = hotkeyConfig.messageConfig;
ConfigEntry<string> item7 = hotkeyConfig.colorConfig;
ConfigEntry<string> item8 = hotkeyConfig.Rest.Item1;
ConfigEntry<float> item9 = hotkeyConfig.Rest.Item2;
ConfigEntry<float> item10 = hotkeyConfig.Rest.Item3;
ConfigEntry<bool> item11 = hotkeyConfig.Rest.Item4;
EyeOverrideState val = (EyeOverrideState)(100 + item);
CustomEyeStates.HotkeyEyeStates[item] = val;
Color val2 = HexToColor(item7.Value);
Color item12 = HexToColor(item8.Value);
CustomEyeStates.CustomStates[val] = (val2, item12, val2, item9.Value);
}
}
private void CleanupUnusedHotkeys(int newCount)
{
ConfigEntryBase[] configEntries = ((BaseUnityPlugin)this).Config.GetConfigEntries();
int result;
IEnumerable<ConfigEntryBase> enumerable = configEntries.Where((ConfigEntryBase entry) => entry.Definition.Section.StartsWith("Hotkey ") && int.TryParse(entry.Definition.Section.Split(' ')[1], out result) && result > newCount);
foreach (ConfigEntryBase item in enumerable)
{
((BaseUnityPlugin)this).Config.Remove(item.Definition);
Logger.LogInfo((object)("Removed unused hotkey config: " + item.Definition.Section));
}
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0146: 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_0269: Unknown result type (might be due to invalid IL or missing references)
if ((int)ChatManager.instance.chatState > 0)
{
return;
}
bool flag = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305);
bool flag2 = Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307);
bool flag3 = Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303);
IOrderedEnumerable<(int, ConfigEntry<KeyCode>, ConfigEntry<bool>, ConfigEntry<bool>, ConfigEntry<bool>, ConfigEntry<string>, ConfigEntry<string>, ConfigEntry<string>, ConfigEntry<float>, ConfigEntry<float>, ConfigEntry<bool>)> orderedEnumerable = hotkeyConfigs.OrderByDescending<(int, ConfigEntry<KeyCode>, ConfigEntry<bool>, ConfigEntry<bool>, ConfigEntry<bool>, ConfigEntry<string>, ConfigEntry<string>, ConfigEntry<string>, ConfigEntry<float>, ConfigEntry<float>, ConfigEntry<bool>), int>(((int index, ConfigEntry<KeyCode> keyConfig, ConfigEntry<bool> ctrlRequired, ConfigEntry<bool> altRequired, ConfigEntry<bool> shiftRequired, ConfigEntry<string> messageConfig, ConfigEntry<string> colorConfig, ConfigEntry<string> pupilColorConfig, ConfigEntry<float> lightIntensityConfig, ConfigEntry<float> pupilSizeConfig, ConfigEntry<bool> randomizeConfig) h) => (h.ctrlRequired.Value ? 1 : 0) + (h.altRequired.Value ? 1 : 0) + (h.shiftRequired.Value ? 1 : 0));
foreach (var item12 in orderedEnumerable)
{
int item = item12.Item1;
ConfigEntry<KeyCode> item2 = item12.Item2;
ConfigEntry<bool> item3 = item12.Item3;
ConfigEntry<bool> item4 = item12.Item4;
ConfigEntry<bool> item5 = item12.Item5;
ConfigEntry<string> item6 = item12.Item6;
ConfigEntry<string> item7 = item12.Item7;
ConfigEntry<string> item8 = item12.Rest.Item1;
ConfigEntry<float> item9 = item12.Rest.Item2;
ConfigEntry<float> item10 = item12.Rest.Item3;
ConfigEntry<bool> item11 = item12.Rest.Item4;
if (!(!item3.Value || flag) || !(!item4.Value || flag2) || !(!item5.Value || flag3) || !Input.GetKeyDown(item2.Value))
{
continue;
}
Color eyeColor = HexToColor(item7.Value);
string[] array = (from m in item6.Value.Split("||")
select m.Trim() into m
where !string.IsNullOrEmpty(m)
select m).ToArray();
string message;
if (array.Length == 0)
{
message = item6.Value;
}
else if (item11.Value)
{
message = array[Random.Range(0, array.Length)];
}
else
{
if (!currentMessageIndex.ContainsKey(item))
{
currentMessageIndex[item] = 0;
}
message = array[currentMessageIndex[item]];
currentMessageIndex[item] = (currentMessageIndex[item] + 1) % array.Length;
}
PossessChat(message, 5f, eyeColor, item, item10.Value);
break;
}
}
internal void PossessChat(string message, float duration, Color eyeColor, int hotkeyIndex, float pupilSize)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
ChatManager.instance.PossessChatScheduleStart(10);
ChatManager.instance.playerAvatar.OverridePupilSize(pupilSize, 4, 1f, 1f, 15f, 0.3f, 0.1f);
if (CustomEyeStates.HotkeyEyeStates.TryGetValue(hotkeyIndex, out var value))
{
ApplyEyeOverride(value);
CustomEyeStates.HotkeyData[hotkeyIndex] = new EyeStateData
{
Timer = Mathf.Max(duration + 1f, 2f),
IsSpeaking = true,
IsInitialized = false
};
((MonoBehaviour)this).StartCoroutine(InitializeSpeakingState(hotkeyIndex));
}
ChatManager.instance.PossessChat((PossessChatID)0, message, duration, eyeColor, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
[IteratorStateMachine(typeof(<InitializeSpeakingState>d__31))]
private IEnumerator InitializeSpeakingState(int hotkeyIndex)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <InitializeSpeakingState>d__31(0)
{
<>4__this = this,
hotkeyIndex = hotkeyIndex
};
}
}
}