using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using MenuLib;
using MenuLib.MonoBehaviors;
using MenuLib.Structs;
using Microsoft.CodeAnalysis;
using TMPro;
using TwitchChatAPI.Enums;
using TwitchChatAPI.REPO.Dependencies;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("TwitchChatAPI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zehs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 Zehs")]
[assembly: AssemblyDescription("TwitchChatAPI wrapper for R.E.P.O.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eb5ac402079dcfe75bf2f6926a3fa6b3fe6460fa")]
[assembly: AssemblyProduct("TwitchChatAPI REPO")]
[assembly: AssemblyTitle("TwitchChatAPI.REPO")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace TwitchChatAPI.REPO
{
internal static class Logger
{
public static ManualLogSource ManualLogSource { get; private set; }
public static void Initialize(ManualLogSource manualLogSource)
{
ManualLogSource = manualLogSource;
}
public static void LogDebug(object data)
{
Log((LogLevel)32, data);
}
public static void LogInfo(object data, bool extended = false)
{
Log((LogLevel)16, data, extended);
}
public static void LogWarning(object data, bool extended = false)
{
Log((LogLevel)4, data, extended);
}
public static void LogError(object data, bool extended = false)
{
Log((LogLevel)2, data, extended);
}
public static void LogFatal(object data, bool extended = false)
{
Log((LogLevel)1, data, extended);
}
public static void Log(LogLevel logLevel, object data, bool extended = false)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
if (!extended || IsExtendedLoggingEnabled())
{
ManualLogSource manualLogSource = ManualLogSource;
if (manualLogSource != null)
{
manualLogSource.Log(logLevel, data);
}
}
}
public static bool IsExtendedLoggingEnabled()
{
return Logger.IsExtendedLoggingEnabled();
}
}
internal static class Menu
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static BuilderDelegate <>9__4_0;
public static BuilderDelegate <>9__4_1;
public static BuilderDelegate <>9__4_2;
public static Action <>9__4_3;
internal void <Initialize>b__4_0(Transform parent)
{
CreateMainButtonForMainMenu(parent);
}
internal void <Initialize>b__4_1(Transform parent)
{
CreateMainButtonForLobbyAndEscapeMenu(parent);
}
internal void <Initialize>b__4_2(Transform parent)
{
CreateMainButtonForLobbyAndEscapeMenu(parent);
}
internal void <Initialize>b__4_3()
{
API.OnConnectionStateChanged -= HandleConnectionStateChanged;
}
}
private static REPOPopupPage _popupPage;
private static REPOLabel _connectionStatusLabel;
private static REPOToggle _enabledToggle;
private static REPOInputField _channelInputField;
public static void Initialize()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
object obj = <>c.<>9__4_0;
if (obj == null)
{
BuilderDelegate val = delegate(Transform parent)
{
CreateMainButtonForMainMenu(parent);
};
<>c.<>9__4_0 = val;
obj = (object)val;
}
MenuAPI.AddElementToMainMenu((BuilderDelegate)obj);
object obj2 = <>c.<>9__4_1;
if (obj2 == null)
{
BuilderDelegate val2 = delegate(Transform parent)
{
CreateMainButtonForLobbyAndEscapeMenu(parent);
};
<>c.<>9__4_1 = val2;
obj2 = (object)val2;
}
MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj2);
object obj3 = <>c.<>9__4_2;
if (obj3 == null)
{
BuilderDelegate val3 = delegate(Transform parent)
{
CreateMainButtonForLobbyAndEscapeMenu(parent);
};
<>c.<>9__4_2 = val3;
obj3 = (object)val3;
}
MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj3);
API.OnConnectionStateChanged += HandleConnectionStateChanged;
Application.quitting += delegate
{
API.OnConnectionStateChanged -= HandleConnectionStateChanged;
};
}
private static REPOButton CreateMainButtonForMainMenu(Transform parent)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(550f, 0f);
if (SpawnManagerProxy.Enabled)
{
((Vector2)(ref val))..ctor(550f, 55f);
}
return CreateMainButton(parent, Vector2.op_Implicit(val));
}
private static REPOButton CreateMainButtonForLobbyAndEscapeMenu(Transform parent)
{
//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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
Vector2 zero = Vector2.zero;
if (MoreHeadProxy.Enabled)
{
((Vector2)(ref zero))..ctor(100f, 0f);
}
return CreateMainButton(parent, Vector2.op_Implicit(zero));
}
private static REPOButton CreateMainButton(Transform parent, Vector3 localPosition)
{
//IL_0022: 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)
return MenuAPI.CreateREPOButton("Twitch Chat API", (Action)HandleMainButtonClick, parent, Vector2.op_Implicit(localPosition));
}
private static void CreateMenu()
{
//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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Expected O, but got Unknown
_popupPage = MenuAPI.CreateREPOPopupPage("Twitch Chat API", (PresetSide)0, false, true, 0f);
REPOPopupPage popupPage = _popupPage;
Padding maskPadding = _popupPage.maskPadding;
maskPadding.top = 35f;
popupPage.maskPadding = maskPadding;
float xPosition = 75f;
float yPosition = 270f;
_popupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0013: 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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
_connectionStatusLabel = MenuAPI.CreateREPOLabel("Connection Status", parent, new Vector2(xPosition, yPosition));
((Component)_connectionStatusLabel).transform.localScale = Vector3.one * 0.7f;
HandleConnectionStateChanged(API.ConnectionState);
});
yPosition -= 40f;
_popupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
_enabledToggle = MenuAPI.CreateREPOToggle("Enabled", (Action<bool>)null, parent, new Vector2(xPosition, yPosition), "ON", "OFF", false);
_enabledToggle.SetState(ConfigManager.TwitchChat_Enabled.Value, false);
});
yPosition -= 40f;
_popupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
_channelInputField = MenuAPI.CreateREPOInputField("Channel", (Action<string>)null, parent, new Vector2(xPosition, yPosition), false, "", "");
_channelInputField.inputStringSystem.SetValue(ConfigManager.TwitchChat_Channel.Value, false);
});
yPosition = 35f;
_popupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Close", (Action)HandleCloseButtonClicked, parent, new Vector2(xPosition, yPosition));
});
_popupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Apply", (Action)HandleApplyButtonClicked, parent, new Vector2(260f, yPosition));
});
_popupPage.OpenPage(false);
}
private static void HandleMainButtonClick()
{
CreateMenu();
}
private static void HandleConnectionStateChanged(ConnectionState connectionState)
{
//IL_001a: 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_0032: Expected I4, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_connectionStatusLabel == (Object)null))
{
if (1 == 0)
{
}
string text = (connectionState - 1) switch
{
0 => "#00FF00",
1 => "#00FF00",
2 => "#FF0000",
3 => "#FF0000",
_ => string.Empty,
};
if (1 == 0)
{
}
string text2 = text;
string text3 = (string.IsNullOrEmpty(text2) ? ((object)(ConnectionState)(ref connectionState)).ToString() : $"<color={text2}>{connectionState}</color>");
((TMP_Text)_connectionStatusLabel.labelTMP).text = "Connection Status: " + text3;
}
}
private static void HandleCloseButtonClicked()
{
REPOPopupPage popupPage = _popupPage;
if (popupPage != null)
{
popupPage.ClosePage(true);
}
}
private static void HandleApplyButtonClicked()
{
if ((Object)(object)_enabledToggle != (Object)null)
{
ConfigManager.TwitchChat_Enabled.Value = _enabledToggle.state;
}
if ((Object)(object)_channelInputField != (Object)null)
{
ConfigManager.TwitchChat_Channel.Value = _channelInputField.inputStringSystem.currentValue;
}
}
}
[BepInPlugin("TwitchChatAPI.REPO", "TwitchChatAPI REPO", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class Plugin : BaseUnityPlugin
{
internal static Plugin Instance { get; private set; }
private void Awake()
{
Instance = this;
Logger.Initialize(Logger.CreateLogSource("TwitchChatAPI.REPO"));
Logger.LogInfo("TwitchChatAPI REPO has awoken!");
Menu.Initialize();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TwitchChatAPI.REPO";
public const string PLUGIN_NAME = "TwitchChatAPI REPO";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace TwitchChatAPI.REPO.Dependencies
{
internal static class MoreHeadProxy
{
public const string PLUGIN_GUID = "Mhz.REPOMoreHead";
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled.GetValueOrDefault();
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("Mhz.REPOMoreHead");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
}
internal static class SpawnManagerProxy
{
public const string PLUGIN_GUID = "soundedsquash.spawnmanager";
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled.GetValueOrDefault();
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("soundedsquash.spawnmanager");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}