using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net.Security; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography.X509Certificates; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ChatChaos.Config; using ChatChaos.Core; using ChatChaos.Events; using ChatChaos.Localization; using ChatChaos.Logging; using ChatChaos.NetcodePatcher; using ChatChaos.Networking; using ChatChaos.Twitch; using ChatChaos.UI; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; 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: AssemblyCompany("ChatChaos")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.44.0.0")] [assembly: AssemblyInformationalVersion("0.44.0+d436ee288b9eea4d12398bc54579cd27f0606b27")] [assembly: AssemblyProduct("ChatChaos")] [assembly: AssemblyTitle("ChatChaos")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.44.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 ChatChaos { [BepInPlugin("Remilulz_91.ChatChaos", "ChatChaos", "0.44.0")] public class Plugin : BaseUnityPlugin { public const string Author = "Remilulz_91"; public const string Guid = "Remilulz_91.ChatChaos"; public const string Name = "ChatChaos"; public const string Version = "0.44.0"; private readonly Harmony _harmony = new Harmony("Remilulz_91.ChatChaos"); public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; ModConfig.Init(((BaseUnityPlugin)this).Config); Loc.Init(); EventRegistry.RegisterDefaults(); try { _harmony.PatchAll(); PollTicker.EnsureExists(); Log.LogInfo((object)("ChatChaos v0.44.0 by Remilulz_91 loaded. " + $"{EventRegistry.Count} event(s) registered. Language: {Loc.Current}.")); Log.LogInfo((object)"Inspired by Sehelitar's Twitch-integration mod (moderator for MrTiboute)."); } catch (Exception arg) { Log.LogError((object)$"Failed to apply Harmony patches: {arg}"); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ChatChaos"; public const string PLUGIN_NAME = "ChatChaos"; public const string PLUGIN_VERSION = "0.44.0"; } } namespace ChatChaos.UI { public class BerserkHud : MonoBehaviour { private static readonly Color SignalColor = Color32.op_Implicit(new Color32((byte)80, (byte)240, (byte)90, byte.MaxValue)); private static readonly Color BerserkColor = Color32.op_Implicit(new Color32((byte)230, (byte)40, (byte)40, byte.MaxValue)); private const string SignalLine = "RECEIVING SIGNAL"; private const string BerserkLine = "GO BERSERK"; private const float SignalTypeDur = 1.3f; private const float BerserkStart = 1.7f; private const float BerserkTypeDur = 1.1f; private const float TotalDur = 3.4f; private RectTransform _panel; private Text _signal; private Text _berserk; private Sprite _white; private bool _active; private float _start; public static BerserkHud? Instance { get; private set; } public static void EnsureExists() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("ChatChaos_BerserkHud"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; Instance = val.AddComponent(); } } private void Awake() { Build(); SetVisible(v: false); } public void ShowSignal() { _active = true; _start = Time.time; _signal.text = ""; _berserk.text = ""; SetVisible(v: true); } private void Update() { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (_active) { float num = Time.time - _start; int length = Mathf.Clamp(Mathf.FloorToInt((float)"RECEIVING SIGNAL".Length * (num / 1.3f)), 0, "RECEIVING SIGNAL".Length); _signal.text = "RECEIVING SIGNAL".Substring(0, length); if (num >= 1.7f) { float num2 = (num - 1.7f) / 1.1f; int length2 = Mathf.Clamp(Mathf.FloorToInt((float)"GO BERSERK".Length * num2), 0, "GO BERSERK".Length); _berserk.text = "GO BERSERK".Substring(0, length2); float num3 = 0.7f + 0.3f * Mathf.Abs(Mathf.Sin(num * 12f)); ((Graphic)_berserk).color = new Color(BerserkColor.r, BerserkColor.g, BerserkColor.b, num3); } if (num >= 3.4f) { _active = false; SetVisible(v: false); } } } private void Build() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00fe: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) _white = MakeWhiteSprite(); Canvas val = ((Component)this).gameObject.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 1100; CanvasScaler val2 = ((Component)this).gameObject.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; ((Component)this).gameObject.AddComponent(); GameObject val3 = new GameObject("Panel", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(((Component)this).transform, false); _panel = (RectTransform)val3.transform; Stretch(_panel); Image val4 = NewImage((Transform)(object)_panel, "BG", new Color(0f, 0f, 0f, 0.45f)); Stretch((RectTransform)((Component)val4).transform); _signal = NewText((Transform)(object)_panel, "Signal", 54, SignalColor, (FontStyle)1); RectTransform rectTransform = ((Graphic)_signal).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.6f); rectTransform.anchorMax = new Vector2(1f, 0.72f); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; _berserk = NewText((Transform)(object)_panel, "Berserk", 96, BerserkColor, (FontStyle)1); RectTransform rectTransform2 = ((Graphic)_berserk).rectTransform; rectTransform2.anchorMin = new Vector2(0f, 0.38f); rectTransform2.anchorMax = new Vector2(1f, 0.58f); rectTransform2.offsetMin = Vector2.zero; rectTransform2.offsetMax = Vector2.zero; } private void SetVisible(bool v) { if ((Object)(object)_panel != (Object)null) { ((Component)_panel).gameObject.SetActive(v); } } private static void Stretch(RectTransform rt) { //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_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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; } private Image NewImage(Transform parent, string name, Color color) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(parent, false); Image component = val.GetComponent(); component.sprite = _white; ((Graphic)component).color = color; return component; } private Text NewText(Transform parent, string name, int size, Color color, FontStyle style) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val.transform.SetParent(parent, false); Text component = val.GetComponent(); component.font = GetFont(); component.fontSize = size; component.fontStyle = style; component.alignment = (TextAnchor)4; ((Graphic)component).color = color; component.horizontalOverflow = (HorizontalWrapMode)1; component.verticalOverflow = (VerticalWrapMode)1; return component; } private static Font GetFont() { Font val = null; try { val = Resources.GetBuiltinResource("LegacyRuntime.ttf"); } catch { } if ((Object)(object)val == (Object)null) { try { val = Resources.GetBuiltinResource("Arial.ttf"); } catch { } } if ((Object)(object)val == (Object)null) { val = Font.CreateDynamicFontFromOSFont("Consolas", 16); } return val; } private static Sprite MakeWhiteSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Texture2D whiteTexture = Texture2D.whiteTexture; return Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f), 100f); } } public class EffectTimerHud : MonoBehaviour { private static readonly Color TextColor = Color32.op_Implicit(new Color32((byte)238, (byte)238, (byte)238, byte.MaxValue)); private Text _text; public static EffectTimerHud? Instance { get; private set; } public static void EnsureExists() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("ChatChaos_EffectTimers"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; Instance = val.AddComponent(); } } private void Awake() { Build(); } private void Update() { List<(string, int)> active = EffectTimers.GetActive(); if (active.Count == 0) { if (_text.text.Length != 0) { _text.text = ""; } return; } StringBuilder stringBuilder = new StringBuilder(); foreach (var item in active) { stringBuilder.Append(item.Item1).Append(" ").Append(item.Item2) .Append("s\n"); } _text.text = stringBuilder.ToString().TrimEnd(); } private void Build() { //IL_003c: 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_00cd: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0127: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) Canvas val = ((Component)this).gameObject.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 1050; CanvasScaler val2 = ((Component)this).gameObject.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; ((Component)this).gameObject.AddComponent(); float num = Mathf.Clamp01(ModConfig.TimerAnchorX.Value); float num2 = Mathf.Clamp01(ModConfig.TimerAnchorY.Value); bool flag = num > 0.5f; GameObject val3 = new GameObject("Text", new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text), typeof(Outline) }); val3.transform.SetParent(((Component)this).transform, false); RectTransform val4 = (RectTransform)val3.transform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(num, num2); val4.anchorMax = val5; val4.anchorMin = val5; val4.pivot = new Vector2(num, 1f); val4.sizeDelta = new Vector2(520f, 400f); val4.anchoredPosition = new Vector2(flag ? (-20f) : 20f, 0f); _text = val3.GetComponent(); _text.font = GetFont(); _text.fontSize = 24; _text.fontStyle = (FontStyle)1; _text.alignment = (TextAnchor)(flag ? 2 : 0); ((Graphic)_text).color = TextColor; _text.horizontalOverflow = (HorizontalWrapMode)1; _text.verticalOverflow = (VerticalWrapMode)1; _text.text = ""; Outline component = val3.GetComponent(); ((Shadow)component).effectColor = new Color(0f, 0f, 0f, 0.85f); ((Shadow)component).effectDistance = new Vector2(2f, -2f); } private static Font GetFont() { Font val = null; try { val = Resources.GetBuiltinResource("LegacyRuntime.ttf"); } catch { } if ((Object)(object)val == (Object)null) { try { val = Resources.GetBuiltinResource("Arial.ttf"); } catch { } } if ((Object)(object)val == (Object)null) { val = Font.CreateDynamicFontFromOSFont("Consolas", 16); } return val; } } public static class GameChat { public static void Show(string message) { if (string.IsNullOrEmpty(message)) { return; } try { HUDManager instance = HUDManager.Instance; if (!((Object)(object)instance == (Object)null)) { instance.AddTextToChatOnServer(message, -1); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("ChatChaos: could not post in-game chat: " + ex.Message)); } } } public static class GameTips { public static void Show(string header, string body) { try { HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip(header, body, false, false, "LC_Tip1"); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("ChatChaos: could not show on-screen tip: " + ex.Message)); } } } public class PollHud : MonoBehaviour { private static readonly Color PanelColor = Color32.op_Implicit(new Color32((byte)214, (byte)182, (byte)122, byte.MaxValue)); private static readonly Color HeaderText = Color32.op_Implicit(new Color32((byte)38, (byte)28, (byte)16, byte.MaxValue)); private static readonly Color RowEmpty = Color32.op_Implicit(new Color32((byte)43, (byte)43, (byte)46, byte.MaxValue)); private static readonly Color BarOrange = Color32.op_Implicit(new Color32((byte)240, (byte)168, (byte)30, byte.MaxValue)); private static readonly Color BarWinner = Color32.op_Implicit(new Color32((byte)95, (byte)190, (byte)70, byte.MaxValue)); private static readonly Color RowText = Color32.op_Implicit(new Color32((byte)238, (byte)238, (byte)238, byte.MaxValue)); private static readonly Color AlarmRed = Color32.op_Implicit(new Color32((byte)214, (byte)48, (byte)40, byte.MaxValue)); private const int PanelWidth = 470; private const int PanelHeight = 232; private const int Pad = 16; private const int RowHeight = 34; private const int RowGap = 9; private const int MaxRows = 3; private bool _active; private bool _finished; private bool _paused; private bool _pausedPulse; private readonly string[] _labels = new string[3]; private readonly int[] _counts = new int[3]; private int _rowsUsed; private float _endTime; private float _autoHideTime = float.MaxValue; private float _votingHardDeadline = float.MaxValue; private int _winnerIndex = -1; private int _winnerCount; private Canvas _canvas; private RectTransform _panel; private Text _title; private Text _timer; private Image _clockIcon; private Text _instruction; private Sprite _white; private readonly Image[] _rowBg = (Image[])(object)new Image[3]; private readonly Image[] _rowFill = (Image[])(object)new Image[3]; private readonly Text[] _rowLabel = (Text[])(object)new Text[3]; private readonly Text[] _rowCount = (Text[])(object)new Text[3]; public static PollHud? Instance { get; private set; } public static void EnsureExists() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("ChatChaos_Hud"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; Instance = val.AddComponent(); } } private void Awake() { Build(); SetVisible(v: false); } public void ShowPoll(string l0, string l1, string l2, float duration) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) _labels[0] = l0 ?? ""; _labels[1] = l1 ?? ""; _labels[2] = l2 ?? ""; _rowsUsed = 0; for (int i = 0; i < 3; i++) { _counts[i] = 0; if (_labels[i].Length > 0) { _rowsUsed = i + 1; } } _finished = false; _paused = false; _pausedPulse = false; _winnerIndex = -1; _endTime = Time.time + duration; _autoHideTime = float.MaxValue; _votingHardDeadline = Time.time + duration + 12f; _active = true; _title.text = Loc.Get("panel.title"); _instruction.text = Loc.Get("panel.instruction"); ((Graphic)_instruction).color = HeaderText; if ((Object)(object)_clockIcon != (Object)null) { ((Component)_clockIcon).gameObject.SetActive(true); } ApplyTimerVisual(1f, HeaderText); SetVisible(v: true); Refresh(); } public void UpdateCounts(int c0, int c1, int c2) { if (!_paused) { _counts[0] = c0; _counts[1] = c1; _counts[2] = c2; if (_active && !_finished) { Refresh(); } } } public void Pause() { if (_active && !_finished) { float num = _endTime - Time.time; _pausedPulse = num <= 10f && num > 0f; _paused = true; _autoHideTime = Time.time + Mathf.Max(1f, ModConfig.ResultDisplayDuration.Value); SetVisible(v: true); } } public void ShowResult(int winnerIndex, int winnerCount) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) _finished = true; _paused = false; _pausedPulse = false; _winnerIndex = winnerIndex; _winnerCount = winnerCount; _instruction.text = Loc.Get("panel.finished"); _autoHideTime = Time.time + Mathf.Max(1f, ModConfig.ResultDisplayDuration.Value); _votingHardDeadline = float.MaxValue; _active = true; if ((Object)(object)_clockIcon != (Object)null) { ((Component)_clockIcon).gameObject.SetActive(false); } ApplyTimerVisual(1f, HeaderText); SetVisible(v: true); Refresh(); } public void Hide() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) _active = false; _finished = false; _paused = false; _pausedPulse = false; _autoHideTime = float.MaxValue; _votingHardDeadline = float.MaxValue; if ((Object)(object)_clockIcon != (Object)null) { ((Component)_clockIcon).gameObject.SetActive(false); } ApplyTimerVisual(1f, HeaderText); SetVisible(v: false); } private void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) if (!_active) { return; } if (_paused) { if (_pausedPulse) { float num = Mathf.Sin(Time.time % 1f * MathF.PI); ApplyTimerVisual(Mathf.Lerp(1f, 1.6f, num), Color.Lerp(HeaderText, AlarmRed, num)); } if (Time.time >= _autoHideTime) { Hide(); } } else if (!_finished) { float num2 = _endTime - Time.time; int num3 = Mathf.Max(0, Mathf.CeilToInt(num2)); _timer.text = num3 + "s"; UpdateTimerPulse(num2); if (Time.time >= _votingHardDeadline) { Hide(); } } else { _timer.text = ""; if (Time.time >= _autoHideTime) { Hide(); } } } private void UpdateTimerPulse(float remaining) { //IL_0053: 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_003c: 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) if (remaining <= 10f && remaining > 0f) { float num = Mathf.Ceil(remaining) - remaining; float num2 = Mathf.Sin(num * MathF.PI); ApplyTimerVisual(Mathf.Lerp(1f, 1.6f, num2), Color.Lerp(HeaderText, AlarmRed, num2)); } else { ApplyTimerVisual(1f, HeaderText); } } private void ApplyTimerVisual(float scale, Color color) { //IL_0019: 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) //IL_0044: 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) Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(scale, scale, 1f); ((Transform)((Graphic)_timer).rectTransform).localScale = localScale; ((Graphic)_timer).color = color; if ((Object)(object)_clockIcon != (Object)null) { ((Transform)((Graphic)_clockIcon).rectTransform).localScale = localScale; ((Graphic)_clockIcon).color = color; } } private void Refresh() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00c0: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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) int num = 1; for (int i = 0; i < _rowsUsed; i++) { num = Mathf.Max(num, _counts[i]); } for (int j = 0; j < 3; j++) { bool flag = j < _rowsUsed; ((Component)_rowBg[j]).gameObject.SetActive(flag); if (flag) { bool flag2 = _finished && j == _winnerIndex; bool flag3 = _finished && j != _winnerIndex; float num2 = (flag2 ? 1f : Mathf.Clamp01((float)_counts[j] / (float)num)); float num3 = 438f; RectTransform val = (RectTransform)((Component)_rowFill[j]).transform; val.sizeDelta = new Vector2(num3 * num2, 34f); Color color = (flag2 ? BarWinner : BarOrange); ((Graphic)_rowFill[j]).color = color; ((Component)_rowFill[j]).gameObject.SetActive(flag2 || _counts[j] > 0); _rowLabel[j].text = $"{j + 1}|{_labels[j]}"; ((Graphic)_rowLabel[j]).color = (Color)(flag3 ? new Color(1f, 1f, 1f, 0.45f) : RowText); string text = (flag2 ? " \ud83c\udfc6" : ""); _rowCount[j].text = _counts[j] + text; ((Graphic)_rowCount[j]).color = (Color)(flag3 ? new Color(1f, 1f, 1f, 0.45f) : RowText); } } } private void Build() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00d6: Expected O, but got Unknown //IL_00f1: 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) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0216: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Expected O, but got Unknown //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) _white = MakeWhiteSprite(); _canvas = ((Component)this).gameObject.AddComponent(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 1000; CanvasScaler val = ((Component)this).gameObject.AddComponent(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1080f); val.matchWidthOrHeight = 0.5f; ((Component)this).gameObject.AddComponent(); float num = Mathf.Clamp01(ModConfig.HudAnchorX.Value); float num2 = Mathf.Clamp01(ModConfig.HudAnchorY.Value); float num3 = Mathf.Max(0.3f, ModConfig.HudScale.Value); Image val2 = NewImage(((Component)this).transform, "Panel", PanelColor); _panel = (RectTransform)((Component)val2).transform; RectTransform panel = _panel; RectTransform panel2 = _panel; RectTransform panel3 = _panel; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(num, num2); panel3.pivot = val3; Vector2 val4 = (panel.anchorMin = (panel2.anchorMax = val3)); _panel.sizeDelta = new Vector2(470f, 232f); _panel.anchoredPosition = Vector2.zero; ((Transform)_panel).localScale = new Vector3(num3, num3, 1f); _title = NewText((Transform)(object)_panel, "Title", ">SONDAGE", 30, (TextAnchor)0, HeaderText, (FontStyle)1); Place(((Graphic)_title).rectTransform, 16f, 16f, 438f, 36f); _clockIcon = NewImage((Transform)(object)_panel, "ClockIcon", HeaderText); _clockIcon.sprite = MakeClockSprite(); RectTransform val7 = (RectTransform)((Component)_clockIcon).transform; ((Vector2)(ref val4))..ctor(1f, 1f); val7.anchorMax = val4; val7.anchorMin = val4; val7.pivot = new Vector2(1f, 0.5f); val7.sizeDelta = new Vector2(26f, 26f); val7.anchoredPosition = new Vector2(-76f, -34f); _timer = NewText((Transform)(object)_panel, "Timer", "", 26, (TextAnchor)5, HeaderText, (FontStyle)1); RectTransform rectTransform = ((Graphic)_timer).rectTransform; ((Vector2)(ref val4))..ctor(1f, 1f); rectTransform.anchorMax = val4; rectTransform.anchorMin = val4; rectTransform.pivot = new Vector2(1f, 0.5f); rectTransform.sizeDelta = new Vector2(58f, 34f); rectTransform.anchoredPosition = new Vector2(-16f, -34f); _instruction = NewText((Transform)(object)_panel, "Instruction", "", 18, (TextAnchor)0, HeaderText, (FontStyle)0); Place(((Graphic)_instruction).rectTransform, 16f, 58f, 438f, 26f); int num4 = 92; for (int i = 0; i < 3; i++) { int num5 = num4 + i * 43; Image val8 = NewImage((Transform)(object)_panel, "RowBg" + i, RowEmpty); _rowBg[i] = val8; Place((RectTransform)((Component)val8).transform, 16f, num5, 438f, 34f); Image val9 = NewImage(((Component)val8).transform, "RowFill" + i, BarOrange); _rowFill[i] = val9; RectTransform val10 = (RectTransform)((Component)val9).transform; val10.anchorMin = new Vector2(0f, 1f); val10.anchorMax = new Vector2(0f, 1f); val10.pivot = new Vector2(0f, 1f); val10.anchoredPosition = Vector2.zero; val10.sizeDelta = new Vector2(0f, 34f); Text val11 = NewText(((Component)val8).transform, "RowLabel" + i, "", 18, (TextAnchor)3, RowText, (FontStyle)1); Place(((Graphic)val11).rectTransform, 10f, 0f, 368f, 34f); ((Graphic)val11).rectTransform.anchoredPosition = new Vector2(10f, 0f); StretchVert(((Graphic)val11).rectTransform); Text val12 = NewText(((Component)val8).transform, "RowCount" + i, "", 18, (TextAnchor)5, RowText, (FontStyle)1); RectTransform rectTransform2 = ((Graphic)val12).rectTransform; rectTransform2.anchorMin = new Vector2(1f, 0f); rectTransform2.anchorMax = new Vector2(1f, 1f); rectTransform2.pivot = new Vector2(1f, 0.5f); rectTransform2.sizeDelta = new Vector2(90f, 0f); rectTransform2.anchoredPosition = new Vector2(-10f, 0f); _rowLabel[i] = val11; _rowCount[i] = val12; } } private void SetVisible(bool v) { if ((Object)(object)_panel != (Object)null) { ((Component)_panel).gameObject.SetActive(v); } } private Image NewImage(Transform parent, string name, Color color) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(parent, false); Image component = val.GetComponent(); component.sprite = _white; component.type = (Type)0; ((Graphic)component).color = color; return component; } private Text NewText(Transform parent, string name, string text, int size, TextAnchor anchor, Color color, FontStyle style) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0063: 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_0073: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text) }); val.transform.SetParent(parent, false); Text component = val.GetComponent(); component.text = text; component.font = GetFont(); component.fontSize = size; component.fontStyle = style; component.alignment = anchor; ((Graphic)component).color = color; component.horizontalOverflow = (HorizontalWrapMode)1; component.verticalOverflow = (VerticalWrapMode)1; return component; } private static void Place(RectTransform rt, float x, float y, float w, float h) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = new Vector2(0f, 1f); rt.anchorMax = new Vector2(0f, 1f); rt.pivot = new Vector2(0f, 1f); rt.sizeDelta = new Vector2(w, h); rt.anchoredPosition = new Vector2(x, 0f - y); } private static void StretchVert(RectTransform rt) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) rt.anchorMin = new Vector2(0f, 0f); rt.anchorMax = new Vector2(0f, 1f); rt.pivot = new Vector2(0f, 0.5f); } private static Font GetFont() { Font val = null; try { val = Resources.GetBuiltinResource("LegacyRuntime.ttf"); } catch { } if ((Object)(object)val == (Object)null) { try { val = Resources.GetBuiltinResource("Arial.ttf"); } catch { } } if ((Object)(object)val == (Object)null) { val = Font.CreateDynamicFontFromOSFont("Consolas", 16); } return val; } private static Sprite MakeWhiteSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Texture2D whiteTexture = Texture2D.whiteTexture; return Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f), 100f); } private static Sprite MakeClockSprite() { //IL_0006: 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_0013: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; Color32[] px = (Color32[])(object)new Color32[4096]; for (int i = 0; i < px.Length; i++) { px[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); } float num = 31.5f; float num2 = 28f; float num3 = 21f; float num4 = 4.5f; Color32 on = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); for (int j = 0; j < 64; j++) { for (int k = 0; k < 64; k++) { float num5 = (float)k - num; float num6 = (float)j - num2; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6); if (num7 <= num3 && num7 >= num3 - num4) { Set(k, j); } } } FillRect((int)num - 2, (int)num + 1, (int)(num2 + num3), (int)(num2 + num3) + 4); FillRect((int)num - 4, (int)num + 3, (int)(num2 + num3) + 4, (int)(num2 + num3) + 6); Line(num, num2, num, num2 + num3 * 0.55f, 2.2f); Line(num, num2, num + num3 * 0.62f, num2 + num3 * 0.2f, 2.2f); Line(num, num2, num, num2, 3f); val.SetPixels32(px); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); void FillRect(int x0, int x1, int y0, int y1) { for (int l = y0; l <= y1; l++) { for (int m = x0; m <= x1; m++) { Set(m, l); } } } void Line(float x0, float y0, float x1, float y1, float w) { float num8 = Mathf.Max(Mathf.Abs(x1 - x0), Mathf.Abs(y1 - y0)) * 2f + 1f; int num9 = Mathf.CeilToInt(w / 2f); for (int l = 0; (float)l <= num8; l++) { float num10 = (float)l / num8; int num11 = Mathf.RoundToInt(Mathf.Lerp(x0, x1, num10)); int num12 = Mathf.RoundToInt(Mathf.Lerp(y0, y1, num10)); for (int m = -num9; m <= num9; m++) { for (int n = -num9; n <= num9; n++) { Set(num11 + n, num12 + m); } } } } void Set(int x, int y) { //IL_001f: 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) if (x >= 0 && x < 64 && y >= 0 && y < 64) { px[y * 64 + x] = on; } } } } } namespace ChatChaos.Twitch { public class TwitchClient { public readonly struct ChatLine { public readonly string User; public readonly string Message; public ChatLine(string user, string message) { User = user; Message = message; } } private const string Host = "irc.chat.twitch.tv"; private TcpClient? _tcp; private Stream? _stream; private StreamReader? _reader; private StreamWriter? _writer; private Thread? _thread; private volatile bool _running; private volatile bool _connected; private volatile bool _canPost; private string _channel = ""; private string _nick = ""; private string _token = ""; private bool _ssl; private readonly object _writeLock = new object(); private readonly ConcurrentQueue _incoming = new ConcurrentQueue(); public static TwitchClient? Instance { get; private set; } public bool IsConnected => _connected; public bool CanPost { get { if (_connected) { return _canPost; } return false; } } public static void StartFromConfig() { Stop(); if (!ModConfig.TwitchEnabled.Value) { Plugin.Log.LogInfo((object)"Twitch: integration disabled in config. Polls will pick random options."); return; } string text = (ModConfig.TwitchChannel.Value ?? "").Trim().TrimStart('#').ToLowerInvariant(); if (text.Length == 0) { Plugin.Log.LogWarning((object)"Twitch: no Channel set in config — cannot connect. Set Twitch/Channel (and OAuthToken to post messages)."); return; } string text2 = NormalizeToken(ModConfig.TwitchOAuthToken.Value); string text3 = ((text2.Length > 0) ? ModConfig.EffectiveUsername().Trim().ToLowerInvariant() : ("justinfan" + new Random().Next(10000, 99999))); if (text3.Length == 0) { text3 = text; } Instance = new TwitchClient { _channel = text, _nick = text3, _token = text2, _ssl = ModConfig.TwitchUseSsl.Value }; Instance.Start(); } public static void Stop() { Instance?.Dispose(); Instance = null; } private void Start() { _running = true; _thread = new Thread(RunLoop) { IsBackground = true, Name = "ChatChaos-Twitch" }; _thread.Start(); } private void RunLoop() { int num = 0; while (_running) { try { Connect(); num = 0; ReadUntilClosed(); } catch (Exception ex) { if (_running) { Plugin.Log.LogWarning((object)("Twitch: connection error: " + ex.Message)); } } _connected = false; CloseSocket(); if (!_running) { break; } num++; int num2 = Math.Min(30, 3 * (int)Math.Pow(2.0, Math.Min(num - 1, 3))); for (int i = 0; i < num2 * 10; i++) { if (!_running) { break; } Thread.Sleep(100); } } } private void Connect() { int port = (_ssl ? 6697 : 6667); _tcp = new TcpClient(); _tcp.Connect("irc.chat.twitch.tv", port); Stream stream = _tcp.GetStream(); if (_ssl) { SslStream sslStream = new SslStream(stream, leaveInnerStreamOpen: false, (object s, X509Certificate c, X509Chain ch, SslPolicyErrors e) => true); sslStream.AuthenticateAsClient("irc.chat.twitch.tv"); stream = sslStream; } _stream = stream; _reader = new StreamReader(_stream, Encoding.UTF8); _writer = new StreamWriter(_stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)) { AutoFlush = true, NewLine = "\r\n" }; if (_token.Length > 0) { SendRaw("PASS " + _token); } SendRaw("NICK " + _nick); SendRaw("JOIN #" + _channel); _canPost = _token.Length > 0; _connected = true; Plugin.Log.LogInfo((object)("Twitch: connected to #" + _channel + " as " + _nick + " (" + (_canPost ? "read + post" : "read-only") + ").")); } private void ReadUntilClosed() { string line; while (_running && _reader != null && (line = _reader.ReadLine()) != null) { HandleLine(line); } } private void HandleLine(string line) { if (line.StartsWith("PING")) { string text = ((line.Length > 5) ? line.Substring(5) : ":tmi.twitch.tv"); SendRaw("PONG " + text); return; } int num = line.IndexOf(" PRIVMSG ", StringComparison.Ordinal); if (num < 0 || !line.StartsWith(":")) { return; } int num2 = line.IndexOf('!'); if (num2 <= 1) { return; } string text2 = line.Substring(1, num2 - 1); int num3 = line.IndexOf(" :", num, StringComparison.Ordinal); if (num3 >= 0) { string text3 = line.Substring(num3 + 2).Trim(); if (text2.Length > 0 && text3.Length > 0) { _incoming.Enqueue(new ChatLine(text2, text3)); } } } public bool TryDequeue(out ChatLine line) { return _incoming.TryDequeue(out line); } public void SendMessage(string text) { if (!_canPost || !_connected || string.IsNullOrEmpty(text)) { return; } try { lock (_writeLock) { _writer?.WriteLine("PRIVMSG #" + _channel + " :" + text); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Twitch: failed to send message: " + ex.Message)); } } private void SendRaw(string raw) { lock (_writeLock) { _writer?.WriteLine(raw); } } private void CloseSocket() { try { _reader?.Dispose(); } catch { } try { _writer?.Dispose(); } catch { } try { _stream?.Dispose(); } catch { } try { _tcp?.Close(); } catch { } _reader = null; _writer = null; _stream = null; _tcp = null; } public void Dispose() { _running = false; _connected = false; CloseSocket(); try { _thread?.Join(500); } catch { } _thread = null; } private static string NormalizeToken(string? raw) { string text = (raw ?? "").Trim(); if (text.Length == 0) { return ""; } if (text.StartsWith("oauth:", StringComparison.OrdinalIgnoreCase)) { return text; } return "oauth:" + text; } } } namespace ChatChaos.Patches { [HarmonyPatch] public static class BerserkPatches { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] public static bool DamagePrefix(PlayerControllerB __instance) { return !Berserk.IsInvincible(__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] public static bool KillPrefix(PlayerControllerB __instance) { return !Berserk.IsInvincible(__instance); } } } namespace ChatChaos.Networking { public class ChatChaosNetworker : NetworkBehaviour { private static bool _warnedRpc; private const int MaxHp = 100; private static float _savedTimeMultiplier = 1f; private static GrabbableObject? _hostBerserkShotgun; public static ChatChaosNetworker? Instance { get; private set; } public static ChatChaosNetworker? Active { get { if ((Object)(object)Instance != (Object)null) { return Instance; } Instance = Object.FindObjectOfType(); return Instance; } } public override void OnNetworkSpawn() { Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); Plugin.Log.LogInfo((object)"ChatChaosNetworker ready (network active)."); } public override void OnNetworkDespawn() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } ((NetworkBehaviour)this).OnNetworkDespawn(); } private static void Safe(Action rpc) { try { rpc(); } catch (Exception ex) { if (!_warnedRpc) { _warnedRpc = true; Plugin.Log.LogWarning((object)("Networking note: an RPC could not be sent. This is harmless in solo and if the build isn't fully netcode-patched; multiplayer sync may be limited. (" + ex.Message + ")")); } } } public void BroadcastStart(string l0, string l1, string l2, float duration) { if (((NetworkBehaviour)this).IsServer) { PollHud.Instance?.ShowPoll(l0, l1, l2, duration); Safe(delegate { StartPollClientRpc(l0, l1, l2, duration); }); } } public void BroadcastCounts(int c0, int c1, int c2) { if (((NetworkBehaviour)this).IsServer) { PollHud.Instance?.UpdateCounts(c0, c1, c2); Safe(delegate { CountsClientRpc(c0, c1, c2); }); } } public void BroadcastEnd(int winnerIndex, int winnerCount) { if (((NetworkBehaviour)this).IsServer) { PollHud.Instance?.ShowResult(winnerIndex, winnerCount); Safe(delegate { EndPollClientRpc(winnerIndex, winnerCount); }); } } public void BroadcastHide() { if (((NetworkBehaviour)this).IsServer) { PollHud.Instance?.Hide(); Safe(delegate { HideClientRpc(); }); } } public void BroadcastTip(string header, string body) { if (((NetworkBehaviour)this).IsServer) { GameTips.Show(header, body); Safe(delegate { TipClientRpc(header, body); }); } } public void BroadcastPause() { if (((NetworkBehaviour)this).IsServer) { PollHud.Instance?.Pause(); Safe(delegate { PauseClientRpc(); }); } } public void KillPlayer(int index) { if (((NetworkBehaviour)this).IsServer) { KillIfLocalTarget(index); Safe(delegate { KillPlayerClientRpc(index); }); } } [ClientRpc] private void KillPlayerClientRpc(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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1905460702u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1905460702u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { KillIfLocalTarget(index); } } } private static void KillIfLocalTarget(int index) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null) && instance.allPlayerScripts != null && index >= 0 && index < instance.allPlayerScripts.Length) { PlayerControllerB val = instance.allPlayerScripts[index]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)instance.localPlayerController) && !val.isPlayerDead) { val.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3), false); } } } public void DropAllItems() { if (((NetworkBehaviour)this).IsServer) { DropLocalPlayerItems(); Safe(delegate { DropAllItemsClientRpc(); }); } } [ClientRpc] private void DropAllItemsClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3823407637u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3823407637u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { DropLocalPlayerItems(); } } } private static void DropLocalPlayerItems() { //IL_0038: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null)) { PlayerControllerB localPlayerController = instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead) { localPlayerController.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } } } public void SetOneHp() { if (((NetworkBehaviour)this).IsServer) { SetLocalPlayerOneHp(); Safe(delegate { SetOneHpClientRpc(); }); } } [ClientRpc] private void SetOneHpClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(8917357u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 8917357u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { SetLocalPlayerOneHp(); } } } private static void SetLocalPlayerOneHp() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return; } PlayerControllerB localPlayerController = instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead) { int num = localPlayerController.health - 1; if (num > 0) { localPlayerController.DamagePlayer(num, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } public void HealAll() { if (((NetworkBehaviour)this).IsServer) { HealAllPlayersLocal(); Safe(delegate { HealAllClientRpc(); }); } } [ClientRpc] private void HealAllClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(640034695u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 640034695u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { HealAllPlayersLocal(); } } } public void SetGroupCredits(int credits) { if (((NetworkBehaviour)this).IsServer) { ApplyGroupCreditsLocal(credits); Safe(delegate { SetGroupCreditsClientRpc(credits); }); } } [ClientRpc] private void SetGroupCreditsClientRpc(int credits) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1004467159u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, credits); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1004467159u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyGroupCreditsLocal(credits); } } } private static void ApplyGroupCreditsLocal(int credits) { Terminal val = Object.FindObjectOfType(); if (!((Object)(object)val == (Object)null)) { val.groupCredits = credits; } } public void ChangeScrapValues(int percent) { if (((NetworkBehaviour)this).IsServer) { ApplyScrapValueChangeLocal(percent); Safe(delegate { ChangeScrapValuesClientRpc(percent); }); } } [ClientRpc] private void ChangeScrapValuesClientRpc(int percent) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1274065427u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, percent); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1274065427u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyScrapValueChangeLocal(percent); } } } private static void ApplyScrapValueChangeLocal(int percent) { float num = 1f + (float)percent / 100f; GrabbableObject[] array = Object.FindObjectsOfType(); int num2 = 0; GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.itemProperties == (Object)null) && val.itemProperties.isScrap) { int num3 = (val.scrapValue = Mathf.Max(0, Mathf.RoundToInt((float)val.scrapValue * num))); ScanNodeProperties componentInChildren = ((Component)val).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = $"Value: ${num3}"; } num2++; } } Plugin.Log.LogInfo((object)string.Format("ChatChaos: scrap value {0}{1}% applied to {2} item(s).", (percent >= 0) ? "+" : "", percent, num2)); } public void SetBatteries(float charge) { if (((NetworkBehaviour)this).IsServer) { ApplyBatteryChargeLocal(charge); Safe(delegate { SetBatteriesClientRpc(charge); }); } } [ClientRpc] private void SetBatteriesClientRpc(float charge) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1981296301u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref charge, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1981296301u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyBatteryChargeLocal(charge); } } } private static void ApplyBatteryChargeLocal(float charge) { charge = Mathf.Clamp01(charge); GrabbableObject[] array = Object.FindObjectsOfType(); int num = 0; GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.itemProperties == (Object)null) && val.itemProperties.requiresBattery && val.insertedBattery != null) { val.insertedBattery.charge = charge; val.insertedBattery.empty = charge <= 0f; num++; } } Plugin.Log.LogInfo((object)$"ChatChaos: set battery to {Mathf.RoundToInt(charge * 100f)}% on {num} item(s)."); } public void SetDoors(bool unlock) { if (((NetworkBehaviour)this).IsServer) { ApplyBigDoorsHost(unlock); ApplyClassicDoorsLocal(unlock); Safe(delegate { ClassicDoorsClientRpc(unlock); }); } } [ClientRpc] private void ClassicDoorsClientRpc(bool unlock) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1394449627u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref unlock, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1394449627u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyClassicDoorsLocal(unlock); } } } private static void ApplyBigDoorsHost(bool unlock) { int num = 0; TerminalAccessibleObject[] array = Object.FindObjectsOfType(); foreach (TerminalAccessibleObject val in array) { if (!((Object)(object)val == (Object)null) && val.isBigDoor) { val.SetDoorOpenServerRpc(unlock); num++; } } if (num > 0) { Plugin.Log.LogInfo((object)string.Format("ChatChaos: {0} {1} big door(s).", unlock ? "opened" : "closed", num)); } } private static void ApplyClassicDoorsLocal(bool unlock) { int num = 0; DoorLock[] array = Object.FindObjectsOfType(); foreach (DoorLock val in array) { if ((Object)(object)val == (Object)null) { continue; } if (unlock) { if (val.isLocked) { val.UnlockDoor(); num++; } } else if (!val.isDoorOpened && !val.isLocked) { val.LockDoor(30f); num++; } } if (num > 0) { Plugin.Log.LogInfo((object)string.Format("ChatChaos: {0} {1} classic door(s).", unlock ? "unlocked" : "locked", num)); } } public void SetTimeFrozen(bool frozen) { if (((NetworkBehaviour)this).IsServer) { ApplyTimeFrozenLocal(frozen); Safe(delegate { SetTimeFrozenClientRpc(frozen); }); } } [ClientRpc] private void SetTimeFrozenClientRpc(bool frozen) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1447575031u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref frozen, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1447575031u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyTimeFrozenLocal(frozen); } } } private static void ApplyTimeFrozenLocal(bool frozen) { TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return; } if (frozen) { if (instance.globalTimeSpeedMultiplier > 0f) { _savedTimeMultiplier = instance.globalTimeSpeedMultiplier; } instance.globalTimeSpeedMultiplier = 0f; Plugin.Log.LogInfo((object)"ChatChaos: in-game time frozen."); } else { instance.globalTimeSpeedMultiplier = ((_savedTimeMultiplier > 0f) ? _savedTimeMultiplier : 1f); Plugin.Log.LogInfo((object)"ChatChaos: in-game time resumed."); } } public void TeleportToShip() { if (((NetworkBehaviour)this).IsServer) { TeleportLocalToShip(); Safe(delegate { TeleportToShipClientRpc(); }); } } [ClientRpc] private void TeleportToShipClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4145462141u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4145462141u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { TeleportLocalToShip(); } } } private static void TeleportLocalToShip() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return; } PlayerControllerB localPlayerController = instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || localPlayerController.isPlayerDead) { return; } Transform[] playerSpawnPositions = instance.playerSpawnPositions; if (playerSpawnPositions != null && playerSpawnPositions.Length != 0) { int num = Array.IndexOf(instance.allPlayerScripts, localPlayerController); int num2 = Mathf.Clamp((num >= 0) ? num : 0, 0, playerSpawnPositions.Length - 1); if (!((Object)(object)playerSpawnPositions[num2] == (Object)null)) { localPlayerController.TeleportPlayer(playerSpawnPositions[num2].position, false, 0f, false, true); localPlayerController.isInElevator = true; localPlayerController.isInHangarShipRoom = true; localPlayerController.isInsideFactory = false; } } } public void StartStaminaBoost(float seconds) { if (((NetworkBehaviour)this).IsServer) { StaminaBoost.Activate(seconds); ShowEffectTimer("stamina", "fx.stamina", seconds); Safe(delegate { StaminaBoostClientRpc(seconds); }); } } [ClientRpc] private void StaminaBoostClientRpc(float seconds) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3885039656u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref seconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3885039656u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { StaminaBoost.Activate(seconds); } } } public void StartSpeedBoost(float seconds) { if (((NetworkBehaviour)this).IsServer) { SpeedBoost.Activate(seconds); ShowEffectTimer("speed", "fx.speed", seconds); Safe(delegate { SpeedBoostClientRpc(seconds); }); } } [ClientRpc] private void SpeedBoostClientRpc(float seconds) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2683613781u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref seconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2683613781u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { SpeedBoost.Activate(seconds); } } } public void SetShipLocked(bool locked) { if (((NetworkBehaviour)this).IsServer) { ApplyShipLockedLocal(locked); Safe(delegate { SetShipLockedClientRpc(locked); }); } } [ClientRpc] private void SetShipLockedClientRpc(bool locked) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3127508880u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref locked, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3127508880u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyShipLockedLocal(locked); } } } private static void ApplyShipLockedLocal(bool locked) { StartMatchLever val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null && (Object)(object)val.triggerScript != (Object)null) { val.triggerScript.interactable = !locked; } HangarShipDoor val2 = Object.FindObjectOfType(); if ((Object)(object)val2 != (Object)null) { if ((Object)(object)val2.shipDoorsAnimator != (Object)null) { val2.shipDoorsAnimator.SetBool("Closed", locked); } string[] array = new string[4] { "doorButtons", "buttons", "interactTriggers", "triggers" }; foreach (string text in array) { try { if (!(Traverse.Create((object)val2).Field(text).GetValue() is InteractTrigger[] array2)) { continue; } InteractTrigger[] array3 = array2; foreach (InteractTrigger val3 in array3) { if ((Object)(object)val3 != (Object)null) { val3.interactable = !locked; } } } catch { } } } Plugin.Log.LogInfo((object)("ChatChaos: ship " + (locked ? "locked (door closed, lever blocked)" : "unlocked") + ".")); } public void ReviveTeam() { if (((NetworkBehaviour)this).IsServer) { ApplyReviveLocal(); Safe(delegate { ReviveTeamClientRpc(); }); } } [ClientRpc] private void ReviveTeamClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3255136564u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3255136564u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyReviveLocal(); } } } private static void ApplyReviveLocal() { StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null)) { instance.ReviveDeadPlayers(); Plugin.Log.LogInfo((object)"ChatChaos: revived dead players (teleported to the ship)."); } } public void SetFacilityPower(bool on) { if (((NetworkBehaviour)this).IsServer) { ApplyPowerLocal(on); Safe(delegate { SetFacilityPowerClientRpc(on); }); } } [ClientRpc] private void SetFacilityPowerClientRpc(bool on) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3774307684u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref on, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3774307684u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyPowerLocal(on); } } } private static void ApplyPowerLocal(bool on) { BreakerBox target = Object.FindObjectOfType(); RoundManager instance = RoundManager.Instance; bool flag = TryInvoke(target, "SwitchBreaker", on) || TryInvoke(instance, "SwitchPower", on) || TryInvoke(instance, on ? "PowerSwitchOn" : "PowerSwitchOff") || TryInvoke(instance, on ? "TurnOnAllLights" : "TurnOffAllLights"); Plugin.Log.LogInfo((object)("ChatChaos: facility power " + (on ? "on" : "off") + " -> " + (flag ? "applied" : "NO matching method found (tell the dev)."))); } private static bool TryInvoke(object target, string method, params object[] args) { if (target == null) { return false; } try { Traverse val = Traverse.Create(target).Method(method, args); if (val.MethodExists()) { val.GetValue(); return true; } } catch { } return false; } public void SetWeather(int weather) { if (((NetworkBehaviour)this).IsServer) { ApplyWeatherLocal(weather); Safe(delegate { SetWeatherClientRpc(weather); }); } } [ClientRpc] private void SetWeatherClientRpc(int weather) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2895239465u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, weather); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2895239465u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyWeatherLocal(weather); } } } private static void ApplyWeatherLocal(int weather) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0025: 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) LevelWeatherType val = (LevelWeatherType)weather; StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.currentLevel != (Object)null) { instance.currentLevel.currentWeather = val; } TimeOfDay instance2 = TimeOfDay.Instance; if ((Object)(object)instance2 != (Object)null) { try { Traverse.Create((object)instance2).Field("currentLevelWeather").SetValue((object)val); } catch { } ToggleWeatherEffects(instance2, weather); } Plugin.Log.LogInfo((object)$"[ChatChaos][Weather] applied '{val}'."); } public void ShowBerserkSignal() { if (((NetworkBehaviour)this).IsServer) { BerserkHud.Instance?.ShowSignal(); Safe(delegate { ShowBerserkSignalClientRpc(); }); } } [ClientRpc] private void ShowBerserkSignalClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2932696264u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2932696264u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { BerserkHud.Instance?.ShowSignal(); } } } public void SetBerserkPlayer(int index) { if (((NetworkBehaviour)this).IsServer) { Berserk.SetActivePlayer(index); Safe(delegate { SetBerserkPlayerClientRpc(index); }); } } [ClientRpc] private void SetBerserkPlayerClientRpc(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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2917893799u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2917893799u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { Berserk.SetActivePlayer(index); } } } public void ShowEffectTimer(string id, string labelKey, float seconds) { if (((NetworkBehaviour)this).IsServer) { EffectTimers.Start(id, labelKey, seconds); Safe(delegate { ShowEffectTimerClientRpc(id, labelKey, seconds); }); } } [ClientRpc] private void ShowEffectTimerClientRpc(string id, string labelKey, float seconds) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0158: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1941508532u, val2, (RpcDelivery)0); bool flag = id != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(id, false); } bool flag2 = labelKey != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(labelKey, false); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref seconds, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1941508532u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { EffectTimers.Start(id, labelKey, seconds); } } } public void ResetDayTime() { if (((NetworkBehaviour)this).IsServer) { ApplyResetDayTimeLocal(); Safe(delegate { ResetDayTimeClientRpc(); }); } } [ClientRpc] private void ResetDayTimeClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3614851500u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3614851500u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyResetDayTimeLocal(); } } } private static void ApplyResetDayTimeLocal() { TimeOfDay instance = TimeOfDay.Instance; if (!((Object)(object)instance == (Object)null)) { instance.currentDayTime = 0f; Plugin.Log.LogInfo((object)"[ChatChaos][Time] day clock reset to the morning start."); } } public void GiveBerserkShotgun(int index) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a9: 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) if (!((NetworkBehaviour)this).IsServer) { return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null || index < 0 || index >= instance.allPlayerScripts.Length) { return; } Item val = FindShotgunItem(); if ((Object)(object)val == (Object)null || (Object)(object)val.spawnPrefab == (Object)null) { Plugin.Log.LogWarning((object)"[ChatChaos][Berserk] shotgun item not found in the item list."); return; } PlayerControllerB val2 = instance.allPlayerScripts[index]; GameObject val3 = Object.Instantiate(val.spawnPrefab, ((Component)val2).transform.position + Vector3.up * 0.6f, Quaternion.identity); GrabbableObject component = val3.GetComponent(); NetworkObject netObj = val3.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)netObj == (Object)null) { Plugin.Log.LogWarning((object)"[ChatChaos][Berserk] shotgun prefab missing GrabbableObject/NetworkObject."); Object.Destroy((Object)(object)val3); return; } try { component.fallTime = 1f; } catch { } netObj.Spawn(false); _hostBerserkShotgun = component; Plugin.Log.LogInfo((object)$"[ChatChaos][Berserk] shotgun spawned for player index {index}."); Safe(delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) GiveShotgunClientRpc(new NetworkObjectReference(netObj), index); }); } [ClientRpc] private void GiveShotgunClientRpc(NetworkObjectReference reference, 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_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_007d: 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_008c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3630430346u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref reference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3630430346u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref reference)).TryGet(ref val3, (NetworkManager)null)) { return; } GrabbableObject component = ((Component)val3).GetComponent(); StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)component == (Object)null) && !((Object)(object)instance == (Object)null) && instance.allPlayerScripts != null && index >= 0 && index < instance.allPlayerScripts.Length) { PlayerControllerB val4 = instance.allPlayerScripts[index]; if (!((Object)(object)val4 != (Object)(object)instance.localPlayerController)) { BerserkShotgun.GrabAndHold(val4, component); } } } public void RemoveBerserkShotgun() { if (!((NetworkBehaviour)this).IsServer) { return; } if ((Object)(object)_hostBerserkShotgun != (Object)null) { NetworkObject component = ((Component)_hostBerserkShotgun).GetComponent(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } _hostBerserkShotgun = null; } BerserkShotgun.Clear(); Safe(delegate { ClearShotgunHoldClientRpc(); }); } [ClientRpc] private void ClearShotgunHoldClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(539324637u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 539324637u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { BerserkShotgun.Clear(); } } } public void ExplodeAllMines() { if (((NetworkBehaviour)this).IsServer) { DetonateAllMinesLocal(); Safe(delegate { ExplodeAllMinesClientRpc(); }); } } [ClientRpc] private void ExplodeAllMinesClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3515950212u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3515950212u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { DetonateAllMinesLocal(); } } } public void SetWinterSale(int seed) { if (((NetworkBehaviour)this).IsServer) { WinterSale.ApplyLocal(seed); Safe(delegate { SetWinterSaleClientRpc(seed); }); } } [ClientRpc] private void SetWinterSaleClientRpc(int seed) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1748623118u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, seed); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1748623118u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { WinterSale.ApplyLocal(seed); } } } public void EndWinterSale() { if (((NetworkBehaviour)this).IsServer) { WinterSale.RestoreLocal(); Safe(delegate { EndWinterSaleClientRpc(); }); } } [ClientRpc] private void EndWinterSaleClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3208031823u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3208031823u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { WinterSale.RestoreLocal(); } } } private static void DetonateAllMinesLocal() { int num = 0; Landmine[] array = Object.FindObjectsOfType(); foreach (Landmine val in array) { if (!((Object)(object)val == (Object)null) && !val.hasExploded) { try { val.Detonate(); num++; } catch { } } } Plugin.Log.LogInfo((object)$"[ChatChaos][Mines] detonated {num} mine(s)."); } private static Item? FindShotgunItem() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.allItemsList == (Object)null || instance.allItemsList.itemsList == null) { return null; } foreach (Item items in instance.allItemsList.itemsList) { if ((Object)(object)items != (Object)null && (Object)(object)items.spawnPrefab != (Object)null && (Object)(object)items.spawnPrefab.GetComponent() != (Object)null) { return items; } } return null; } private static void ToggleWeatherEffects(object tod, int activeIndex) { try { if (!(Traverse.Create(tod).Field("effects").GetValue() is Array array)) { return; } for (int i = 0; i < array.Length; i++) { object value = array.GetValue(i); if (value != null) { bool flag = i == activeIndex; try { Traverse.Create(value).Field("effectEnabled").SetValue((object)flag); } catch { } object value2 = Traverse.Create(value).Field("effectObject").GetValue(); GameObject val = (GameObject)((value2 is GameObject) ? value2 : null); if ((Object)(object)val != (Object)null) { val.SetActive(flag); } object value3 = Traverse.Create(value).Field("effectPermanentObject").GetValue(); GameObject val2 = (GameObject)((value3 is GameObject) ? value3 : null); if ((Object)(object)val2 != (Object)null) { val2.SetActive(flag); } } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[ChatChaos][Weather] effect toggle failed: " + ex.Message)); } } private static void HealAllPlayersLocal() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return; } PlayerControllerB localPlayerController = instance.localPlayerController; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead) { continue; } val.health = 100; if ((Object)(object)val == (Object)(object)localPlayerController) { val.criticallyInjured = false; val.bleedingHeavily = false; if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.UpdateHealthUI(100, false); } } } } [ClientRpc] private void StartPollClientRpc(string l0, string l1, string l2, float duration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0196: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3730553056u, val2, (RpcDelivery)0); bool flag = l0 != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(l0, false); } bool flag2 = l1 != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(l1, false); } bool flag3 = l2 != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(l2, false); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3730553056u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { PollHud.Instance?.ShowPoll(l0, l1, l2, duration); } } } [ClientRpc] private void CountsClientRpc(int c0, int c1, int c2) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_00e8: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3654448503u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, c0); BytePacker.WriteValueBitPacked(val, c1); BytePacker.WriteValueBitPacked(val, c2); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3654448503u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { PollHud.Instance?.UpdateCounts(c0, c1, c2); } } } [ClientRpc] private void EndPollClientRpc(int winnerIndex, int winnerCount) { //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_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(832785710u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, winnerIndex); BytePacker.WriteValueBitPacked(val, winnerCount); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 832785710u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { PollHud.Instance?.ShowResult(winnerIndex, winnerCount); } } } [ClientRpc] private void HideClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3519180947u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3519180947u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { PollHud.Instance?.Hide(); } } } [ClientRpc] private void TipClientRpc(string header, string body) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_013d: 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_00f8: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3489885205u, val2, (RpcDelivery)0); bool flag = header != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(header, false); } bool flag2 = body != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(body, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3489885205u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { GameTips.Show(header, body); } } } [ClientRpc] private void PauseClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(218091661u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 218091661u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { PollHud.Instance?.Pause(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)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 //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Expected O, but got Unknown //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1905460702u, new RpcReceiveHandler(__rpc_handler_1905460702), "KillPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(3823407637u, new RpcReceiveHandler(__rpc_handler_3823407637), "DropAllItemsClientRpc"); ((NetworkBehaviour)this).__registerRpc(8917357u, new RpcReceiveHandler(__rpc_handler_8917357), "SetOneHpClientRpc"); ((NetworkBehaviour)this).__registerRpc(640034695u, new RpcReceiveHandler(__rpc_handler_640034695), "HealAllClientRpc"); ((NetworkBehaviour)this).__registerRpc(1004467159u, new RpcReceiveHandler(__rpc_handler_1004467159), "SetGroupCreditsClientRpc"); ((NetworkBehaviour)this).__registerRpc(1274065427u, new RpcReceiveHandler(__rpc_handler_1274065427), "ChangeScrapValuesClientRpc"); ((NetworkBehaviour)this).__registerRpc(1981296301u, new RpcReceiveHandler(__rpc_handler_1981296301), "SetBatteriesClientRpc"); ((NetworkBehaviour)this).__registerRpc(1394449627u, new RpcReceiveHandler(__rpc_handler_1394449627), "ClassicDoorsClientRpc"); ((NetworkBehaviour)this).__registerRpc(1447575031u, new RpcReceiveHandler(__rpc_handler_1447575031), "SetTimeFrozenClientRpc"); ((NetworkBehaviour)this).__registerRpc(4145462141u, new RpcReceiveHandler(__rpc_handler_4145462141), "TeleportToShipClientRpc"); ((NetworkBehaviour)this).__registerRpc(3885039656u, new RpcReceiveHandler(__rpc_handler_3885039656), "StaminaBoostClientRpc"); ((NetworkBehaviour)this).__registerRpc(2683613781u, new RpcReceiveHandler(__rpc_handler_2683613781), "SpeedBoostClientRpc"); ((NetworkBehaviour)this).__registerRpc(3127508880u, new RpcReceiveHandler(__rpc_handler_3127508880), "SetShipLockedClientRpc"); ((NetworkBehaviour)this).__registerRpc(3255136564u, new RpcReceiveHandler(__rpc_handler_3255136564), "ReviveTeamClientRpc"); ((NetworkBehaviour)this).__registerRpc(3774307684u, new RpcReceiveHandler(__rpc_handler_3774307684), "SetFacilityPowerClientRpc"); ((NetworkBehaviour)this).__registerRpc(2895239465u, new RpcReceiveHandler(__rpc_handler_2895239465), "SetWeatherClientRpc"); ((NetworkBehaviour)this).__registerRpc(2932696264u, new RpcReceiveHandler(__rpc_handler_2932696264), "ShowBerserkSignalClientRpc"); ((NetworkBehaviour)this).__registerRpc(2917893799u, new RpcReceiveHandler(__rpc_handler_2917893799), "SetBerserkPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(1941508532u, new RpcReceiveHandler(__rpc_handler_1941508532), "ShowEffectTimerClientRpc"); ((NetworkBehaviour)this).__registerRpc(3614851500u, new RpcReceiveHandler(__rpc_handler_3614851500), "ResetDayTimeClientRpc"); ((NetworkBehaviour)this).__registerRpc(3630430346u, new RpcReceiveHandler(__rpc_handler_3630430346), "GiveShotgunClientRpc"); ((NetworkBehaviour)this).__registerRpc(539324637u, new RpcReceiveHandler(__rpc_handler_539324637), "ClearShotgunHoldClientRpc"); ((NetworkBehaviour)this).__registerRpc(3515950212u, new RpcReceiveHandler(__rpc_handler_3515950212), "ExplodeAllMinesClientRpc"); ((NetworkBehaviour)this).__registerRpc(1748623118u, new RpcReceiveHandler(__rpc_handler_1748623118), "SetWinterSaleClientRpc"); ((NetworkBehaviour)this).__registerRpc(3208031823u, new RpcReceiveHandler(__rpc_handler_3208031823), "EndWinterSaleClientRpc"); ((NetworkBehaviour)this).__registerRpc(3730553056u, new RpcReceiveHandler(__rpc_handler_3730553056), "StartPollClientRpc"); ((NetworkBehaviour)this).__registerRpc(3654448503u, new RpcReceiveHandler(__rpc_handler_3654448503), "CountsClientRpc"); ((NetworkBehaviour)this).__registerRpc(832785710u, new RpcReceiveHandler(__rpc_handler_832785710), "EndPollClientRpc"); ((NetworkBehaviour)this).__registerRpc(3519180947u, new RpcReceiveHandler(__rpc_handler_3519180947), "HideClientRpc"); ((NetworkBehaviour)this).__registerRpc(3489885205u, new RpcReceiveHandler(__rpc_handler_3489885205), "TipClientRpc"); ((NetworkBehaviour)this).__registerRpc(218091661u, new RpcReceiveHandler(__rpc_handler_218091661), "PauseClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1905460702(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; ((ChatChaosNetworker)(object)target).KillPlayerClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3823407637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).DropAllItemsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_8917357(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetOneHpClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_640034695(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).HealAllClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1004467159(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 groupCreditsClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref groupCreditsClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetGroupCreditsClientRpc(groupCreditsClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1274065427(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 percent = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref percent); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ChangeScrapValuesClientRpc(percent); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1981296301(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float batteriesClientRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref batteriesClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetBatteriesClientRpc(batteriesClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1394449627(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool unlock = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref unlock, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ClassicDoorsClientRpc(unlock); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1447575031(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool timeFrozenClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref timeFrozenClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetTimeFrozenClientRpc(timeFrozenClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4145462141(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).TeleportToShipClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3885039656(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float seconds = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref seconds, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).StaminaBoostClientRpc(seconds); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2683613781(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float seconds = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref seconds, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SpeedBoostClientRpc(seconds); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3127508880(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool shipLockedClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref shipLockedClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetShipLockedClientRpc(shipLockedClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3255136564(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ReviveTeamClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3774307684(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool facilityPowerClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref facilityPowerClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetFacilityPowerClientRpc(facilityPowerClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2895239465(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 weatherClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref weatherClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetWeatherClientRpc(weatherClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2932696264(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ShowBerserkSignalClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2917893799(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 berserkPlayerClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref berserkPlayerClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetBerserkPlayerClientRpc(berserkPlayerClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1941508532(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_009f: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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(ref flag, default(ForPrimitives)); string id = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref id, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string labelKey = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref labelKey, false); } float seconds = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref seconds, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ShowEffectTimerClientRpc(id, labelKey, seconds); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3614851500(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ResetDayTimeClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3630430346(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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference reference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref reference, default(ForNetworkSerializable)); int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).GiveShotgunClientRpc(reference, index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_539324637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ClearShotgunHoldClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3515950212(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).ExplodeAllMinesClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1748623118(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 winterSaleClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref winterSaleClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).SetWinterSaleClientRpc(winterSaleClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3208031823(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).EndWinterSaleClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3730553056(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_009f: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string l = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref l, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string l2 = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref l2, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag3, default(ForPrimitives)); string l3 = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref l3, false); } float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).StartPollClientRpc(l, l2, l3, duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3654448503(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_003d: 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_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int c = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref c); int c2 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref c2); int c3 = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref c3); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).CountsClientRpc(c, c2, c3); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_832785710(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int winnerIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref winnerIndex); int winnerCount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref winnerCount); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).EndPollClientRpc(winnerIndex, winnerCount); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3519180947(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).HideClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3489885205(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_0099: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string header = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref header, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string body = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref body, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).TipClientRpc(header, body); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_218091661(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChatChaosNetworker)(object)target).PauseClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ChatChaosNetworker"; } } public static class NetcodePatcher { [RuntimeInitializeOnLoadMethod] private static void Init() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0 && methodInfo.Name != "Init") { methodInfo.Invoke(null, null); } } } } } [HarmonyPatch] public static class NetworkObjectManager { private static GameObject? _networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void RegisterPrefab() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if ((Object)(object)_networkPrefab != (Object)null) { return; } try { if ((Object)(object)NetworkManager.Singleton == (Object)null) { Plugin.Log.LogError((object)"NetworkObjectManager: NetworkManager.Singleton is null; cannot register prefab."); return; } _networkPrefab = new GameObject("ChatChaosNetworkHandler"); Object.DontDestroyOnLoad((Object)(object)_networkPrefab); ((Object)_networkPrefab).hideFlags = (HideFlags)61; NetworkObject netObj = _networkPrefab.AddComponent(); _networkPrefab.AddComponent(); AssignStableHash(netObj, "ChatChaos.ChatChaosNetworker"); NetworkManager.Singleton.AddNetworkPrefab(_networkPrefab); Plugin.Log.LogInfo((object)"NetworkObjectManager: network prefab registered."); } catch (Exception arg) { Plugin.Log.LogError((object)$"NetworkObjectManager: failed to register prefab: {arg}"); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] public static void SpawnHandler() { try { NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null)) { if (!singleton.IsHost && !singleton.IsServer) { Plugin.Log.LogInfo((object)"NetworkObjectManager: client will receive the handler from the host."); return; } if ((Object)(object)ChatChaosNetworker.Instance != (Object)null) { PollManager.OnHostReady(); return; } if ((Object)(object)_networkPrefab == (Object)null) { Plugin.Log.LogError((object)"NetworkObjectManager: prefab is null (registration failed?); cannot spawn."); return; } GameObject val = Object.Instantiate(_networkPrefab); val.GetComponent().Spawn(false); Plugin.Log.LogInfo((object)"NetworkObjectManager: ChatChaosNetworker spawned by the host."); PollManager.OnHostReady(); } } catch (Exception arg) { Plugin.Log.LogError((object)$"NetworkObjectManager: failed to spawn handler: {arg}"); } } private static void AssignStableHash(NetworkObject netObj, string key) { uint hashCode = (uint)key.GetHashCode(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { Plugin.Log.LogError((object)"NetworkObjectManager: GlobalObjectIdHash field not found; spawn will likely fail."); } else { field.SetValue(netObj, hashCode); } } } } namespace ChatChaos.Logging { public static class Log { private const string Root = "ChatChaos"; public static void Info(string tag, string message) { Plugin.Log.LogInfo((object)("[ChatChaos][" + tag + "] " + message)); } public static void Warn(string tag, string message) { Plugin.Log.LogWarning((object)("[ChatChaos][" + tag + "] " + message)); } public static void Error(string tag, string message) { Plugin.Log.LogError((object)("[ChatChaos][" + tag + "] " + message)); } public static void Debug(string tag, string message) { if (ModConfig.VerboseLogging != null && ModConfig.VerboseLogging.Value) { Plugin.Log.LogInfo((object)("[ChatChaos][" + tag + "] " + message)); } } } } namespace ChatChaos.Localization { public enum Lang { English, French } public static class Loc { private static readonly Dictionary> _strings = new Dictionary>(); public static Lang Current { get; private set; } = Lang.English; public static void Init() { Build(); switch ((ModConfig.Language.Value ?? "Auto").Trim().ToLowerInvariant()) { case "french": case "fr": case "français": case "francais": Current = Lang.French; break; case "english": case "en": Current = Lang.English; break; default: Current = DetectGameLanguage(); break; } } private static Lang DetectGameLanguage() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)Application.systemLanguage != 14) { return Lang.English; } return Lang.French; } public static string Get(string key) { if (_strings.TryGetValue(Current, out Dictionary value) && value.TryGetValue(key, out var value2)) { return value2; } if (_strings.TryGetValue(Lang.English, out Dictionary value3) && value3.TryGetValue(key, out var value4)) { return value4; } return key; } public static string Format(string key, params object[] args) { return string.Format(Get(key), args); } private static void Build() { _strings[Lang.English] = new Dictionary { ["panel.title"] = ">POLL", ["panel.instruction"] = "Type 1, 2 or 3 in chat to vote.", ["panel.finished"] = "Voting is over.", ["chat.start"] = "A new vote starts! Type its number in the chat to make your choice.", ["chat.options"] = "1 - {0}, 2 - {1}, 3 - {2}", ["chat.ending"] = "Last call! Voting closes in {0}s.", ["chat.winner"] = "Voting closed! Winner: {0} with {1} votes.", ["chat.winner.novote"] = "Nobody voted, so fate decides: {0}!", ["chat.random_event"] = "Random event launched: {0}", ["chat.landed"] = "The ship has landed on {0}. Voting starts in {1} seconds.", ["chat.takeoff"] = "The ship has taken off. Polls are interrupted.", ["tip.connected.header"] = "ChatChaos - Twitch", ["tip.connected.body"] = "Connected as {0}.", ["tip.connected.readonly"] = "Connected in read-only mode (no token: votes count, no chat posts).", ["tip.client.header"] = "ChatChaos", ["tip.client.body"] = "You are not the host: your account is ignored. Only the host's chat drives the votes.", ["qod.header"] = "Double or Nothing", ["qod.armed"] = "When you leave, your credits will be either doubled or halved.", ["qod.win"] = "WON\nYou just won {0} credits.", ["qod.lose"] = "LOST\nYou just lost {0} credits.", ["fx.timefreeze"] = "Time frozen", ["fx.stamina"] = "Stamina", ["fx.shiplock"] = "Ship locked", ["fx.speed"] = "Fast & Serious", ["fx.micmute"] = "Mic muted", ["fx.soundmute"] = "Sound muted", ["fx.sale"] = "Sale", ["fx.berserk"] = "Berserk", ["tip.header"] = "ChatChaos - Twitch active", ["tip.landed"] = "Automatic polls are now active. Landed on {0}: first vote in {1}s." }; _strings[Lang.French] = new Dictionary { ["panel.title"] = ">SONDAGE", ["panel.instruction"] = "Envoyez 1, 2 ou 3 dans le tchat pour voter.", ["panel.finished"] = "Les votes sont terminés.", ["chat.start"] = "Un nouveau vote démarre ! Faites votre choix en tapant son numéro dans le chat.", ["chat.options"] = "1 - {0}, 2 - {1}, 3 - {2}", ["chat.ending"] = "Derniers instants ! Le vote se termine dans {0}s.", ["chat.winner"] = "Vote terminé ! Gagnant : {0} avec {1} votes.", ["chat.winner.novote"] = "Personne n'a voté, le sort décide : {0} !", ["chat.random_event"] = "Évènement aléatoire lancé : {0}", ["chat.landed"] = "Le vaisseau vient d'atterrir sur {0}. Les votes démarreront dans {1} secondes.", ["chat.takeoff"] = "Le vaisseau vient de décoller. Les sondages sont interrompus.", ["tip.connected.header"] = "ChatChaos - Twitch", ["tip.connected.body"] = "Connecté en tant que {0}.", ["tip.connected.readonly"] = "Connecté en lecture seule (sans jeton : les votes comptent, pas d'envoi dans le chat).", ["tip.client.header"] = "ChatChaos", ["tip.client.body"] = "Tu n'es pas l'hôte : ton compte est ignoré. Seul le chat de l'hôte pilote les votes.", ["qod.header"] = "Quitte ou Double", ["qod.armed"] = "Lorsque vous partirez, vos crédits seront soit doublés, soit divisés par 2.", ["qod.win"] = "GAGNÉ\nVous venez de gagner {0} crédits.", ["qod.lose"] = "PERDU\nVous venez de perdre {0} crédits.", ["fx.timefreeze"] = "Temps figé", ["fx.stamina"] = "Stamina", ["fx.shiplock"] = "Vaisseau bloqué", ["fx.speed"] = "Fast & Serious", ["fx.micmute"] = "Micro coupé", ["fx.soundmute"] = "Son coupé", ["fx.sale"] = "Soldes", ["fx.berserk"] = "Berserk", ["tip.header"] = "ChatChaos - Twitch activé", ["tip.landed"] = "Les sondages automatiques sont activés. Atterrissage sur {0} : premier vote dans {1}s." }; } } } namespace ChatChaos.Events { public static class EventActions { public static void KillRandomAlivePlayer() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return; } List list = new List(); for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { list.Add(i); } } if (list.Count == 0) { Plugin.Log.LogInfo((object)"random_death: no living player to kill."); return; } int num = list[Random.Range(0, list.Count)]; Plugin.Log.LogInfo((object)($"random_death: killing player index {num} " + $"(of {list.Count} alive).")); ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.KillPlayer(num); return; } PlayerControllerB val2 = instance.allPlayerScripts[num]; if ((Object)(object)val2 == (Object)(object)instance.localPlayerController && !val2.isPlayerDead) { val2.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3), false); } } public static void DropAllItemsFromLivingPlayers() { //IL_004f: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_006a: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.DropAllItems(); return; } StartOfRound instance = StartOfRound.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { val.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); } } public static void SetAllLivingPlayersToOneHp() { //IL_0061: 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) ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.SetOneHp(); return; } StartOfRound instance = StartOfRound.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead && val.health > 1) { val.DamagePlayer(val.health - 1, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } public static void HealAllLivingPlayersToMax() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.HealAll(); return; } StartOfRound instance = StartOfRound.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { val.health = 100; val.criticallyInjured = false; val.bleedingHeavily = false; if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.UpdateHealthUI(100, false); } } } public static void ChangeScrapValue(int percent) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.ChangeScrapValues(percent); } else { Plugin.Log.LogWarning((object)"ChatChaos: scrap value change skipped (networker not ready)."); } } public static void SetAllEquipmentBattery(float charge) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.SetBatteries(charge); } else { Plugin.Log.LogWarning((object)"ChatChaos: battery change skipped (networker not ready)."); } } public static void SetAllDoors(bool unlock) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.SetDoors(unlock); } else { Plugin.Log.LogWarning((object)"ChatChaos: door change skipped (networker not ready)."); } } public static void TeleportAllLivingToShip() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.TeleportToShip(); } else { Plugin.Log.LogWarning((object)"ChatChaos: teleport skipped (networker not ready)."); } } public static void BoostStamina(float seconds) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.StartStaminaBoost(seconds); } else { Plugin.Log.LogWarning((object)"ChatChaos: stamina boost skipped (networker not ready)."); } } public static void BoostSpeed(float seconds) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.StartSpeedBoost(seconds); } else { Plugin.Log.LogWarning((object)"ChatChaos: speed boost skipped (networker not ready)."); } } public static void ExplodeAllMines() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.ExplodeAllMines(); } else { Plugin.Log.LogWarning((object)"ChatChaos: explode mines skipped (networker not ready)."); } } public static void RandomDelivery() { Terminal val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null || val.buyableItemsList == null || val.buyableItemsList.Length == 0) { Plugin.Log.LogWarning((object)"[ChatChaos][Delivery] terminal / item list not found."); return; } int num = val.buyableItemsList.Length; int num2 = Random.Range(1, 9); int[] array = new int[num2]; for (int i = 0; i < num2; i++) { array[i] = Random.Range(0, num); } int num3 = val.numberOfItemsInDropship + num2; try { val.BuyItemsServerRpc(array, val.groupCredits, num3); Plugin.Log.LogInfo((object)$"[ChatChaos][Delivery] ordered {num2} random item(s) for free; dropship incoming."); } catch (Exception arg) { Plugin.Log.LogError((object)$"[ChatChaos][Delivery] failed: {arg}"); } } public static void LarvaeInfestation() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.SpawnedEnemies == null) { Plugin.Log.LogWarning((object)"[ChatChaos][Larvae] RoundManager / enemy list not ready."); return; } EnemyType val = FindSnareFleaType(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[ChatChaos][Larvae] Snare Flea enemy type not found."); return; } List list = new List(); foreach (EnemyAI spawnedEnemy in instance.SpawnedEnemies) { if ((Object)(object)spawnedEnemy != (Object)null && !spawnedEnemy.isEnemyDead && !spawnedEnemy.isOutside && (Object)(object)spawnedEnemy.enemyType != (Object)(object)val) { list.Add(spawnedEnemy); } } int num = 0; foreach (EnemyAI item in list) { Vector3 position = ((Component)item).transform.position; float y = ((Component)item).transform.eulerAngles.y; try { item.KillEnemyOnOwnerClient(true); instance.SpawnEnemyGameObject(position, y, -1, val); num++; } catch (Exception ex) { Plugin.Log.LogError((object)("[ChatChaos][Larvae] replace failed: " + ex.Message)); } } Plugin.Log.LogInfo((object)$"[ChatChaos][Larvae] replaced {num} indoor enemy(ies) with snare fleas."); } public static void ResetToMorning() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.ResetDayTime(); } else { Plugin.Log.LogWarning((object)"ChatChaos: reset day time skipped (networker not ready)."); } } private static EnemyType? FindSnareFleaType() { EnemyType[] array = Resources.FindObjectsOfTypeAll(); foreach (EnemyType val in array) { if (!((Object)(object)val == (Object)null)) { string text = (val.enemyName ?? "").ToLowerInvariant(); if (text.Contains("centipede") || text.Contains("snare") || text.Contains("flea")) { return val; } } } return null; } public static void ReviveDeadTeam() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.ReviveTeam(); return; } StartOfRound instance = StartOfRound.Instance; if (instance != null) { instance.ReviveDeadPlayers(); } } public static void SetFacilityPower(bool on) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.SetFacilityPower(on); } else { Plugin.Log.LogWarning((object)"ChatChaos: power change skipped (networker not ready)."); } } public static void TriggerRandomWeather() { //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_0096: 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_0104: Expected I4, but got Unknown //IL_0064: 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) SelectableLevel val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.currentLevel : null); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[ChatChaos][Weather] no current moon — weather skipped."); return; } List list = new List { (LevelWeatherType)(-1) }; if (val.randomWeathers != null) { RandomWeatherWithVariables[] randomWeathers = val.randomWeathers; foreach (RandomWeatherWithVariables val2 in randomWeathers) { if (val2 != null && !list.Contains(val2.weatherType)) { list.Add(val2.weatherType); } } } if (list.Count > 1) { list.Remove(val.currentWeather); } LevelWeatherType val3 = list[Random.Range(0, list.Count)]; Plugin.Log.LogInfo((object)($"[ChatChaos][Weather] '{val.PlanetName}': chose {val3} " + $"from {list.Count} candidate(s).")); ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.SetWeather((int)val3); } else { Plugin.Log.LogWarning((object)"[ChatChaos][Weather] networker not ready — weather skipped."); } } } public static class EventLibrary { public static void RegisterAll() { EventRegistry.Add("random_death", "Random death", "Mort aléatoire", delegate { EventActions.KillRandomAlivePlayer(); }); EventRegistry.Add("drop_items", "Items dropped", "Objets lâchés", delegate { EventActions.DropAllItemsFromLivingPlayers(); }); EventRegistry.Add("one_hp", "1 HP", "1 PV", delegate { EventActions.SetAllLivingPlayersToOneHp(); }); EventRegistry.Add("max_health", "Max health", "Santé max", delegate { EventActions.HealAllLivingPlayersToMax(); }); EventRegistry.Add("double_or_nothing", "Double or nothing", "Quitte ou double", delegate { DoubleOrNothing.Arm(); }); EventRegistry.AddDynamic("scrap_value_down", delegate { int pct = Random.Range(5, 51); return new ChatEvent("scrap_value_down", $"Scrap value -{pct}%", $"Valeur scrap -{pct}%", delegate { EventActions.ChangeScrapValue(-pct); }); }); EventRegistry.AddDynamic("scrap_value_up", delegate { int pct = Random.Range(5, 51); return new ChatEvent("scrap_value_up", $"Scrap value +{pct}%", $"Valeur scrap +{pct}%", delegate { EventActions.ChangeScrapValue(pct); }); }); EventRegistry.Add("recharge_gear", "Recharge equipment", "Recharge équipements", delegate { EventActions.SetAllEquipmentBattery(1f); }); EventRegistry.Add("discharge_gear", "Discharge equipment", "Décharge équipements", delegate { EventActions.SetAllEquipmentBattery(0f); }); EventRegistry.Add("unlock_doors", "Unlock doors", "Déverrouiller portes", delegate { EventActions.SetAllDoors(unlock: true); }); EventRegistry.Add("lock_doors", "Lock doors", "Verrouiller portes", delegate { EventActions.SetAllDoors(unlock: false); }); EventRegistry.Add("time_frozen", "Time frozen (1m)", "Temps figé (1m)", delegate { TimeFreeze.Freeze(60f); }); EventRegistry.Add("teleport_ship", "Teleport to ship", "Téléporter au vaisseau", delegate { EventActions.TeleportAllLivingToShip(); }); EventRegistry.Add("stamina_boost", "Stamina boost (1m)", "Stamina boostée (1m)", delegate { EventActions.BoostStamina(60f); }); EventRegistry.Add("ship_locked", "Ship locked (30s)", "Vaisseau bloqué (30s)", delegate { ShipLock.Lock(30f); }); EventRegistry.Add("revive_team", "Team revive", "Résurrection équipe", delegate { EventActions.ReviveDeadTeam(); }); EventRegistry.Add("weather_random", "Random weather", "Météo aléatoire", delegate { EventActions.TriggerRandomWeather(); }); EventRegistry.Add("berserk", "Berserk (45s)", "Berserk (45s)", delegate { Berserk.Trigger(); }); EventRegistry.Add("fast_serious", "Fast & Serious (30s)", "Fast & Serious (30s)", delegate { EventActions.BoostSpeed(30f); }); EventRegistry.Add("mute_mic", "Mute mic (1m)", "Coupe le micro (1m)", delegate { MicMute.Mute(60f); }); EventRegistry.Add("explode_mines", "Detonate all mines", "Exploser toutes les mines", delegate { EventActions.ExplodeAllMines(); }); EventRegistry.Add("mute_sound", "Mute sound (1m)", "Coupe le son (1m)", delegate { SoundMute.Mute(60f); }); EventRegistry.Add("winter_sale", "Winter sale (1m)", "Soldes d'hiver (1m)", delegate { WinterSale.Trigger(60f); }); EventRegistry.Add("random_delivery", "Random delivery", "Livraison aléatoire", delegate { EventActions.RandomDelivery(); }); EventRegistry.Add("larvae_infestation", "Larvae infestation", "Infestation de larves", delegate { EventActions.LarvaeInfestation(); }); EventRegistry.Add("random_event", "Random event", "Évènement aléatoire", delegate { RandomEvent.Trigger(); }); EventRegistry.Add("start_of_day", "Start of day", "Début de journée", delegate { EventActions.ResetToMorning(); }); EventRegistry.Add("power_on", "Turn power on", "Allumer courant", delegate { EventActions.SetFacilityPower(on: true); }); EventRegistry.Add("power_off", "Turn power off", "Eteindre courant", delegate { EventActions.SetFacilityPower(on: false); }); } } } namespace ChatChaos.Core { public static class Berserk { private enum Phase { Idle, Signal, Active } private const float SignalDuration = 3.5f; private const float BerserkDuration = 45f; private static int _activeIndex = -1; private static Phase _phase = Phase.Idle; private static int _pendingIndex = -1; private static float _phaseEndTime; public static void Reset() { _activeIndex = -1; _phase = Phase.Idle; _pendingIndex = -1; BerserkShotgun.Clear(); } public static void SetActivePlayer(int index) { _activeIndex = index; } public static bool IsInvincible(object player) { if (_activeIndex < 0) { return false; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return false; } if (_activeIndex >= instance.allPlayerScripts.Length) { return false; } return instance.allPlayerScripts[_activeIndex] == player; } public static void Trigger() { if (_phase != Phase.Idle) { Log.Info("Berserk", "trigger ignored (already running)."); return; } int num = PickRandomAlive(); if (num < 0) { Log.Warn("Berserk", "no living player to go berserk."); return; } _pendingIndex = num; _phase = Phase.Signal; _phaseEndTime = Time.time + 3.5f; ChatChaosNetworker.Active?.ShowBerserkSignal(); Log.Info("Berserk", $"RECEIVING SIGNAL shown; player index {num} goes berserk in {3.5f:0.0}s."); } public static void Tick() { if (_phase != Phase.Idle && !(Time.time < _phaseEndTime)) { if (_phase == Phase.Signal) { _phase = Phase.Active; _phaseEndTime = Time.time + 45f; ChatChaosNetworker.Active?.SetBerserkPlayer(_pendingIndex); ChatChaosNetworker.Active?.GiveBerserkShotgun(_pendingIndex); ChatChaosNetworker.Active?.ShowEffectTimer("berserk", "fx.berserk", 45f); Log.Info("Berserk", $"GO BERSERK — player index {_pendingIndex} invincible for {45f:0}s."); } else { _phase = Phase.Idle; ChatChaosNetworker.Active?.SetBerserkPlayer(-1); ChatChaosNetworker.Active?.RemoveBerserkShotgun(); _pendingIndex = -1; Log.Info("Berserk", "berserk ended."); } } } private static int PickRandomAlive() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return -1; } List list = new List(); for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { list.Add(i); } } if (list.Count != 0) { return list[Random.Range(0, list.Count)]; } return -1; } } public static class BerserkShotgun { private static object _held; public static void Clear() { _held = null; } public static void GrabAndHold(PlayerControllerB player, GrabbableObject grab) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) try { if (player.FirstEmptyItemSlot((GrabbableObject)null) == -1) { player.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } player.currentlyGrabbingObject = grab; player.GrabObjectServerRpc(new NetworkObjectReference(((NetworkBehaviour)grab).NetworkObject)); _held = grab; Log.Info("Berserk", "shotgun grabbed by the local player."); } catch (Exception arg) { Log.Error("Berserk", $"shotgun grab failed: {arg}"); } } public static void Tick() { if (_held == null) { return; } try { Traverse.Create(_held).Field("shellsLoaded").SetValue((object)2); } catch { } } } public static class ChatAnnounce { public static void Say(string text, bool inGame = true) { string text2 = (ModConfig.ChatPrefix.Value ?? "").Trim(); if (ModConfig.AnnounceInChat.Value) { TwitchClient.Instance?.SendMessage((text2.Length > 0) ? (text2 + " " + text) : text); } if (inGame && ModConfig.ShowInGameChat.Value) { string text3 = (ModConfig.InGameChatColorHex.Value ?? "").Trim(); string text4 = ((text2.Length == 0) ? "" : ((text3.Length > 0) ? ("" + text2 + " ") : (text2 + " "))); GameChat.Show(text4 + text); } } } public class ChatEvent { public string Id { get; } public string LabelEn { get; } public string LabelFr { get; } public Action Apply { get; } public string Label { get { if (Loc.Current != Lang.French) { return LabelEn; } return LabelFr; } } public ChatEvent(string id, string labelEn, string labelFr, Action apply) { Id = id; LabelEn = labelEn; LabelFr = labelFr; Apply = apply ?? ((Action)delegate { }); } } public static class DoubleOrNothing { private static bool _armed; private static bool _atCompany; public static void Reset() { _armed = false; _atCompany = false; } public static void Arm() { _armed = true; Plugin.Log.LogInfo((object)"DoubleOrNothing: armed — resolves at the next Company visit."); } public static void OnLanded(bool isCompany) { _atCompany = isCompany; if (isCompany && _armed) { ShowTip(Loc.Get("qod.header"), Loc.Get("qod.armed")); } } public static void OnTookOff() { if (!_armed || !_atCompany) { _atCompany = false; return; } _armed = false; _atCompany = false; Resolve(); } private static void Resolve() { Terminal val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"DoubleOrNothing: terminal not found — gamble skipped."); return; } int groupCredits = val.groupCredits; bool flag = Random.value < 0.5f; int num = (flag ? (groupCredits * 2) : (groupCredits / 2)); int num2 = Mathf.Abs(num - groupCredits); ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.SetGroupCredits(num); } else { val.groupCredits = num; } Plugin.Log.LogInfo((object)string.Format("DoubleOrNothing: {0} — credits {1} -> {2}.", flag ? "WON" : "LOST", groupCredits, num)); string body = (flag ? Loc.Format("qod.win", num2) : Loc.Format("qod.lose", num2)); ShowTip(Loc.Get("qod.header"), body); } private static void ShowTip(string header, string body) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastTip(header, body); } else { GameTips.Show(header, body); } } } public static class EffectTimers { private sealed class Entry { public string Id = ""; public string LabelKey = ""; public float EndTime; } private static readonly List _entries = new List(); public static void Reset() { _entries.Clear(); } public static void Start(string id, string labelKey, float seconds) { Entry entry = _entries.Find((Entry x) => x.Id == id); if (entry == null) { entry = new Entry { Id = id }; _entries.Add(entry); } entry.LabelKey = labelKey; entry.EndTime = Time.time + seconds; } public static void Stop(string id) { _entries.RemoveAll((Entry x) => x.Id == id); } public static void Tick() { for (int num = _entries.Count - 1; num >= 0; num--) { if (Time.time >= _entries[num].EndTime) { _entries.RemoveAt(num); } } } public static List<(string label, int secs)> GetActive() { List<(string, int)> list = new List<(string, int)>(); foreach (Entry entry in _entries) { int item = Mathf.Max(0, Mathf.CeilToInt(entry.EndTime - Time.time)); list.Add((Loc.Get(entry.LabelKey), item)); } return list; } } public static class EventRegistry { private sealed class Def { public string Id = ""; public Func Make; } private static readonly List _defs = new List(); private static readonly Random _rng = new Random(); public static int Count => _defs.Count; public static void Add(string id, string en, string fr, Action apply) { if (Validate(id)) { ChatEvent ev = new ChatEvent(id, en, fr, apply); _defs.Add(new Def { Id = id, Make = () => ev }); } } public static void AddDynamic(string id, Func factory) { if (Validate(id) && factory != null) { _defs.Add(new Def { Id = id, Make = factory }); } } private static bool Validate(string id) { if (string.IsNullOrWhiteSpace(id)) { Plugin.Log.LogWarning((object)"EventRegistry: event with an empty id skipped."); return false; } if (_defs.Exists((Def d) => d.Id == id)) { Plugin.Log.LogWarning((object)("EventRegistry: duplicate event id '" + id + "' ignored.")); return false; } return true; } public static void RegisterDefaults() { _defs.Clear(); EventLibrary.RegisterAll(); Log.Info("Init", $"{_defs.Count} event(s) loaded: " + string.Join(", ", _defs.ConvertAll((Def d) => d.Id))); } public static List PickRandom(int count) { List list = new List(_defs); List list2 = new List(); count = Math.Min(count, list.Count); for (int i = 0; i < count; i++) { int index = _rng.Next(list.Count); list2.Add(list[index].Make()); list.RemoveAt(index); } return list2; } public static ChatEvent? PickRandomExcluding(string excludeId) { List list = _defs.FindAll((Def d) => d.Id != excludeId); if (list.Count == 0) { return null; } return list[_rng.Next(list.Count)].Make(); } } public static class MicMute { private static float _endTime; private static bool _active; public static void Reset() { _endTime = 0f; if (_active) { SetMuted(muted: false); _active = false; } } public static void Mute(float seconds) { _endTime = Time.time + seconds; _active = true; SetMuted(muted: true); ChatChaosNetworker.Active?.ShowEffectTimer("micmute", "fx.micmute", seconds); Log.Info("Mic", $"host mic muted for {seconds:0}s."); } public static void Tick() { if (_active && Time.time >= _endTime) { SetMuted(muted: false); _active = false; Log.Info("Mic", "host mic unmuted."); } } private static void SetMuted(bool muted) { try { Type type = AccessTools.TypeByName("Dissonance.DissonanceComms"); if (type == null) { Log.Warn("Mic", "DissonanceComms type not found — cannot mute."); return; } Object val = Object.FindObjectOfType(type); if (val == (Object)null) { Log.Warn("Mic", "DissonanceComms instance not found — cannot mute."); return; } Traverse val2 = Traverse.Create((object)val).Property("IsMuted", (object[])null); if (val2.PropertyExists()) { val2.SetValue((object)muted); } else { Traverse.Create((object)val).Field("IsMuted").SetValue((object)muted); } } catch (Exception ex) { Log.Error("Mic", "failed to set mute: " + ex.Message); } } } public static class PollManager { private enum Phase { Idle, Scheduled, Voting, Result, Cancelled } private static Phase _phase = Phase.Idle; private static bool _landed; private static bool _pollsThisMoon; private static string _currentMoon = "?"; private static float _nextPollTime; private static float _pollEndTime; private static float _resultEndTime; private static float _lastCountsBroadcast; private static bool _endingAnnounced; private static bool _connTipShown; private static bool _clientNoticeDone; private static List _options = new List(); private static int[] _counts = new int[3]; private static readonly HashSet _voters = new HashSet(); private static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { if (!NetworkManager.Singleton.IsHost) { return NetworkManager.Singleton.IsServer; } return true; } return false; } } public static void OnHostReady() { if (IsHost) { _connTipShown = false; DoubleOrNothing.Reset(); TimeFreeze.Reset(); StaminaBoost.Reset(); ShipLock.Reset(); Berserk.Reset(); SpeedBoost.Reset(); MicMute.Reset(); SoundMute.Reset(); WinterSale.Reset(); EffectTimers.Reset(); TwitchClient.StartFromConfig(); } } private static bool IsAccountConnected() { return TwitchClient.Instance?.IsConnected ?? false; } public static void TickClientNotice() { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsConnectedClient) { _clientNoticeDone = false; } else if (!_clientNoticeDone) { if (singleton.IsHost || singleton.IsServer) { _clientNoticeDone = true; } else if (!ClientHasConfiguredAccount()) { _clientNoticeDone = true; } else if (!((Object)(object)HUDManager.Instance == (Object)null)) { _clientNoticeDone = true; Plugin.Log.LogInfo((object)"ChatChaos: you are not the host — your account is ignored. Only the host's chat drives the votes."); GameTips.Show(Loc.Get("tip.client.header"), Loc.Get("tip.client.body")); } } } private static bool ClientHasConfiguredAccount() { if (!ModConfig.TwitchEnabled.Value) { return false; } if (string.IsNullOrWhiteSpace(ModConfig.TwitchChannel.Value)) { return !string.IsNullOrWhiteSpace(ModConfig.TwitchOAuthToken.Value); } return true; } public static void OnLanded(bool isCompanyMoon, string moonName) { _landed = true; if (IsHost) { DoubleOrNothing.OnLanded(isCompanyMoon); if (isCompanyMoon && ModConfig.SkipCompanyMoon.Value) { Plugin.Log.LogInfo((object)"ChatChaos: safe moon — no polls here."); _pollsThisMoon = false; _phase = Phase.Idle; return; } if (EventRegistry.Count == 0) { Plugin.Log.LogWarning((object)"ChatChaos: no events registered — cannot run a poll."); _pollsThisMoon = false; _phase = Phase.Idle; return; } if (ModConfig.RequireConnectedAccount.Value && !IsAccountConnected()) { Plugin.Log.LogInfo((object)"ChatChaos: no chat account connected — no poll this landing (RequireConnectedAccount is on)."); _pollsThisMoon = false; _phase = Phase.Idle; return; } int num = Mathf.RoundToInt(Mathf.Max(0f, ModConfig.PollDelayAfterLanding.Value)); string text = (_currentMoon = (string.IsNullOrWhiteSpace(moonName) ? "?" : moonName.Trim())); UiHide(); _pollsThisMoon = true; _nextPollTime = Time.time + (float)num; _phase = Phase.Scheduled; Announce(Loc.Format("chat.landed", text, num)); ShowTip(Loc.Get("tip.header"), Loc.Format("tip.landed", text, num)); Plugin.Log.LogInfo((object)$"ChatChaos: landed on '{text}', first poll in {num}s."); } } public static void OnTookOff() { _landed = false; if (IsHost) { DoubleOrNothing.OnTookOff(); if (_pollsThisMoon) { Announce(Loc.Get("chat.takeoff")); } _pollsThisMoon = false; switch (_phase) { case Phase.Voting: UiPause(); _resultEndTime = Time.time + Mathf.Max(1f, ModConfig.ResultDisplayDuration.Value); _phase = Phase.Cancelled; Plugin.Log.LogInfo((object)"ChatChaos: ship left mid-poll — poll cancelled (frozen, no effect)."); break; case Phase.Scheduled: _phase = Phase.Idle; break; case Phase.Result: break; } } } public static void Tick() { if (!IsHost) { return; } ShowConnectionTipOnce(); DrainVotes(); switch (_phase) { case Phase.Scheduled: if (Time.time >= _nextPollTime) { StartPoll(); } break; case Phase.Voting: { float num = _pollEndTime - Time.time; if (!_endingAnnounced && num <= 10f) { _endingAnnounced = true; Announce(Loc.Format("chat.ending", 10), inGame: false); } if (Time.time - _lastCountsBroadcast >= 0.5f) { _lastCountsBroadcast = Time.time; UiCounts(); } if (num <= 0f) { EndPoll(); } break; } case Phase.Result: if (Time.time >= _resultEndTime) { UiHide(); if (_landed && ModConfig.PollRepeatInterval.Value > 0f && EventRegistry.Count > 0) { _nextPollTime = Time.time + ModConfig.PollRepeatInterval.Value; _phase = Phase.Scheduled; } else { _phase = Phase.Idle; } } break; case Phase.Cancelled: if (Time.time >= _resultEndTime) { UiHide(); _phase = Phase.Idle; } break; } } private static void ShowConnectionTipOnce() { if (!_connTipShown && ModConfig.TwitchEnabled.Value) { TwitchClient instance = TwitchClient.Instance; if (instance != null && instance.IsConnected) { _connTipShown = true; string body = (instance.CanPost ? Loc.Format("tip.connected.body", ModConfig.EffectiveUsername()) : Loc.Get("tip.connected.readonly")); ShowTip(Loc.Get("tip.connected.header"), body); } } } private static void StartPoll() { _options = EventRegistry.PickRandom(3); if (_options.Count == 0) { _phase = Phase.Idle; return; } _counts = new int[_options.Count]; _voters.Clear(); _endingAnnounced = false; _pollEndTime = Time.time + Mathf.Max(5f, ModConfig.PollDuration.Value); _lastCountsBroadcast = 0f; _phase = Phase.Voting; UiStart(); Announce(Loc.Get("chat.start")); Announce(Loc.Format("chat.options", Label(0), Label(1), Label(2))); Log.Info("Poll", "Opened on '" + _currentMoon + "' — options: [1) " + Label(0) + " | 2) " + Label(1) + " | 3) " + Label(2) + "] for " + $"{ModConfig.PollDuration.Value:0}s."); } private static void DrainVotes() { TwitchClient instance = TwitchClient.Instance; if (instance == null) { return; } TwitchClient.ChatLine line; while (instance.TryDequeue(out line)) { if (_phase != Phase.Voting) { continue; } int num = ParseChoice(line.Message); if (num >= 1 && num <= _options.Count) { if (!_voters.Add(line.User.ToLowerInvariant())) { Log.Debug("Poll", "vote ignored (already voted): " + line.User); continue; } _counts[num - 1]++; Log.Debug("Poll", $"vote: {line.User} -> {num} ('{Label(num - 1)}')"); } } } private static void EndPoll() { bool noVotes; int num = DecideWinner(out noVotes); int num2 = ((num >= 0 && num < _counts.Length) ? _counts[num] : 0); if (noVotes) { Announce(Loc.Format("chat.winner.novote", Label(num))); } else { Announce(Loc.Format("chat.winner", Label(num), num2)); } ChatEvent chatEvent = _options[num]; Log.Info("Poll", "Closed on '" + _currentMoon + "'. Winner: '" + chatEvent.Id + "' (" + chatEvent.Label + ") — " + string.Format("{0} vote(s){1}.", num2, noVotes ? ", random (nobody voted)" : "")); Log.Info("Event", "Applying '" + chatEvent.Id + "'..."); try { chatEvent.Apply(); Log.Info("Event", "'" + chatEvent.Id + "' applied OK."); } catch (Exception arg) { Log.Error("Event", $"'{chatEvent.Id}' FAILED to apply: {arg}"); } UiEnd(num, num2); _resultEndTime = Time.time + Mathf.Max(1f, ModConfig.ResultDisplayDuration.Value); _phase = Phase.Result; } private static int DecideWinner(out bool noVotes) { int num = -1; for (int i = 0; i < _counts.Length; i++) { if (_counts[i] > num) { num = _counts[i]; } } noVotes = num <= 0; List list = new List(); for (int j = 0; j < _counts.Length; j++) { if (noVotes || _counts[j] == num) { list.Add(j); } } return list[Random.Range(0, list.Count)]; } private static int ParseChoice(string message) { if (string.IsNullOrEmpty(message)) { return -1; } string s = message.Trim().Split(' ')[0]; if (!int.TryParse(s, out var result)) { return -1; } return result; } private static string Label(int i) { if (i < 0 || i >= _options.Count) { return ""; } return _options[i].Label; } private static void Announce(string text, bool inGame = true) { ChatAnnounce.Say(text, inGame); } private static void UiStart() { float value = ModConfig.PollDuration.Value; ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastStart(Label(0), Label(1), Label(2), value); } else { PollHud.Instance?.ShowPoll(Label(0), Label(1), Label(2), value); } } private static void UiCounts() { int c = ((_counts.Length != 0) ? _counts[0] : 0); int c2 = ((_counts.Length > 1) ? _counts[1] : 0); int c3 = ((_counts.Length > 2) ? _counts[2] : 0); ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastCounts(c, c2, c3); } else { PollHud.Instance?.UpdateCounts(c, c2, c3); } } private static void UiEnd(int winner, int winnerCount) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastEnd(winner, winnerCount); } else { PollHud.Instance?.ShowResult(winner, winnerCount); } } private static void UiHide() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastHide(); } else { PollHud.Instance?.Hide(); } } private static void UiPause() { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastPause(); } else { PollHud.Instance?.Pause(); } } private static void ShowTip(string header, string body) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active != (Object)null) { active.BroadcastTip(header, body); } else { GameTips.Show(header, body); } } } public class PollTicker : MonoBehaviour { private bool _prevLanded; public static PollTicker? Instance { get; private set; } public static void EnsureExists() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("ChatChaos_Ticker"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; Instance = val.AddComponent(); PollHud.EnsureExists(); BerserkHud.EnsureExists(); EffectTimerHud.EnsureExists(); } } private void Update() { PollManager.Tick(); PollManager.TickClientNotice(); TimeFreeze.Tick(); StaminaBoost.Tick(); ShipLock.Tick(); Berserk.Tick(); BerserkShotgun.Tick(); SpeedBoost.Tick(); MicMute.Tick(); SoundMute.Tick(); WinterSale.Tick(); EffectTimers.Tick(); TrackLanding(); } private void TrackLanding() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { _prevLanded = false; return; } bool flag = ReadLanded(instance); if (flag && !_prevLanded) { _prevLanded = true; PollManager.OnLanded(IsCompanyMoon(instance), MoonName(instance)); } else if (!flag && _prevLanded) { _prevLanded = false; PollManager.OnTookOff(); } } private static bool ReadLanded(StartOfRound sor) { bool flag = ReadBool(sor, "shipHasLanded"); bool flag2 = ReadBool(sor, "shipIsLeaving"); bool flag3 = ReadBool(sor, "inShipPhase"); if (flag && !flag2) { return !flag3; } return false; } private static bool ReadBool(StartOfRound sor, string field) { try { object value = Traverse.Create((object)sor).Field(field).GetValue(); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } catch { return false; } } private static string MoonName(StartOfRound sor) { try { return sor.currentLevel?.PlanetName ?? ""; } catch { return ""; } } private static bool IsCompanyMoon(StartOfRound sor) { try { SelectableLevel currentLevel = sor.currentLevel; if ((Object)(object)currentLevel == (Object)null) { return false; } if (currentLevel.levelID == 3) { return true; } string text = (currentLevel.PlanetName ?? "").ToLowerInvariant(); return text.Contains("company") || text.Contains("gordion"); } catch { return false; } } } public static class RandomEvent { public static void Trigger() { ChatEvent chatEvent = EventRegistry.PickRandomExcluding("random_event"); if (chatEvent == null) { Log.Warn("Event", "random event: no other event available to pick."); return; } ChatAnnounce.Say(Loc.Format("chat.random_event", chatEvent.Label)); Log.Info("Event", "random event picked '" + chatEvent.Id + "' (" + chatEvent.Label + ")."); try { chatEvent.Apply(); } catch (Exception arg) { Log.Error("Event", $"random event '{chatEvent.Id}' FAILED: {arg}"); } } } public static class ShipLock { private static bool _active; private static float _unlockTime; public static void Reset() { _active = false; } public static void Lock(float seconds) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active == (Object)null) { Plugin.Log.LogWarning((object)"ChatChaos: ship lock skipped (networker not ready)."); return; } _active = true; _unlockTime = Time.time + seconds; active.SetShipLocked(locked: true); active.ShowEffectTimer("shiplock", "fx.shiplock", seconds); Plugin.Log.LogInfo((object)$"ChatChaos: ship locked for {seconds:0}s."); } public static void Tick() { if (_active && Time.time >= _unlockTime) { _active = false; ChatChaosNetworker.Active?.SetShipLocked(locked: false); } } } public static class SoundMute { private static float _endTime; private static bool _active; private static float _savedVolume = 1f; public static void Reset() { _endTime = 0f; if (_active) { AudioListener.volume = _savedVolume; _active = false; } } public static void Mute(float seconds) { if (!_active) { _savedVolume = AudioListener.volume; } _endTime = Time.time + seconds; _active = true; AudioListener.volume = 0f; ChatChaosNetworker.Active?.ShowEffectTimer("soundmute", "fx.soundmute", seconds); Log.Info("Sound", $"host game sound muted for {seconds:0}s."); } public static void Tick() { if (!_active) { return; } if (Time.time < _endTime) { if (AudioListener.volume != 0f) { AudioListener.volume = 0f; } } else { AudioListener.volume = _savedVolume; _active = false; Log.Info("Sound", "host game sound restored."); } } } public static class SpeedBoost { private const float Multiplier = 1.8f; private static float _endTime; private static float _originalSpeed; private static bool _active; public static void Reset() { _endTime = 0f; if (_active) { PlayerControllerB val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.localPlayerController : null); if ((Object)(object)val != (Object)null) { val.movementSpeed = _originalSpeed; } _active = false; } } public static void Activate(float seconds) { _endTime = Time.time + seconds; } public static void Tick() { PlayerControllerB val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.localPlayerController : null); if (Time.time < _endTime && (Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead) { if (!_active) { _originalSpeed = val.movementSpeed; _active = true; } val.movementSpeed = _originalSpeed * 1.8f; } else if (_active) { if ((Object)(object)val != (Object)null) { val.movementSpeed = _originalSpeed; } _active = false; } } } public static class StaminaBoost { private const float BoostPerSecond = 0.06f; private static float _endTime; public static void Reset() { _endTime = 0f; } public static void Activate(float seconds) { _endTime = Time.time + seconds; } public static void Tick() { if (!(Time.time >= _endTime)) { PlayerControllerB val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.localPlayerController : null); if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead) { val.sprintMeter = Mathf.Clamp01(val.sprintMeter + 0.06f * Time.deltaTime); } } } } public static class TimeFreeze { private static bool _active; private static float _unfreezeTime; public static void Reset() { _active = false; } public static void Freeze(float seconds) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active == (Object)null) { Plugin.Log.LogWarning((object)"ChatChaos: time freeze skipped (networker not ready)."); return; } _active = true; _unfreezeTime = Time.time + seconds; active.SetTimeFrozen(frozen: true); active.ShowEffectTimer("timefreeze", "fx.timefreeze", seconds); Plugin.Log.LogInfo((object)$"ChatChaos: time freeze for {seconds:0}s."); } public static void Tick() { if (_active && Time.time >= _unfreezeTime) { _active = false; ChatChaosNetworker.Active?.SetTimeFrozen(frozen: false); } } } public static class WinterSale { private const int MinOff = 30; private const int MaxOff = 90; private static bool _active; private static float _endTime; private static int[]? _saved; private static bool _applied; public static void Reset() { _active = false; _endTime = 0f; if (_applied) { RestoreLocal(); } } public static void Trigger(float seconds) { if (!_active) { ChatChaosNetworker active = ChatChaosNetworker.Active; if ((Object)(object)active == (Object)null) { Log.Warn("Sale", "winter sale skipped (networker not ready)."); return; } int num = Random.Range(int.MinValue, int.MaxValue); _active = true; _endTime = Time.time + seconds; active.SetWinterSale(num); active.ShowEffectTimer("sale", "fx.sale", seconds); Log.Info("Sale", $"winter sale started for {seconds:0}s (seed {num})."); } } public static void Tick() { if (_active && Time.time >= _endTime) { _active = false; ChatChaosNetworker.Active?.EndWinterSale(); } } public static void ApplyLocal(int seed) { Terminal val = Object.FindObjectOfType(); if (!((Object)(object)val == (Object)null) && val.itemSalesPercentages != null) { int[] itemSalesPercentages = val.itemSalesPercentages; if (!_applied) { _saved = (int[])itemSalesPercentages.Clone(); _applied = true; } Random random = new Random(seed); for (int i = 0; i < itemSalesPercentages.Length; i++) { int num = random.Next(30, 91); itemSalesPercentages[i] = 100 - num; } Log.Info("Sale", $"applied winter sale to {itemSalesPercentages.Length} item(s)."); } } public static void RestoreLocal() { Terminal val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null && _saved != null && val.itemSalesPercentages != null && val.itemSalesPercentages.Length == _saved.Length) { Array.Copy(_saved, val.itemSalesPercentages, _saved.Length); Log.Info("Sale", "winter sale ended; original prices restored."); } _applied = false; _saved = null; } } } namespace ChatChaos.Config { public static class ModConfig { public static ConfigEntry TwitchEnabled; public static ConfigEntry TwitchOAuthToken; public static ConfigEntry TwitchChannel; public static ConfigEntry TwitchUsername; public static ConfigEntry TwitchUseSsl; public static ConfigEntry PollDelayAfterLanding; public static ConfigEntry PollDuration; public static ConfigEntry PollRepeatInterval; public static ConfigEntry ResultDisplayDuration; public static ConfigEntry SkipCompanyMoon; public static ConfigEntry RequireConnectedAccount; public static ConfigEntry AnnounceInChat; public static ConfigEntry ChatPrefix; public static ConfigEntry ShowInGameChat; public static ConfigEntry InGameChatColorHex; public static ConfigEntry Language; public static ConfigEntry HudAnchorX; public static ConfigEntry HudAnchorY; public static ConfigEntry HudScale; public static ConfigEntry TimerAnchorX; public static ConfigEntry TimerAnchorY; public static ConfigEntry VerboseLogging; public static void Init(ConfigFile cfg) { TwitchEnabled = cfg.Bind("Twitch", "Enabled", true, "Turn the Twitch integration on/off. When off, polls still run but votes come from nobody (so the mod picks a random option)."); TwitchOAuthToken = cfg.Bind("Twitch", "OAuthToken", "", "SECRET. OAuth token for your account (scopes chat:read + chat:edit). Raw or 'oauth:'-prefixed both work. NEVER share this token. See README to generate it."); TwitchChannel = cfg.Bind("Twitch", "Channel", "", "The Twitch channel to read votes from and post in (your login, lowercase)."); TwitchUsername = cfg.Bind("Twitch", "Username", "", "The login the token belongs to. Leave empty to reuse the Channel value."); TwitchUseSsl = cfg.Bind("Twitch", "UseSSL", false, "Connect over TLS (port 6697). Default false (plain IRC, port 6667) which is the most compatible. Try true if your network blocks the plain port."); PollDelayAfterLanding = cfg.Bind("Poll", "DelayAfterLanding", 45f, "Seconds after the ship lands on a moon before the first poll opens."); PollDuration = cfg.Bind("Poll", "Duration", 60f, "How long a poll stays open for voting, in seconds."); PollRepeatInterval = cfg.Bind("Poll", "RepeatInterval", 0f, "Seconds between polls on the same moon. 0 = a single poll per landing. Set e.g. 150 to run a new poll repeatedly until the ship leaves."); ResultDisplayDuration = cfg.Bind("Poll", "ResultDisplayDuration", 10f, "How long the winner panel stays on screen after voting ends, in seconds."); SkipCompanyMoon = cfg.Bind("Poll", "SkipCompanyMoon", true, "Do not run polls on the free 'safe' moon (the Company building)."); RequireConnectedAccount = cfg.Bind("Poll", "RequireConnectedAccount", false, "If true, polls only run when a chat account (Twitch) is connected. When no account is connected, no poll is started at all (instead of running polls with a random outcome). Default false."); AnnounceInChat = cfg.Bind("Chat", "AnnounceInChat", true, "Post poll messages (start, options, winner) in the Twitch chat under your account."); ChatPrefix = cfg.Bind("Chat", "Prefix", "[ChatChaos]", "Prefix added to every chat message the mod posts."); ShowInGameChat = cfg.Bind("Chat", "ShowInGameChat", true, "Also display poll messages (landing, start + options, winner, takeoff) in the in-game text chat, visible to every player in the lobby."); InGameChatColorHex = cfg.Bind("Chat", "InGameChatColor", "F0A91E", "HTML hex colour (no '#') of the mod prefix in the in-game chat. Default F0A91E (orange)."); Language = cfg.Bind("Display", "Language", "Auto", "Language of the on-screen panel and chat messages: Auto, English or French. Auto = French if the game/system language is French, English otherwise."); HudAnchorX = cfg.Bind("Display", "PanelAnchorX", 0.3f, "Horizontal position of the poll panel (0 = far left, 1 = far right)."); HudAnchorY = cfg.Bind("Display", "PanelAnchorY", 0.22f, "Vertical position of the poll panel (0 = bottom, 1 = top)."); HudScale = cfg.Bind("Display", "PanelScale", 1f, "Overall scale of the poll panel (1 = default size)."); TimerAnchorX = cfg.Bind("Display", "TimerPanelAnchorX", 0.985f, "Horizontal position of the effect-countdown panel (0 = far left, 1 = far right). Default right edge."); TimerAnchorY = cfg.Bind("Display", "TimerPanelAnchorY", 0.5f, "Vertical position of the effect-countdown panel (0 = bottom, 1 = top). Default vertical centre."); VerboseLogging = cfg.Bind("Debug", "VerboseLogging", false, "Write extra detailed logs (every vote, every network broadcast, etc.) to the BepInEx log. Turn on when hunting a bug; leave off for normal play."); } public static string EffectiveUsername() { string text = (TwitchUsername.Value ?? "").Trim(); if (text.Length <= 0) { return (TwitchChannel.Value ?? "").Trim(); } return text; } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace ChatChaos.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }