using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DiceAndColor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DiceAndColor")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cf8022e3-339f-4878-9f72-7773c26e5e36")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DiceAndColor;
[BepInPlugin("DiceAndColor", "DiceAndColor", "0.0.0.8")]
[BepInProcess("atlyss.exe")]
public class DiceAndColor : BaseUnityPlugin
{
public class CoroutineHelper : MonoBehaviour
{
private static CoroutineHelper instance;
public static CoroutineHelper Instance
{
get
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
if ((Object)instance == (Object)null)
{
GameObject val = new GameObject("CoroutineHelper");
instance = val.AddComponent<CoroutineHelper>();
Object.DontDestroyOnLoad((Object)val);
}
return instance;
}
}
public void RunCoroutine(IEnumerator coroutine)
{
((MonoBehaviour)this).StartCoroutine(coroutine);
}
}
[HarmonyPatch(typeof(ChatBehaviour), "Cmd_SendChatMessage")]
public class DiceAndColorCmd_SendChatMessage
{
[HarmonyPrefix]
public static void Cmd_SendChatMessage_Prefix(ChatBehaviour __instance, string _message, ChatChannel _chatChannel)
{
try
{
List<string> list = _message.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (list[0].ToLower() == "/ccolor")
{
Random random = new Random();
string text = $"#{random.Next(16777216):X6}";
Log.LogInfo((object)("chatcolor " + text));
ChatBehaviour._current.Cmd_SendChatMessage("/chatcolor " + text, (ChatChannel)0);
}
}
catch (Exception ex)
{
Log.LogError((object)ex);
}
}
[HarmonyPostfix]
private static void Cmd_SendChatMessage_Postfix(ref ChatBehaviour __instance, string _message, ChatChannel _chatChannel)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
try
{
List<string> list = _message.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (list[0].ToLower() == "/croll" && int.TryParse(list[1], out var _))
{
Random random = new Random();
string text = "#" + random.Next(1, int.Parse(list[1]) + 1);
Log.LogInfo((object)("croll " + list[1] + " -> " + text));
ChatBehaviour._current.Cmd_SendChatMessage(text, __instance._setChatChannel);
}
}
catch (Exception ex)
{
Log.LogError((object)ex);
}
}
}
public static ManualLogSource Log = new ManualLogSource("DiceAndColor");
private const string PLUGIN_GUID = "DiceAndColor";
private const string PLUGIN_NAME = "DiceAndColor";
private const string PLUGIN_VERSION = "0.0.0.8";
private readonly Harmony harmony = new Harmony("DiceAndColor");
public static DiceAndColor Instance { get; private set; }
private void Awake()
{
Instance = this;
harmony.PatchAll();
}
}