Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCChat v1.0.1
LC_Chat.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.WebSockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("LC_Chat")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LC_Chat")] [assembly: AssemblyTitle("LC_Chat")] [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 LC_Chat { [BepInPlugin("LC_Chat", "LC_Chat", "1.0.0")] public class Plugin : BaseUnityPlugin { private struct MSG { public string type; public string displayName; public string message; public string color; } private const string ENEMY_LAYER = "Enemies"; private ClientWebSocket ws; private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); private readonly Harmony harmony = new Harmony("LC_Chat"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LC_Chat is loaded!"); harmony.PatchAll(typeof(Plugin)); ConnectWebSocket(); } private void WriteOutItems() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[LCChat]: Writing out item info"); for (int i = 0; i < StartOfRound.Instance.allItemsList.itemsList.Count; i++) { Item val = StartOfRound.Instance.allItemsList.itemsList[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.spawnPrefab == (Object)null)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[LCChat]: Item " + val.itemName)); GameObject val2 = Object.Instantiate<GameObject>(val.spawnPrefab); Component[] components = val2.GetComponents<Component>(); for (int j = 0; j < components.Length; j++) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[LCChat]: Component " + ((object)components[j]).GetType().ToString())); } } } } private async void ConnectWebSocket() { ws = new ClientWebSocket(); try { await ws.ConnectAsync(new Uri("ws://localhost:3000"), cancellationTokenSource.Token); StartListening(); } catch (Exception ex2) { Exception ex = ex2; ((BaseUnityPlugin)this).Logger.LogError((object)("WebSocket connection failed: " + ex.Message)); } } private async void StartListening() { byte[] buffer = new byte[1024]; while (ws.State == WebSocketState.Open) { WebSocketReceiveResult result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationTokenSource.Token); string messageRaw = Encoding.UTF8.GetString(buffer, 0, result.Count); MSG msg = JsonUtility.FromJson<MSG>(messageRaw); if (result.MessageType != 0) { continue; } string type = msg.type; string text = type; string text2 = text; if (!(text2 == "message")) { if (text2 == "birthday") { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Spawning present"); SpawnItem("giftbox"); } } else if (string.IsNullOrEmpty(msg.message)) { } } } private void PrintHierarchy(GameObject obj) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)("[LCChat]: Printing hierarchy for " + ((Object)obj).name)); Component[] components = obj.GetComponents<Component>(); for (int i = 0; i < components.Length; i++) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[LCChat]: Component " + ((object)components[i]).GetType().ToString())); } foreach (Transform item in obj.transform) { Transform val = item; PrintHierarchy(((Component)val).gameObject); } } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] [HarmonyPrefix] private static bool Commands(HUDManager __instance, string chatMessage) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) string text = chatMessage; if (!text.StartsWith("<size=0>")) { return true; } text = text.Replace("<size=0>", ""); text = text.Replace("</size>", ""); if (!text.Contains("/cory_")) { return true; } text = text.Replace("/cory_", ""); Debug.Log((object)("GOT MESSAGE: " + text)); string[] split = text.Split('_'); List<PlayerControllerB> source = new List<PlayerControllerB>(Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0)); PlayerControllerB val = ((IEnumerable<PlayerControllerB>)source).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => x.playerUsername == split[0])); Vector3 val2 = (Vector3)(((Object)(object)val != (Object)null) ? (((Component)val).transform.position + ((Component)val).transform.forward * 2f) : new Vector3(float.Parse(split[1]), float.Parse(split[2]), float.Parse(split[3]))); Item val3 = StartOfRound.Instance.allItemsList.itemsList.Find((Item z) => ((Object)z).name.ToLower().Equals("easteregg".ToLower())); StunGrenadeItem component = Object.Instantiate<GameObject>(val3.spawnPrefab, val2, Quaternion.identity).GetComponent<StunGrenadeItem>(); val.movementAudio.PlayOneShot(component.explodeSFX, 4f); RoundManager.Instance.PlayAudibleNoise(val2, 12f, 4f, 0, false, 911); GameObject val4 = Object.Instantiate<GameObject>(component.stunGrenadeExplosion, val2, Quaternion.identity); Object.Destroy((Object)(object)((Component)component).gameObject); Object.Destroy((Object)(object)val4, 5f); return false; } private void Explosion(Vector3 pos) { //IL_004c: 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) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"Explode clientrpc"); Item val = StartOfRound.Instance.allItemsList.itemsList.Find((Item z) => ((Object)z).name.ToLower().Equals("easteregg".ToLower())); StunGrenadeItem component = Object.Instantiate<GameObject>(val.spawnPrefab, pos, Quaternion.identity).GetComponent<StunGrenadeItem>(); PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; localPlayerController.movementAudio.PlayOneShot(component.explodeSFX, 4f); RoundManager.Instance.PlayAudibleNoise(pos, 12f, 4f, 0, false, 911); GameObject val2 = Object.Instantiate<GameObject>(component.stunGrenadeExplosion, pos, Quaternion.identity); Object.Destroy((Object)(object)((Component)component).gameObject); } private void SpawnItem(string item) { if (!NetworkManager.Singleton.IsServer) { return; } int num = 0; Item requestedItem = StartOfRound.Instance.allItemsList.itemsList.Find((Item z) => ((Object)z).name.ToLower().Equals(item.ToLower())); List<PlayerControllerB> list = new List<PlayerControllerB>(Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0)); for (int num2 = list.Count - 1; num2 >= 0; num2--) { PlayerControllerB val = list[num2]; if (!((Behaviour)val).isActiveAndEnabled || !val.isPlayerControlled || val.isPlayerDead) { list.RemoveAt(num2); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Spawning item {item} to {list.Count} players"); for (int i = 0; i < list.Count; i++) { PlayerControllerB playerRef2 = list[i]; SpawnItem(playerRef2); SpawnEffects(playerRef2); } void SpawnEffects(PlayerControllerB playerRef) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //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_0021: 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_0037: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = ((Component)playerRef).transform.position + ((Component)playerRef).transform.forward * 2f; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Calling spawn effects on {val2}"); HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cory_{playerRef.playerUsername}_{val2.x}_{val2.y}_{val2.z}</size>", -1); } void SpawnItem(PlayerControllerB playerRef) { //IL_0012: 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_0027: 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) GameObject val3 = Object.Instantiate<GameObject>(requestedItem.spawnPrefab, ((Component)playerRef).transform.position + ((Component)playerRef).transform.forward * 2f, Quaternion.identity); GrabbableObject component = val3.GetComponent<GrabbableObject>(); component.fallTime = 0f; component.SetScrapValue(component.scrapValue = Random.Range(25, 50)); ((Component)component).GetComponent<NetworkObject>().Spawn(false); } } } public static class PluginInfo { public const string PLUGIN_GUID = "LC_Chat"; public const string PLUGIN_NAME = "LC_Chat"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }