using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace ChatChaos; public class ConfigMenu : MonoBehaviour { private const int WindowId = 731205; private static readonly string[] Tabs = new string[3] { "Geral", "Eventos", "Testar" }; private bool _open; private Rect _window = new Rect(0f, 0f, 520f, 560f); private bool _placed; private int _tab; private Vector2 _eventScroll; private Vector2 _testScroll; private Vector2 _itemScroll; private int _dropdownFor = -1; private string _itemFilter = ""; private string _channelDraft = ""; private CursorLockMode _previousLock; private bool _previousVisible; private EventVoting _voting; private GUIStyle _header; private GUIStyle _sub; private string _keyDraft; private Vector2 _voiceScroll; private string _voiceStatus = ""; private static readonly string[] ModelIds = new string[2] { "eleven_multilingual_v2", "eleven_turbo_v2_5" }; private Vector2 _skinScroll; public bool IsOpen => _open; private void Start() { _voting = ((Component)this).GetComponent(); } private void Update() { if (ToggleKeyPressed()) { if (_open) { Close(); } else { Open(); } } } private void Open() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) _open = true; _previousLock = Cursor.lockState; _previousVisible = Cursor.visible; ForceCursor(); ItemCatalog.Refresh(); _channelDraft = Plugin.CfgChannel.Value; } private void Close() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) _open = false; _dropdownFor = -1; Cursor.lockState = _previousLock; Cursor.visible = _previousVisible; } private void ForceCursor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } private void LateUpdate() { if (_open) { ForceCursor(); } } private static bool ToggleKeyPressed() { try { Keyboard current = Keyboard.current; if (current != null) { return ((ButtonControl)current[(Key)99]).wasPressedThisFrame; } } catch { } try { return Input.GetKeyDown((KeyCode)287); } catch { } return false; } private void EnsureStyles() { if (_header == null) { _header = Skin.Title; _sub = Skin.Small; } } private void OnGUI() { //IL_0062: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_009e: 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) if (_open) { ForceCursor(); EnsureStyles(); if (!_placed) { ((Rect)(ref _window)).x = 40f; ((Rect)(ref _window)).y = Mathf.Max(30f, ((float)Screen.height - ((Rect)(ref _window)).height) / 2f); _placed = true; } GUI.Box(_window, GUIContent.none, Skin.Panel); _window = GUILayout.Window(731205, _window, new WindowFunction(DrawWindow), GUIContent.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[0]); } } private void DrawWindow(int id) { //IL_0039: 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_004d: 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_0099: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(6f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(" CHATCHAOS", Skin.Header, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }); Color color = GUI.color; GUI.color = (Lang.English ? Skin.Muted : Skin.Accent); if (GUILayout.Button("PT", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(44f), GUILayout.Height(36f) })) { Lang.SetEnglish(english: false); } GUI.color = (Lang.English ? Skin.Accent : Skin.Muted); if (GUILayout.Button("EN", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(44f), GUILayout.Height(36f) })) { Lang.SetEnglish(english: true); } GUI.color = color; GUILayout.EndHorizontal(); GUILayout.Space(8f); DrawStatusLine(); GUILayout.Space(6f); DrawCountdownLine(); GUILayout.Space(8f); string[] array = new string[6] { Lang.TabGeneral, Lang.TabEvents, Lang.TabZombies, Lang.TabVoice, Lang.TabSkins, Lang.TabTest }; _tab = GUILayout.Toolbar(_tab, array, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) }); GUILayout.Space(10f); if (_tab == 0) { DrawGeneral(); } else if (_tab == 1) { DrawEvents(); } else if (_tab == 2) { DrawZombies(); } else if (_tab == 3) { DrawVoiceTab(); } else if (_tab == 4) { DrawSkins(); } else { DrawTesting(); } GUILayout.Space(6f); if (GUILayout.Button(Lang.Close, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Close(); } GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } private void DrawStatusLine() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) bool inRoom = PhotonNetwork.InRoom; bool isMasterClient = PhotonNetwork.IsMasterClient; Color color = GUI.color; if (Plugin.IsGuest) { GUI.color = Skin.Accent; GUILayout.Label(Lang.GuestActive, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; } else { GUI.color = ((inRoom && isMasterClient) ? Skin.Good : Skin.Warn); GUILayout.Label((!inRoom) ? Lang.NoRoom : (isMasterClient ? Lang.HostOk : Lang.HostNo), Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; } } private void DrawCountdownLine() { //IL_0042: 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_0048: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsGuest) { return; } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if ((Object)(object)_voting == (Object)null) { GUILayout.Label(Lang.TimerUnavailable, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else if (!PhotonNetwork.InRoom) { Color color = GUI.color; GUI.color = Skin.Muted; GUILayout.Label(Lang.TimerWaitingRoom, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; } else if (_voting.Paused) { Color color2 = GUI.color; GUI.color = Skin.Warn; GUILayout.Label(Lang.PausedLine, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color2; } else { float secondsUntilNext = _voting.SecondsUntilNext; if (secondsUntilNext < 0f) { GUILayout.Label(Lang.TimerRunningNow, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { int num = Mathf.FloorToInt(secondsUntilNext / 60f); int num2 = Mathf.FloorToInt(secondsUntilNext % 60f); GUILayout.Label(Lang.NextVoteIn + " " + num.ToString("00") + ":" + num2.ToString("00"), Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } } GUILayout.FlexibleSpace(); Color color3 = GUI.color; GUI.color = Skin.Good; if (GUILayout.Button(Lang.StartNow, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(150f * Skin.Scale), GUILayout.Height(28f * Skin.Scale) }) && (Object)(object)_voting != (Object)null) { _voting.StartVote(); Close(); } GUI.color = color3; GUILayout.EndHorizontal(); GUILayout.Space(6f); bool flag = (Object)(object)_voting != (Object)null && _voting.Paused; GUI.color = (flag ? Skin.Good : Skin.Bad); if (GUILayout.Button(flag ? Lang.ModPausedStart : Lang.ModRunningPause, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f * Skin.Scale) }) && (Object)(object)_voting != (Object)null) { _voting.SetPaused(!flag); } GUI.color = color3; if (flag) { GUILayout.Label(Lang.PausedHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } } private void DrawGeneral() { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Lang.GuestSection, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); bool value = Plugin.CfgGuest.Value; Plugin.CfgGuest.Value = GUILayout.Toggle(value, Lang.GuestToggle, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (Plugin.CfgGuest.Value != value) { if (Plugin.CfgGuest.Value) { Plugin.Disconnect(); } else { Plugin.Reconnect(); } } GUILayout.Label(Lang.GuestHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgAskOnJoin.Value = GUILayout.Toggle(Plugin.CfgAskOnJoin.Value, Lang.AskOnJoin, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.Label(Lang.Channel, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); _channelDraft = GUILayout.TextField(_channelDraft, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); bool flag = _channelDraft.Trim() != Plugin.CfgChannel.Value.Trim(); GUI.enabled = flag && _channelDraft.Trim().Length > 0; Color color = GUI.color; if (flag) { GUI.color = Skin.Good; } if (GUILayout.Button(Lang.Apply, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(60f), GUILayout.Height(26f) })) { Plugin.CfgChannel.Value = _channelDraft.Trim(); Plugin.Reconnect(); } GUI.color = color; GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.Label(Lang.ChannelHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); color = GUI.color; if (Plugin.ChatConnected) { GUI.color = Skin.Good; GUILayout.Label(Lang.Connected + " #" + Plugin.CurrentChannel, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else if (Plugin.CfgChannel.Value.Length > 0) { GUI.color = Skin.Warn; GUILayout.Label(Lang.Connecting, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { GUI.color = Skin.Bad; GUILayout.Label(Lang.NotConnected, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUI.color = color; GUILayout.Space(12f); GUILayout.Label(Lang.Pacing, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgSecondsBetween.Value = Slider(Lang.SecondsBetween, Plugin.CfgSecondsBetween.Value, 10f, 600f, "0"); Plugin.CfgVoteSeconds.Value = Slider(Lang.VoteDuration, Plugin.CfgVoteSeconds.Value, 10f, 300f, "0"); Plugin.CfgResultSeconds.Value = Slider(Lang.ResultDuration, Plugin.CfgResultSeconds.Value, 2f, 60f, "0"); Plugin.CfgTornadoSeconds.Value = Slider(Lang.English ? "Tornado lasts (s)" : "Tornado dura (s)", Plugin.CfgTornadoSeconds.Value, 3f, 120f, "0"); GUILayout.Space(12f); GUILayout.Label(Lang.PanelSection, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgPanelOnLeft.Value = GUILayout.Toggle(Plugin.CfgPanelOnLeft.Value, Lang.PanelLeft, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgPanelWidth.Value = Slider(Lang.PanelWidth, Plugin.CfgPanelWidth.Value, 300f, 900f, "0"); Plugin.CfgPanelTop.Value = Slider(Lang.PanelTop, Plugin.CfgPanelTop.Value, 0f, Mathf.Max(100f, (float)Screen.height - 300f), "0"); Plugin.CfgFontScale.Value = Slider(Lang.FontSize, Plugin.CfgFontScale.Value, 0.7f, 2.5f, "0.00"); GUILayout.Space(12f); GUILayout.Label(Lang.ReceiverSection, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgRandomReceiver.Value = GUILayout.Toggle(Plugin.CfgRandomReceiver.Value, Lang.ReceiverRandom, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.ReceiverHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); GUILayout.Label(Lang.CursorNote, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); DrawDefaultsButton(new List { (ConfigEntryBase)(object)Plugin.CfgGuest, (ConfigEntryBase)(object)Plugin.CfgAskOnJoin, (ConfigEntryBase)(object)Plugin.CfgSecondsBetween, (ConfigEntryBase)(object)Plugin.CfgVoteSeconds, (ConfigEntryBase)(object)Plugin.CfgResultSeconds, (ConfigEntryBase)(object)Plugin.CfgTornadoSeconds, (ConfigEntryBase)(object)Plugin.CfgPanelOnLeft, (ConfigEntryBase)(object)Plugin.CfgPanelWidth, (ConfigEntryBase)(object)Plugin.CfgPanelTop, (ConfigEntryBase)(object)Plugin.CfgFontScale, (ConfigEntryBase)(object)Plugin.CfgRandomReceiver, (ConfigEntryBase)(object)Plugin.CfgQuickKeys }); } private void DrawVoiceTab() { //IL_0092: 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_009b: 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_0480: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) if (_keyDraft == null) { _keyDraft = Plugin.CfgElevenApiKey.Value; } GUILayout.Label(Lang.ApiKeyLabel, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); _keyDraft = GUILayout.PasswordField(_keyDraft, '*', (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f * Skin.Scale) }); bool flag = (GUI.enabled = _keyDraft.Trim() != Plugin.CfgElevenApiKey.Value.Trim()); Color color = GUI.color; if (flag) { GUI.color = Skin.Good; } if (GUILayout.Button(Lang.Ok, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(60f * Skin.Scale), GUILayout.Height(26f * Skin.Scale) })) { Plugin.CfgElevenApiKey.Value = _keyDraft.Trim(); Tts.Reset(); _voiceStatus = ""; } GUI.color = color; GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.Label(Lang.ApiKeyHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.Label(Lang.ModelLabel, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); int num = 0; for (int i = 0; i < ModelIds.Length; i++) { if (ModelIds[i] == Plugin.CfgElevenModel.Value) { num = i; } } string[] array = new string[2] { Lang.ModelMultilingual, Lang.ModelTurbo }; int num2 = GUILayout.Toolbar(num, array, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) }); if (num2 != num) { Plugin.CfgElevenModel.Value = ModelIds[num2]; Tts.Reset(); } GUILayout.Label(Lang.ModelHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); Plugin.CfgSpeakEvents.Value = GUILayout.Toggle(Plugin.CfgSpeakEvents.Value, Lang.SpeakEventsToggle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.SpeakEventsHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); Plugin.CfgVoicePitch.Value = Slider(Lang.VoicePitch, Plugin.CfgVoicePitch.Value, 0.5f, 2f, "0.00"); Plugin.CfgVoiceVolume.Value = Slider(Lang.VoiceVolume, Plugin.CfgVoiceVolume.Value, 0f, 1f, "0.00"); GUILayout.Space(10f); Plugin.CfgMemeSounds.Value = GUILayout.Toggle(Plugin.CfgMemeSounds.Value, Lang.MemeSoundsToggle, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgMemeVolume.Value = Slider(Lang.VoiceVolume + " (meme)", Plugin.CfgMemeVolume.Value, 0f, 1f, "0.00"); Plugin.CfgSacrificeEndSeconds.Value = Slider(Lang.SacrificeEndSeconds, Plugin.CfgSacrificeEndSeconds.Value, 0f, 30f, "0.0"); GUILayout.Label(Lang.SacrificeEndHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); Plugin.CfgSuspenseInterval.Value = Slider(Lang.SuspenseInterval, Plugin.CfgSuspenseInterval.Value, 2f, 120f, "0"); GUILayout.Space(10f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = Tts.Configured; if (GUILayout.Button(Lang.LoadVoices, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) })) { _voiceStatus = "..."; ((MonoBehaviour)this).StartCoroutine(Tts.FetchVoices(delegate(string error) { _voiceStatus = ((error == null) ? (Tts.Voices.Length + " vozes") : error); })); } if (GUILayout.Button(Lang.TestVoice, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f * Skin.Scale), GUILayout.Height(30f * Skin.Scale) })) { Tts.Speak(Lang.English ? "ChatChaos is ready" : "ChatChaos esta pronto", Plugin.CfgVoicePitch.Value); } GUI.enabled = true; GUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(_voiceStatus)) { GUILayout.Label(_voiceStatus, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.Space(8f); _voiceScroll = GUILayout.BeginScrollView(_voiceScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(170f * Skin.Scale) }); for (int num3 = 0; num3 < Tts.Voices.Length; num3++) { Tts.VoiceInfo voiceInfo = Tts.Voices[num3]; bool flag3 = voiceInfo.Id == Plugin.CfgElevenVoiceId.Value; Color color2 = GUI.color; if (!voiceInfo.FreePlanFriendly) { GUI.color = Skin.Muted; } else if (flag3) { GUI.color = Skin.Good; } if (GUILayout.Button((flag3 ? "> " : " ") + voiceInfo.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[0])) { Plugin.CfgElevenVoiceId.Value = voiceInfo.Id; Tts.Reset(); } GUI.color = color2; } GUILayout.EndScrollView(); DrawDefaultsButton(new List { (ConfigEntryBase)(object)Plugin.CfgSpeakEvents, (ConfigEntryBase)(object)Plugin.CfgVoicePitch, (ConfigEntryBase)(object)Plugin.CfgVoiceVolume, (ConfigEntryBase)(object)Plugin.CfgMemeSounds, (ConfigEntryBase)(object)Plugin.CfgMemeVolume, (ConfigEntryBase)(object)Plugin.CfgElevenModel, (ConfigEntryBase)(object)Plugin.CfgElevenVoiceId, (ConfigEntryBase)(object)Plugin.CfgElevenTimeout, (ConfigEntryBase)(object)Plugin.CfgElevenMinGap, (ConfigEntryBase)(object)Plugin.CfgSacrificeEndSeconds, (ConfigEntryBase)(object)Plugin.CfgSuspenseInterval }); } private static void RestoreDefaults(List entries) { for (int i = 0; i < entries.Count; i++) { if (entries[i] != null) { try { entries[i].BoxedValue = entries[i].DefaultValue; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui restaurar um ajuste: " + ex.Message)); } } } Skin.Invalidate(); Plugin.Log.LogInfo((object)"Ajustes desta aba voltaram ao padrao."); } private void DrawDefaultsButton(List entries) { //IL_000a: 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_0010: 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) GUILayout.Space(12f); Color color = GUI.color; GUI.color = Skin.Warn; if (GUILayout.Button(Lang.RestoreDefaults, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) })) { RestoreDefaults(entries); } GUI.color = color; GUILayout.Label(Lang.RestoreDefaultsHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } private void DrawSkins() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Lang.SkinsTitle, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.SkinsHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); Color color = GUI.color; GUI.color = Skin.Good; if (GUILayout.Button(Lang.ReloadSkins, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f * Skin.Scale) })) { ItemSkins.Apply(); } GUI.color = color; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(Lang.OpenSkinsFolder, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) })) { OpenSkinsFolder(); } GUILayout.Space(8f); GUI.color = Skin.Warn; if (GUILayout.Button(Lang.RestoreSkins, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) })) { ItemSkins.RestoreAll(); } GUI.color = color; GUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(ItemSkins.Status)) { GUILayout.Space(6f); GUILayout.Label(ItemSkins.Status, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.Space(12f); GUILayout.Label(Lang.SkinsItemList, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.SkinsExportHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _itemFilter = GUILayout.TextField(_itemFilter, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f * Skin.Scale) }); _skinScroll = GUILayout.BeginScrollView(_skinScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(220f * Skin.Scale) }); string[] names = ItemCatalog.Names; for (int i = 0; i < names.Length; i++) { if ((_itemFilter.Length <= 0 || names[i].IndexOf(_itemFilter, StringComparison.OrdinalIgnoreCase) >= 0) && GUILayout.Button(names[i], Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0])) { ItemSkins.Export(names[i]); } } GUILayout.EndScrollView(); } private static void OpenSkinsFolder() { ItemSkins.EnsureFolder(); try { Application.OpenURL("file:///" + ItemSkins.Folder.Replace("\\", "/")); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui abrir a pasta: " + ex.Message)); } } private float Slider(string label, float value, float min, float max, string format) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); float result = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(result.ToString(format), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }); GUILayout.EndHorizontal(); return result; } private void DrawEvents() { //IL_0022: 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_0041: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Lang.EventsHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); _eventScroll = GUILayout.BeginScrollView(_eventScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(340f) }); for (int i = 0; i < GameEvents.All.Count; i++) { DrawEventRow(GameEvents.All[i], i); GUILayout.Space(6f); } GUILayout.EndScrollView(); DrawDefaultsButton(EventEntries()); } private static List EventEntries() { List list = new List(); for (int i = 0; i < GameEvents.All.Count; i++) { GameEvent gameEvent = GameEvents.All[i]; list.Add((ConfigEntryBase)(object)gameEvent.Enabled); list.Add((ConfigEntryBase)(object)gameEvent.ItemName); list.Add((ConfigEntryBase)(object)gameEvent.Amount); list.Add((ConfigEntryBase)(object)gameEvent.Intensity); } return list; } private void DrawEventRow(GameEvent option, int index) { //IL_0020: 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_0053: 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_008b: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); Color color = GUI.color; GUI.color = (option.IsGood ? new Color(0.6f, 1f, 0.6f) : new Color(1f, 0.7f, 0.7f)); GUILayout.Label(option.IsGood ? "[+]" : "[-]", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }); GUI.color = color; option.Enabled.Value = GUILayout.Toggle(option.Enabled.Value, " " + option.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.Label(option.Description, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (option.UsesItem) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.Item, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }); if (GUILayout.Button(option.ItemName.Value + " ▼", (GUILayoutOption[])(object)new GUILayoutOption[0])) { _dropdownFor = ((_dropdownFor == index) ? (-1) : index); _itemFilter = ""; } GUILayout.EndHorizontal(); if (_dropdownFor == index) { DrawItemDropdown(option); } } if (option.UsesItem || option.Kind == EventKind.Tornado || option.Kind == EventKind.Zombies) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.Amount, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) }) && option.Amount.Value > 1) { ConfigEntry amount = option.Amount; amount.Value -= 1; } GUILayout.Label(option.Amount.Value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }); if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) })) { ConfigEntry amount2 = option.Amount; amount2.Value += 1; } GUILayout.EndHorizontal(); } if (option.UsesIntensity) { option.Intensity.Value = Slider(Lang.Intensity, option.Intensity.Value, 0.05f, 1f, "0.00"); } GUILayout.EndVertical(); } private void DrawItemDropdown(GameEvent option) { //IL_0086: 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_00a8: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.Search, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) }); _itemFilter = GUILayout.TextField(_itemFilter, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); string[] names = ItemCatalog.Names; if (names.Length == 0) { GUILayout.Label(Lang.NoItems, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { _itemScroll = GUILayout.BeginScrollView(_itemScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(150f) }); int num = 0; for (int i = 0; i < names.Length; i++) { if (_itemFilter.Length <= 0 || names[i].IndexOf(_itemFilter, StringComparison.OrdinalIgnoreCase) >= 0) { num++; string text = ((names[i] == option.ItemName.Value) ? "• " : " "); if (GUILayout.Button(text + names[i], (GUILayoutOption[])(object)new GUILayoutOption[0])) { option.ItemName.Value = names[i]; _dropdownFor = -1; } } } if (num == 0) { GUILayout.Label(Lang.NothingNamed, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.EndScrollView(); } GUILayout.EndVertical(); } private void DrawZombies() { GUILayout.Label(Lang.ZombieTuning, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.ZombieTuningHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); Plugin.CfgZombieStrength.Value = Slider(Lang.ZombieStrength, Plugin.CfgZombieStrength.Value, 0.25f, 4f, "0.00"); GUILayout.Label(Lang.ZombieStrengthHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); Plugin.CfgZombieSpeed.Value = Slider(Lang.ZombieSpeed, Plugin.CfgZombieSpeed.Value, 0.25f, 4f, "0.00"); GUILayout.Label(Lang.ZombieSpeedHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); Plugin.CfgZombieAggression.Value = Slider(Lang.ZombieAggression, Plugin.CfgZombieAggression.Value, 0.25f, 4f, "0.00"); GUILayout.Label(Lang.ZombieAggressionHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(Lang.PresetWeak, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SetTuning(0.5f, 0.6f, 0.6f); } if (GUILayout.Button(Lang.PresetNormal, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SetTuning(1f, 1f, 1f); } if (GUILayout.Button(Lang.PresetBrutal, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SetTuning(2.5f, 2f, 2f); } GUILayout.EndHorizontal(); GUILayout.Space(12f); if (GUILayout.Button(Lang.ApplyToExisting, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ZombieTuning.Reset(); ZombieTuning.ApplyToAll(); } GUILayout.Label(Lang.ApplyToExistingHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.Label(Lang.ZombieDefence, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.AmountEach, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f * Skin.Scale) }); if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) }) && Plugin.CfgZombieDefenseCount.Value > 1) { ConfigEntry cfgZombieDefenseCount = Plugin.CfgZombieDefenseCount; cfgZombieDefenseCount.Value -= 1; } GUILayout.Label(Plugin.CfgZombieDefenseCount.Value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }); if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) }) && Plugin.CfgZombieDefenseCount.Value < 10) { ConfigEntry cfgZombieDefenseCount2 = Plugin.CfgZombieDefenseCount; cfgZombieDefenseCount2.Value += 1; } GUILayout.EndHorizontal(); GUILayout.Label(Lang.ZombieDefenceHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); DrawDefaultsButton(new List { (ConfigEntryBase)(object)Plugin.CfgZombieStrength, (ConfigEntryBase)(object)Plugin.CfgZombieSpeed, (ConfigEntryBase)(object)Plugin.CfgZombieAggression, (ConfigEntryBase)(object)Plugin.CfgZombieLifetime, (ConfigEntryBase)(object)Plugin.CfgZombieDefenseItem, (ConfigEntryBase)(object)Plugin.CfgZombieDefenseCount }); } private static void SetTuning(float strength, float speed, float aggression) { Plugin.CfgZombieStrength.Value = strength; Plugin.CfgZombieSpeed.Value = speed; Plugin.CfgZombieAggression.Value = aggression; } private void DrawTesting() { //IL_0007: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsGuest) { Color color = GUI.color; GUI.color = Skin.Accent; GUILayout.Label(Lang.GuestActive, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; GUILayout.Space(6f); } if (GUILayout.Button(Lang.OpenVoteNow, (GUILayoutOption[])(object)new GUILayoutOption[0])) { if ((Object)(object)_voting != (Object)null) { _voting.StartVote(); } Close(); GUI.enabled = true; return; } GUILayout.Label(Lang.OpenVoteHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = true; GUILayout.Space(10f); Color color2 = GUI.color; GUI.color = Skin.Warn; if (GUILayout.Button(Lang.StopAll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameEvents.StopEverything(); } GUI.color = color2; GUILayout.Label(Lang.StopAllHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); for (int i = 0; i < GameEvents.All.Count; i++) { GameEvent gameEvent = GameEvents.All[i]; if (gameEvent.ManualOnly) { gameEvent.Intensity.Value = Slider(gameEvent.Title + (Lang.English ? " lasts (s)" : " dura (s)"), gameEvent.Intensity.Value, 0f, 900f, "0"); } } GUILayout.Space(10f); GUILayout.Label(Lang.FireEvent, _header, (GUILayoutOption[])(object)new GUILayoutOption[0]); _testScroll = GUILayout.BeginScrollView(_testScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(300f) }); for (int j = 0; j < GameEvents.All.Count; j++) { GameEvent gameEvent2 = GameEvents.All[j]; Color color3 = GUI.color; if (gameEvent2.ManualOnly) { GUI.color = Skin.Accent; } else { GUI.color = (gameEvent2.IsGood ? new Color(0.7f, 1f, 0.7f) : new Color(1f, 0.8f, 0.8f)); } string text = (gameEvent2.ManualOnly ? ("★ " + gameEvent2.Title) : ((gameEvent2.IsGood ? "[+] " : "[-] ") + gameEvent2.Title)); if (GUILayout.Button(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height((float)(gameEvent2.ManualOnly ? 34 : 24)) })) { Plugin.Log.LogInfo((object)("Teste manual: " + gameEvent2.Title)); try { gameEvent2.Run(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falhou: " + ex)); } } GUI.color = color3; } GUILayout.EndScrollView(); List list = new List(); for (int k = 0; k < GameEvents.All.Count; k++) { if (GameEvents.All[k].ManualOnly) { list.Add((ConfigEntryBase)(object)GameEvents.All[k].Intensity); } } list.Add((ConfigEntryBase)(object)Plugin.CfgSuspenseSound); list.Add((ConfigEntryBase)(object)Plugin.CfgSuspenseInterval); list.Add((ConfigEntryBase)(object)Plugin.CfgHoverSeconds); DrawDefaultsButton(list); } } public class EventVoting : MonoBehaviour { private enum Phase { Waiting, Voting, Announcing } private Phase _phase; private float _nextEventAt; private float _phaseEndsAt; private List _ballot = new List(); private readonly int[] _votes = new int[5]; private readonly HashSet _voters = new HashSet(); private GameEvent _winner; private string _winnerLine = ""; private int _winnerIndex = -1; private bool _wasInRoom; private float _nextBroadcast; public float SecondsUntilNext { get { if (_phase != Phase.Waiting) { return -1f; } return Mathf.Max(0f, _nextEventAt - Now); } } public bool IsIdle => _phase == Phase.Waiting; public bool Paused { get; private set; } private static float Now => Time.unscaledTime; public void SetPaused(bool paused) { if (Paused == paused) { return; } Paused = paused; if (!paused) { GameEvents.ResetSacrificeUse(); if (_phase == Phase.Waiting) { ScheduleNext(); } } Plugin.Log.LogInfo((object)(paused ? "Mod pausado: a contagem parou." : ("Mod iniciado: proxima votacao em " + Plugin.CfgSecondsBetween.Value + "s."))); } private void Start() { Paused = true; ScheduleNext(); } private void ScheduleNext() { _phase = Phase.Waiting; _nextEventAt = Now + Mathf.Max(5f, Plugin.CfgSecondsBetween.Value); } private void Update() { if (!Plugin.CfgEnabled.Value || Plugin.IsGuest) { return; } bool inRoom = PhotonNetwork.InRoom; if (inRoom != _wasInRoom) { _wasInRoom = inRoom; GameEvents.ForgetWorldState(); if (inRoom) { ItemSkins.Apply(); } if (inRoom) { Paused = true; ScheduleNext(); Plugin.Log.LogInfo((object)"Partida comecou. O mod entra PAUSADO: aperte F6 e clique em Iniciar quando quiser comecar."); } } if (!inRoom) { if (_phase == Phase.Waiting) { _nextEventAt = Now + Mathf.Max(5f, Plugin.CfgSecondsBetween.Value); } return; } Broadcast(); if (Paused && _phase == Phase.Waiting) { _nextEventAt = Now + Mathf.Max(5f, Plugin.CfgSecondsBetween.Value); return; } switch (_phase) { case Phase.Waiting: if (Now >= _nextEventAt) { StartVote(); } break; case Phase.Voting: if (Now >= _phaseEndsAt) { FinishVote(); } break; case Phase.Announcing: if (Now >= _phaseEndsAt) { ScheduleNext(); } break; } } private void Broadcast() { if (PhotonNetwork.IsMasterClient && !(Now < _nextBroadcast)) { _nextBroadcast = Now + 0.4f; string[] array = new string[_ballot.Count]; bool[] array2 = new bool[_ballot.Count]; int[] array3 = new int[_ballot.Count]; for (int i = 0; i < _ballot.Count; i++) { array[i] = _ballot[i].Title; array2[i] = _ballot[i].IsGood; array3[i] = _votes[i]; } byte phase = (byte)((_phase == Phase.Voting) ? 1 : ((_phase == Phase.Announcing) ? 2 : 0)); Net.SendVoteState(array, array2, array3, Mathf.Max(0f, _phaseEndsAt - Now), phase, _winnerLine, _winnerIndex); } } public void StartVote() { if (Plugin.IsGuest) { Plugin.Log.LogInfo((object)"Modo convidado: a votacao e do host."); return; } _ballot = GameEvents.BuildBallot(); if (_ballot.Count == 0) { ScheduleNext(); return; } for (int i = 0; i < _votes.Length; i++) { _votes[i] = 0; } _voters.Clear(); GameEvents.RememberBallot(_ballot); _winnerIndex = -1; _phase = Phase.Voting; _phaseEndsAt = Now + Mathf.Max(10f, Plugin.CfgVoteSeconds.Value); Plugin.Log.LogInfo((object)"Votacao aberta:"); for (int j = 0; j < _ballot.Count; j++) { Plugin.Log.LogInfo((object)(" " + (j + 1) + ") " + _ballot[j].Title)); } } public void RegisterVote(string author, string text) { if (_phase != Phase.Voting || string.IsNullOrEmpty(text)) { return; } string text2 = text.Trim(); if (text2.Length != 0 && int.TryParse(text2, out var result) && result >= 1 && result <= _ballot.Count) { string item = ((author == null) ? "" : author).ToLowerInvariant(); if (!_voters.Contains(item)) { _voters.Add(item); _votes[result - 1]++; } } } private void FinishVote() { int num = 0; for (int i = 1; i < _ballot.Count; i++) { if (_votes[i] > _votes[num]) { num = i; } } if (_votes[num] == 0) { num = Random.Range(0, _ballot.Count); } _winner = _ballot[num]; _winnerIndex = num; _winnerLine = _winner.Title + " (" + _votes[num] + " " + Lang.Votes + ")"; Plugin.Log.LogInfo((object)("Votacao encerrada -> " + _winnerLine)); Net.SendAnnounce(_winner.Id, _winner.Title, _winner.Description, _winner.IsGood); Tts.SpeakEventTitle(_winner.Title); try { _winner.Run(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha no evento: " + ex)); } _phase = Phase.Announcing; _phaseEndsAt = Now + Plugin.CfgResultSeconds.Value; } private void OnGUI() { //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.CfgEnabled.Value) { return; } string[] array; bool[] array2; int[] array3; float secondsLeft; byte b; string winnerLine; int winnerIndex; if (PhotonNetwork.IsMasterClient) { if (_phase == Phase.Waiting) { return; } array = new string[_ballot.Count]; array2 = new bool[_ballot.Count]; array3 = new int[_ballot.Count]; for (int i = 0; i < _ballot.Count; i++) { array[i] = _ballot[i].Title; array2[i] = _ballot[i].IsGood; array3[i] = _votes[i]; } secondsLeft = Mathf.Max(0f, _phaseEndsAt - Now); b = (byte)((_phase == Phase.Voting) ? 1 : 2); winnerLine = _winnerLine; winnerIndex = _winnerIndex; } else { Net.MirroredVote mirror = Net.Mirror; if (mirror == null || mirror.Phase == 0 || Time.unscaledTime - mirror.ReceivedAt > 3f) { return; } array = mirror.Titles; array2 = mirror.Good; array3 = mirror.Votes; b = mirror.Phase; winnerLine = mirror.WinnerLine; winnerIndex = mirror.WinnerIndex; secondsLeft = Mathf.Max(0f, mirror.SecondsLeft - (Time.unscaledTime - mirror.ReceivedAt)); } if (array != null && array.Length != 0) { float num = Mathf.Clamp(Plugin.CfgPanelWidth.Value, 300f, (float)Screen.width * 0.6f); float num2 = 66f * Skin.Scale; float num3 = ((b == 1) ? (90f * Skin.Scale + (float)array.Length * num2) : (170f * Skin.Scale)); float num4 = (Plugin.CfgPanelOnLeft.Value ? 24f : ((float)Screen.width - num - 24f)); float num5 = Mathf.Clamp(Plugin.CfgPanelTop.Value, 0f, (float)Screen.height - num3 - 20f); Rect val = default(Rect); ((Rect)(ref val))..ctor(num4, num5, num, num3); GUI.Box(val, GUIContent.none, Skin.Panel); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width - 24f, ((Rect)(ref val)).height - 20f)); if (b == 1) { DrawBallot(((Rect)(ref val)).width - 24f, array, array2, array3, secondsLeft); } else { DrawResult(array, array2, winnerIndex, winnerLine); } GUILayout.EndArea(); } } private void DrawBallot(float innerWidth, string[] titles, bool[] good, int[] votes, float secondsLeft) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ce: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(0, Mathf.CeilToInt(secondsLeft)); float num2 = Mathf.Max(1f, Plugin.CfgVoteSeconds.Value); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.VoteTitle, Skin.Header, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f * Skin.Scale) }); GUILayout.EndHorizontal(); GUILayout.Space(6f); Rect rect = GUILayoutUtility.GetRect(innerWidth, 8f); Skin.Fill(rect, Skin.BarBack); float num3 = Mathf.Clamp01(secondsLeft / num2); if (num3 > 0f) { Color color = GUI.color; GUI.color = ((num <= 10) ? Skin.Bad : Skin.Accent); Skin.Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width * num3, ((Rect)(ref rect)).height), Skin.White); GUI.color = color; } GUILayout.Space(4f); GUILayout.Label(Lang.TypeNumber + " " + num + "s", Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); int num4 = 0; for (int i = 0; i < votes.Length; i++) { num4 += votes[i]; } for (int j = 0; j < titles.Length; j++) { int num5 = ((j < votes.Length) ? votes[j] : 0); bool flag = j < good.Length && good[j]; float num6 = ((num4 > 0) ? ((float)num5 / (float)num4) : 0f); float num7 = 40f * Skin.Scale; Rect rect2 = GUILayoutUtility.GetRect(innerWidth, num7); GUI.DrawTexture(rect2, (Texture)(object)(flag ? Skin.RowGood : Skin.RowBad)); float num8 = 10f * Skin.Scale; float num9 = 54f * Skin.Scale; float num10 = 34f * Skin.Scale; Skin.OutlinedLabel(new Rect(((Rect)(ref rect2)).x + num8, ((Rect)(ref rect2)).y, num10, ((Rect)(ref rect2)).height), j + 1 + ".", Skin.HeaderFlat, Color.white, Mathf.Max(1f, Skin.Scale)); Skin.OutlinedLabel(new Rect(((Rect)(ref rect2)).x + num8 + num10, ((Rect)(ref rect2)).y, ((Rect)(ref rect2)).width - num8 * 2f - num10 - num9, ((Rect)(ref rect2)).height), titles[j], Skin.HeaderFlat, Color.white, Mathf.Max(1f, Skin.Scale)); Skin.OutlinedLabel(new Rect(((Rect)(ref rect2)).x + ((Rect)(ref rect2)).width - num8 - num9, ((Rect)(ref rect2)).y, num9, ((Rect)(ref rect2)).height), num5.ToString(), Skin.HeaderRight, Color.white, Mathf.Max(1f, Skin.Scale)); Rect rect3 = GUILayoutUtility.GetRect(innerWidth, 10f); Skin.Fill(rect3, Skin.BarBack); if (num6 > 0f) { Skin.Fill(new Rect(((Rect)(ref rect3)).x, ((Rect)(ref rect3)).y, ((Rect)(ref rect3)).width * num6, ((Rect)(ref rect3)).height), flag ? Skin.BarGood : Skin.BarBad); } GUILayout.Space(8f); } } private void DrawResult(string[] titles, bool[] good, int winnerIndex, string winnerLine) { //IL_003e: 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_004f: 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_0056: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Lang.ResultTitle, Skin.Header, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f * Skin.Scale) }); GUILayout.Space(10f); if (winnerIndex >= 0 && winnerIndex < titles.Length) { Color color = GUI.color; GUI.color = ((winnerIndex < good.Length && good[winnerIndex]) ? Skin.Good : Skin.Bad); GUILayout.Label(titles[winnerIndex], Skin.Option, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; GUILayout.Space(6f); } GUILayout.Label(winnerLine, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } } public class FloatingItem : MonoBehaviour { private Character _target; private Rigidbody _body; private Item _item; private float _endsAt; private float _angle; private bool _restored; private bool _hadGravity; private bool _wasKinematic; public static void Attach(GameObject target, Character follow, float seconds) { if (!((Object)(object)target == (Object)null) && !((Object)(object)follow == (Object)null) && !((Object)(object)target.GetComponent() != (Object)null)) { FloatingItem floatingItem = target.AddComponent(); floatingItem._target = follow; floatingItem._endsAt = Time.time + seconds; } } private void Start() { _body = ((Component)this).GetComponent(); _item = ((Component)this).GetComponent(); if ((Object)(object)_body != (Object)null) { _hadGravity = _body.useGravity; _wasKinematic = _body.isKinematic; _body.useGravity = false; _body.isKinematic = true; } _angle = Random.Range(0f, 360f); } private void Update() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if (!_restored) { bool flag = Time.time >= _endsAt; bool flag2 = (Object)(object)_target == (Object)null || (Object)(object)_target.data == (Object)null || _target.data.dead; bool flag3 = (Object)(object)_item != (Object)null && (Object)(object)_item.holderCharacter != (Object)null; if (flag || flag2 || flag3) { Release(); return; } _angle += 55f * Time.deltaTime; float num = _angle * ((float)Math.PI / 180f); Vector3 val = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 1.3f; float num2 = Mathf.Sin(Time.time * 2f) * 0.15f; Vector3 val2 = _target.Center + val + Vector3.up * (0.6f + num2); ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, val2, Time.deltaTime * 6f); ((Component)this).transform.Rotate(Vector3.up, 60f * Time.deltaTime, (Space)0); } } private void Release() { _restored = true; if ((Object)(object)_body != (Object)null) { _body.isKinematic = _wasKinematic; _body.useGravity = _hadGravity; } Object.Destroy((Object)(object)this); } private void OnDestroy() { if (!_restored && (Object)(object)_body != (Object)null) { _body.isKinematic = _wasKinematic; _body.useGravity = _hadGravity; } } } public enum EventKind { SpawnItem, SpawnRandom, Status, Tornado, Zombies, Cleanse, Blizzard, RandomItem, Horde, Sacrifice, Scoutmaster, TornadoPlayer, Humiliate, VoiceChaos } public class GameEvent { public string Id; public string TitlePt; public string DescriptionPt; public EventKind Kind; public bool IsGood; public ConfigEntry Enabled; public ConfigEntry ItemName; public ConfigEntry Amount; public ConfigEntry Intensity; public STATUSTYPE Status; public string[] Candidates; public float LifetimeSeconds; public bool ManualOnly; public string Title => Lang.EventTitle(Id, TitlePt); public string Description => Lang.EventDescription(Id, DescriptionPt); public bool UsesItem => Kind == EventKind.SpawnItem; public bool UsesIntensity => Kind == EventKind.Status; public bool CanRunNow() { if (Targeting.Living().Count == 0) { return false; } if (Kind == EventKind.Sacrifice) { if (Targeting.HostIsDead) { return false; } if (GameEvents.SacrificeUsed) { return false; } } if (Kind == EventKind.Humiliate && Lang.English) { return false; } return true; } public void Run() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) switch (Kind) { case EventKind.SpawnItem: GameEvents.SpawnItems(ItemName.Value, Amount.Value, IsGood, LifetimeSeconds); break; case EventKind.SpawnRandom: GameEvents.SpawnRandomFrom(Title, Candidates, Amount.Value); break; case EventKind.Status: GameEvents.AddStatusToEveryone(Status, Intensity.Value); break; case EventKind.Tornado: GameEvents.SpawnTornado(Amount.Value); break; case EventKind.Zombies: GameEvents.WakeZombiesForEveryone(); break; case EventKind.Cleanse: GameEvents.CleanseEveryone(); break; case EventKind.Sacrifice: GameEvents.SacrificeOrDie(Intensity.Value); break; case EventKind.Scoutmaster: GameEvents.ReleaseScoutmaster(Intensity.Value); break; case EventKind.TornadoPlayer: GameEvents.TurnSomeoneIntoTornado(Intensity.Value); break; case EventKind.Humiliate: GameEvents.Humiliate(Intensity.Value); break; case EventKind.VoiceChaos: GameEvents.StartVoiceChaos(Intensity.Value); break; case EventKind.RandomItem: GameEvents.SpawnRandomAnything(Amount.Value); break; case EventKind.Horde: GameEvents.SpawnHorde(Amount.Value); break; case EventKind.Blizzard: GameEvents.StartBlizzard(Intensity.Value); GameEvents.AddStatusToEveryone((STATUSTYPE)2, 0.15f); break; } } } public static class GameEvents { private const string ZombiePrefab = "MushroomZombie"; private const float SuspenseVolume = 0.28f; public static readonly List All = new List(); private static readonly string[] Healing = new string[11] { "Bandages", "FirstAidKit", "MedicinalRoot", "Antidote", "Cure-All", "Cure-Some", "HealingPuffShroom", "AloeVera", "Lantern_Faerie", "Heat Pack", "Sunscreen" }; private static readonly string[] Food = new string[43] { "Airplane Food", "Apple Berry Green", "Apple Berry Red", "Apple Berry Yellow", "Berrynana Blue", "Berrynana Brown", "Berrynana Pink", "Berrynana Yellow", "Clusterberry Black", "Clusterberry Red", "Clusterberry Yellow", "Kingberry Green", "Kingberry Purple", "Kingberry Yellow", "Winterberry Orange", "Winterberry Yellow", "Shroomberry_Blue", "Shroomberry_Green", "Shroomberry_Purple", "Shroomberry_Red", "Shroomberry_Yellow", "Mushroom Chubby", "Mushroom Cluster", "Mushroom Normie", "Mushroom Lace", "Energy Drink", "Sports Drink", "Granola Bar", "Marshmallow", "ScoutCookies", "TrailMix", "FortifiedMilk", "Egg", "Item_Honeycomb", "Item_Coconut", "Napberry", "Pepper Berry", "Prickleberry_Gold", "Prickleberry_Red", "Wonderberry", "Yuzu Berry", "Glizzy", "FrogLegs" }; private static readonly string[] Climbing = new string[9] { "RopeSpool", "RopeShooter", "ChainShooter", "ClimbingSpike", "RescueHook", "Glider", "Parachute", "Rocketpack", "Jetpack" }; private static Character _receiverOverride; private static readonly List _temporary = new List(); private static Bounds _originalWindBounds; private static bool _windBoundsSaved; private static int _sacrificeRun; private static Character _sacrificeVictim; private static AudioSource _suspenseSource; private static int _scoutmasterRun; private static readonly Dictionary _lastSeen = new Dictionary(); private static int _ballotNumber; public static bool SacrificeUsed { get; private set; } public static void Build(ConfigFile config) { All.Clear(); AddSpawn(config, "dinamite", "Dinamite", "Dinamites caem perto de vocês", "Dynamite", 3); AddTornado(config); AddZombies(config); AddBlizzard(config); AddHorde(config); AddRandomItem(config); AddTornadoPlayer(config); AddHumiliate(config); AddVoiceChaos(config); AddSpawn(config, "reviver", "Reviver um amigo", "Cai uma Scout Effigy, o item que traz alguém de volta", "ScoutEffigy", 1, isGood: true); AddSpawn(config, "bingbong", "Bing Bong!", "Uma chuva de Bing Bongs cai do céu", "BingBong", 20); AddSpawn(config, "sapo", "Sapos", "Três sapos aparecem do nada", "Frog", 3, isGood: true, 120f); AddSacrifice(config); AddScoutmaster(config); AddStatus(config, "fome", "Fome", "A fome bate de uma vez só", (STATUSTYPE)1, 0.4f); AddCleanse(config); AddRandom(config, "cura", "Item de cura", "Um item de cura aleatório cai do céu", Healing, 2); AddRandom(config, "comida", "Comida", "Uma comida aleatória para recuperar as forças", Food, 3); AddRandom(config, "escalada", "Item de escalada", "Um item de escalada aleatório para ajudar na subida", Climbing, 1); } private static void AddSpawn(ConfigFile config, string id, string title, string description, string defaultItem, int defaultAmount, bool isGood = false, float lifetimeSeconds = 0f) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.LifetimeSeconds = lifetimeSeconds; gameEvent.Id = id; gameEvent.TitlePt = title; gameEvent.DescriptionPt = description; gameEvent.Kind = EventKind.SpawnItem; gameEvent.IsGood = isGood; string text = "Evento: " + title; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.ItemName = config.Bind(text, "Item", defaultItem, "Qual item e criado."); gameEvent.Amount = config.Bind(text, "Amount", defaultAmount, new ConfigDescription("Quantos.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), new object[0])); gameEvent.Intensity = config.Bind(text, "Unused", 0f, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddStatus(ConfigFile config, string id, string title, string description, STATUSTYPE status, float defaultAmount) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = id; gameEvent.TitlePt = title; gameEvent.DescriptionPt = description; gameEvent.Kind = EventKind.Status; gameEvent.IsGood = false; gameEvent.Status = status; string text = "Evento: " + title; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind(text, "Intensity", defaultAmount, new ConfigDescription("Quao forte (0 a 1).", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 1f), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddTornado(ConfigFile config) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "tornado"; gameEvent.TitlePt = "Tornado"; gameEvent.DescriptionPt = "Um tornado aparece na montanha"; gameEvent.Kind = EventKind.Tornado; gameEvent.IsGood = false; string text = "Evento: Tornado"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind(text, "Amount", 1, new ConfigDescription("Quantos tornados.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 5), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Intensity = config.Bind(text, "UnusedIntensity", 0f, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddRandom(ConfigFile config, string id, string title, string description, string[] candidates, int defaultAmount) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = id; gameEvent.TitlePt = title; gameEvent.DescriptionPt = description; gameEvent.Kind = EventKind.SpawnRandom; gameEvent.IsGood = true; gameEvent.Candidates = candidates; string text = "Evento: " + title; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind(text, "Amount", defaultAmount, new ConfigDescription("Quantos itens.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado: o item e sorteado."); gameEvent.Intensity = config.Bind(text, "UnusedIntensity", 0f, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddBlizzard(ConfigFile config) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "nevasca"; gameEvent.TitlePt = "Ventania"; gameEvent.DescriptionPt = "Vento forte e gelado que empurra quem está escalando"; gameEvent.Kind = EventKind.Blizzard; gameEvent.IsGood = false; string text = "Evento: Ventania"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind(text, "Seconds", 25f, new ConfigDescription("Quantos segundos a ventania dura.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 180f), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddHorde(ConfigFile config) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "walkingdead"; gameEvent.TitlePt = "Walking Dead"; gameEvent.DescriptionPt = "Uma horda de zumbis fracos, mas muitos"; gameEvent.Kind = EventKind.Horde; gameEvent.IsGood = false; string text = "Evento: Walking Dead"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind(text, "Amount", 13, new ConfigDescription("Quantos zumbis na horda.", (AcceptableValueBase)(object)new AcceptableValueRange(5, 60), new object[0])); gameEvent.Intensity = config.Bind(text, "Weakness", 0.3f, new ConfigDescription("Quao fracos e lentos ficam (0.3 = bem mais fracos e arrastados que o normal).", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 1f), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); All.Add(gameEvent); } private static void AddRandomItem(ConfigFile config) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "itemaleatorio"; gameEvent.TitlePt = "3 itens aleatórios"; gameEvent.DescriptionPt = "Caem três itens quaisquer do jogo, pode vir de tudo"; gameEvent.Kind = EventKind.RandomItem; gameEvent.IsGood = true; string text = "Evento: Item aleatorio"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind(text, "Amount", 3, new ConfigDescription("Quantos itens caem.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado: o item e sorteado."); gameEvent.Intensity = config.Bind(text, "UnusedIntensity", 0f, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddTornadoPlayer(ConfigFile config) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "viratornado"; gameEvent.TitlePt = "Vira tornado"; gameEvent.DescriptionPt = "Um escoteiro sorteado vira um tornado de verdade"; gameEvent.Kind = EventKind.TornadoPlayer; gameEvent.IsGood = false; string text = "Evento: Vira tornado"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao. Funciona sozinho; se o mod I_am_a_Tornado estiver instalado, ele e usado no lugar por ser mais completo."); gameEvent.Intensity = config.Bind(text, "Seconds", 20f, new ConfigDescription("Quanto tempo o jogador fica como tornado.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 180f), new object[0])); gameEvent.Amount = config.Bind(text, "WarningSeconds", 5, new ConfigDescription("Contagem regressiva antes da transformacao. Padrao: 5 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange(3, 60), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); All.Add(gameEvent); } public static void TurnSomeoneIntoTornado(float seconds) { if (!RequireHost("vira tornado")) { return; } List list = Targeting.Living(); if (list.Count == 0) { Plugin.Log.LogWarning((object)"Ninguem vivo para virar tornado."); return; } int num = 20; for (int i = 0; i < All.Count; i++) { if (All[i].Kind == EventKind.TornadoPlayer) { num = All[i].Amount.Value; } } Character victim = list[Random.Range(0, list.Count)]; if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(TornadoCountdown(victim, num, seconds)); } } private static IEnumerator TornadoCountdown(Character victim, float warning, float seconds) { yield return SpinWheel(victim, Lang.WheelTornadoTitle); string line = Lang.TornadoWarning(Targeting.NameOf(victim)); MessageOverlay.Show(line, warning, Skin.Warn, warning); Net.SendAnnounce("viratornado", line, "", isGood: false); Tts.SpeakEventTitle(line); float until = Time.unscaledTime + warning; while (Time.unscaledTime < until) { yield return null; } int actor = Net.ActorOf(victim); if (actor <= 0) { Plugin.Log.LogWarning((object)"Nao achei o dono do personagem sorteado."); yield break; } if (victim.IsLocal) { TornadoForm.BecomeTornado(seconds); } else { Net.SendCommand(actor, "tornado", seconds); } Plugin.Log.LogInfo((object)("Evento: " + Targeting.NameOf(victim) + " virou tornado por " + seconds + "s.")); } private static void AddHumiliate(ConfigFile config) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "humilhar"; gameEvent.TitlePt = "Humilhar"; gameEvent.DescriptionPt = "Uma contagem, e depois a vergonha"; gameEvent.Kind = EventKind.Humiliate; gameEvent.IsGood = false; string text = "Evento: Humilhar"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind(text, "CountdownSeconds", 5f, new ConfigDescription("Contagem regressiva antes do som tocar.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 60f), new object[0])); gameEvent.ItemName = config.Bind(text, "Sound", "aura", "Qual audio embutido toca no fim da contagem (sem o .mp3)."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); All.Add(gameEvent); } public static void Humiliate(float seconds) { if (!RequireHost("humilhar")) { return; } string sound = "aura"; for (int i = 0; i < All.Count; i++) { if (All[i].Kind == EventKind.Humiliate) { sound = All[i].ItemName.Value; } } if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(HumiliateRoutine(seconds, sound)); } } private static IEnumerator HumiliateRoutine(float seconds, string sound) { Net.SendNotice(-1, "humiliate", Lang.HumiliateWarning, seconds, seconds, ""); MessageOverlay.Show(Lang.HumiliateWarning, seconds, Skin.Bad, seconds); float until = Time.unscaledTime + seconds; while (Time.unscaledTime < until) { yield return null; } Net.PlaySoundEverywhere(sound, 1f); Plugin.Log.LogInfo((object)("Evento: Humilhar (" + sound + ").")); } private static void AddVoiceChaos(ConfigFile config) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "vozmaluca"; gameEvent.TitlePt = "Voz maluca"; gameEvent.DescriptionPt = "Metade do grupo fica com voz grave, a outra metade fina"; gameEvent.Kind = EventKind.VoiceChaos; gameEvent.IsGood = false; string text = "Evento: Voz maluca"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind(text, "Seconds", 75f, new ConfigDescription("Quanto tempo as vozes ficam distorcidas. Padrao: 1 minuto e 15 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 600f), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); All.Add(gameEvent); } public static void StartVoiceChaos(float seconds) { if (RequireHost("voz maluca")) { VoiceChaos.Start(seconds); } } private static void AddScoutmaster(ConfigFile config) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "scoutmaster"; gameEvent.TitlePt = "SCOUTMASTER"; gameEvent.DescriptionPt = "Ele vem atrás de vocês. Não entra na votação: só no botão."; gameEvent.Kind = EventKind.Scoutmaster; gameEvent.IsGood = false; string text = "Evento: Scoutmaster"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao, e continua disponivel no botao do menu."); gameEvent.Intensity = config.Bind(text, "Seconds", 120f, new ConfigDescription("Quanto tempo ele caca. Durante esse tempo a fuga dele e recusada, entao ele ataca ate o relogio acabar. Padrao: 2 minutos.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 900f), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddSacrifice(ConfigFile config) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "sacrificio"; gameEvent.TitlePt = "Sacrifique ou Morra"; gameEvent.DescriptionPt = "Uma adaga cai e o relógio começa a correr"; gameEvent.Kind = EventKind.Sacrifice; gameEvent.IsGood = false; string text = "Evento: Sacrifique ou Morra"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind(text, "Seconds", 70f, new ConfigDescription("Quanto tempo o relogio corre antes da revelacao. Padrao: 1 minuto e 10 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 300f), new object[0])); gameEvent.ItemName = config.Bind(text, "Item", "RitualDagger", "Qual item cai na frente do jogador."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddCleanse(ConfigFile config) { GameEvent gameEvent = new GameEvent(); gameEvent.Id = "curar"; gameEvent.TitlePt = "Curar tudo"; gameEvent.DescriptionPt = "Remove todos os efeitos negativos de todo mundo"; gameEvent.Kind = EventKind.Cleanse; gameEvent.IsGood = true; string text = "Evento: Curar tudo"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind(text, "UnusedAmount", 1, "Nao usado neste evento."); gameEvent.Intensity = config.Bind(text, "UnusedIntensity", 0f, "Nao usado neste evento."); All.Add(gameEvent); } private static void AddZombies(ConfigFile config) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown GameEvent gameEvent = new GameEvent(); gameEvent.Id = "zumbis"; gameEvent.TitlePt = "Zumbis"; gameEvent.DescriptionPt = "Um zumbi para cada escoteiro vivo"; gameEvent.Kind = EventKind.Zombies; gameEvent.IsGood = false; string text = "Evento: Zumbis"; gameEvent.Enabled = config.Bind(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind(text, "Amount", 2, new ConfigDescription("Quantos zumbis acordam.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), new object[0])); gameEvent.ItemName = config.Bind(text, "Unused", "", "Nao usado neste evento."); gameEvent.Intensity = config.Bind(text, "UnusedIntensity", 0f, "Nao usado neste evento."); All.Add(gameEvent); } public static void SpawnTornado(int count) { //IL_002b: 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) if (!RequireHost("tornado")) { return; } float value = Plugin.CfgTornadoSeconds.Value; int num = 0; for (int i = 0; i < count; i++) { try { GameObject val = PhotonNetwork.Instantiate("Tornado", PickSpawnPoint(18f), Quaternion.identity, (byte)0, (object[])null); num++; if (!((Object)(object)val == (Object)null)) { Tornado component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.tornadoLifetimeMin = value; component.tornadoLifetimeMax = value; } if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(DestroyAfter(val, value)); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui criar o tornado: " + ex.Message)); break; } } if (num > 0) { Plugin.Log.LogInfo((object)("Evento: " + num + " tornado(s), " + value + "s cada.")); } } private static IEnumerator DestroyAfter(GameObject target, float seconds) { yield return (object)new WaitForSeconds(seconds); if (!((Object)(object)target == (Object)null) && PhotonNetwork.IsMasterClient) { try { PhotonNetwork.Destroy(target); Plugin.Log.LogInfo((object)("Tornado removido depois de " + seconds + "s.")); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui remover o tornado: " + ex.Message)); } } } public static void SpawnItems(string prefabName, int count) { SpawnItems(prefabName, count, hover: false); } public static void SpawnItems(string prefabName, int count, bool hover) { SpawnItems(prefabName, count, hover, 0f); } public static void SpawnItems(string prefabName, int count, bool hover, float lifetimeSeconds) { if (string.IsNullOrEmpty(prefabName) || !RequireRoom(prefabName)) { return; } string text = ItemCatalog.Resolve(prefabName); if (text == null) { Plugin.Log.LogWarning((object)("Item '" + prefabName + "' nao existe no jogo. Abra o F6 e escolha um da lista.")); return; } if (text != prefabName) { Plugin.Log.LogInfo((object)("Item '" + prefabName + "' resolvido para '" + text + "'.")); } Character val = (((Object)(object)_receiverOverride != (Object)null) ? _receiverOverride : Targeting.ForItems()); List list = new List(); for (int i = 0; i < count; i++) { GameObject val2 = TrySpawnOne(text, hover, val); if ((Object)(object)val2 == (Object)null) { break; } list.Add(val2); } if (list.Count > 0) { Plugin.Log.LogInfo((object)("Evento: " + list.Count + "x " + text + " para " + Targeting.NameOf(val) + ".")); if (IsFood(text)) { Net.PlaySoundEverywhere("mickey", 1f); } if (lifetimeSeconds > 0f && (Object)(object)Plugin.Instance != (Object)null) { _temporary.AddRange(list); ((MonoBehaviour)Plugin.Instance).StartCoroutine(RemoveItemsAfter(list, lifetimeSeconds, text)); } } } private static GameObject TrySpawnOne(string itemName) { return TrySpawnOne(itemName, hover: false, Targeting.ForItems()); } private static GameObject TrySpawnOne(string itemName, bool hover) { return TrySpawnOne(itemName, hover, Targeting.ForItems()); } private static int RemoveTemporarySpawns() { int num = 0; for (int i = 0; i < _temporary.Count; i++) { if (!((Object)(object)_temporary[i] == (Object)null)) { try { PhotonNetwork.Destroy(_temporary[i]); num++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui remover um spawn temporario: " + ex.Message)); } } } _temporary.Clear(); return num; } private static IEnumerator RemoveItemsAfter(List spawned, float seconds, string label) { float until = Time.unscaledTime + seconds; while (Time.unscaledTime < until) { yield return null; } if (!PhotonNetwork.IsMasterClient) { yield break; } int removed = 0; for (int i = 0; i < spawned.Count; i++) { if (!((Object)(object)spawned[i] == (Object)null)) { _temporary.Remove(spawned[i]); try { PhotonNetwork.Destroy(spawned[i]); removed++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui remover '" + label + "': " + ex.Message)); } } } if (removed > 0) { Plugin.Log.LogInfo((object)(label + ": " + removed + " removido(s) depois de " + seconds + "s.")); } } private static bool IsFood(string itemName) { if (string.IsNullOrEmpty(itemName)) { return false; } for (int i = 0; i < Food.Length; i++) { if (string.Equals(Food[i], itemName, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static GameObject TrySpawnOne(string itemName, bool hover, Character receiver) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)receiver != (Object)null) ? (receiver.Center + Vector3.up * 0.8f) : (PickSpawnPoint(2.5f) + Vector3.up * 2f)); string[] array = new string[2] { itemName.StartsWith("0_Items/") ? itemName : ("0_Items/" + itemName), itemName }; for (int i = 0; i < array.Length; i++) { try { GameObject val2 = PhotonNetwork.Instantiate(array[i], val, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val2 != (Object)null) { if (i > 0) { Plugin.Log.LogInfo((object)("'" + itemName + "' criado como item de mod.")); } if (hover && (Object)(object)receiver != (Object)null) { FloatingItem.Attach(val2, receiver, Plugin.CfgHoverSeconds.Value); } return val2; } } catch (Exception) { } } Plugin.Log.LogWarning((object)("Nao consegui criar '" + itemName + "'. Itens de outros mods podem precisar que o mod deles esteja ativo.")); return null; } public static void SpawnRandomFrom(string label, string[] candidates, int count) { if (candidates == null || candidates.Length == 0 || !RequireHost(label)) { return; } List list = new List(); for (int i = 0; i < candidates.Length; i++) { string text = ItemCatalog.Resolve(candidates[i]); if (text != null && !list.Contains(text)) { list.Add(text); } } if (list.Count == 0) { Plugin.Log.LogWarning((object)("Nenhum item de '" + label + "' existe neste jogo. Veja a lista no log e ajuste pelo F6.")); return; } _receiverOverride = Targeting.ForItems(); for (int j = 0; j < count; j++) { SpawnItems(list[Random.Range(0, list.Count)], 1, hover: true); } _receiverOverride = null; Plugin.Log.LogInfo((object)("Evento '" + label + "': " + count + " item(ns) sorteado(s) entre " + list.Count + " disponiveis.")); } private static List SpawnZombiesFromPrefab(int count) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) List list = new List(); for (int i = 0; i < count; i++) { Vector3 val = FindGround(PickSpawnPoint(6f)); try { GameObject val2 = PhotonNetwork.Instantiate("MushroomZombie", val, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val2 != (Object)null) { list.Add(val2); MushroomZombie component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { ZombieTuning.Apply(component); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui criar o zumbi: " + ex.Message)); break; } } if (list.Count > 0) { Plugin.Log.LogInfo((object)("Evento: " + list.Count + " zumbi(s) criados.")); } return list; } private static Vector3 FindGround(Vector3 around) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0010: 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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(around + Vector3.up * 4f, Vector3.down, ref val, 30f)) { return ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.5f; } return around; } public static void StartBlizzard(float seconds) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!RequireHost("ventania")) { return; } Net.PlaySoundEverywhere("ventania", 0.8f); WindChillZone instance = WindChillZone.instance; if ((Object)(object)instance == (Object)null) { Plugin.Log.LogWarning((object)"Nao existe zona de vento nesta parte do mapa."); return; } PhotonView component = ((Component)instance).GetComponent(); if ((Object)(object)component == (Object)null) { Plugin.Log.LogWarning((object)"WindChillZone sem PhotonView."); return; } StretchWindZoneOverPlayers(instance); Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(normalized.x, 0f, normalized.y); try { component.RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3] { true, val, seconds }); Plugin.Log.LogInfo((object)("Evento: ventania ligada por " + seconds + "s (zona esticada sobre os jogadores).")); if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(EndBlizzardAfter(seconds)); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui ligar a ventania: " + ex.Message)); } } private static IEnumerator EndBlizzardAfter(float seconds) { float until = Time.unscaledTime + seconds; while (Time.unscaledTime < until) { yield return null; } if (!PhotonNetwork.IsMasterClient) { RestoreWindZone(); Plugin.Log.LogInfo((object)"Ventania terminou (zona restaurada)."); yield break; } WindChillZone zone = WindChillZone.instance; if ((Object)(object)zone != (Object)null) { PhotonView component = ((Component)zone).GetComponent(); if ((Object)(object)component != (Object)null) { try { component.RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3] { false, Vector3.zero, 0f }); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui parar a ventania: " + ex.Message)); } } } RestoreWindZone(); Plugin.Log.LogInfo((object)"Ventania terminou."); } private static void StretchWindZoneOverPlayers(WindChillZone zone) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0069: 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) if (!_windBoundsSaved) { _originalWindBounds = zone.windZoneBounds; _windBoundsSaved = true; } Bounds windZoneBounds = zone.windZoneBounds; List allCharacters = Character.AllCharacters; if (allCharacters != null) { for (int i = 0; i < allCharacters.Count; i++) { if (!((Object)(object)allCharacters[i] == (Object)null)) { ((Bounds)(ref windZoneBounds)).Encapsulate(allCharacters[i].Center); } } } ((Bounds)(ref windZoneBounds)).Expand(60f); zone.windZoneBounds = windZoneBounds; } private static void RestoreWindZone() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (_windBoundsSaved) { WindChillZone instance = WindChillZone.instance; if ((Object)(object)instance != (Object)null) { instance.windZoneBounds = _originalWindBounds; } _windBoundsSaved = false; } } public static void ForgetWorldState() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) ResetSacrificeUse(); VoiceChaos.Clear(); _temporary.Clear(); RestoreWindZone(); _windBoundsSaved = false; _originalWindBounds = default(Bounds); ZombieTuning.Reset(); } public static void StopEverything() { //IL_0140: Unknown result type (might be due to invalid IL or missing references) StopSacrifice(); _scoutmasterRun++; ScoutmasterPatch.Release(); VoiceChaos.Clear(); MessageOverlay.Clear(); MessageOverlay.HideWheel(); if (PhotonNetwork.IsMasterClient) { Net.SendStopAll(); } if (!PhotonNetwork.IsMasterClient) { Plugin.Log.LogWarning((object)"So o host pode parar os eventos."); return; } int num = RemoveTemporarySpawns(); int num2 = 0; Tornado[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { try { PhotonNetwork.Destroy(((Component)array[i]).gameObject); num2++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui remover um tornado: " + ex.Message)); } } } int num3 = 0; MushroomZombie[] array2 = Object.FindObjectsOfType(); for (int j = 0; j < array2.Length; j++) { if (!((Object)(object)array2[j] == (Object)null)) { try { array2[j].DestroyZombie(); num3++; } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Nao consegui remover um zumbi: " + ex2.Message)); } } } bool flag = false; WindChillZone instance = WindChillZone.instance; if ((Object)(object)instance != (Object)null) { PhotonView component = ((Component)instance).GetComponent(); if ((Object)(object)component != (Object)null) { try { component.RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3] { false, Vector3.zero, 0f }); flag = true; } catch (Exception ex3) { Plugin.Log.LogWarning((object)("Nao consegui parar o vento: " + ex3.Message)); } } } RestoreWindZone(); Plugin.Log.LogInfo((object)("Parado tudo: " + num2 + " tornado(s), " + num3 + " zumbi(s), " + num + " spawn(s) temporario(s)" + (flag ? ", vento desligado." : "."))); } public static void SacrificeOrDie(float seconds) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!RequireHost("sacrificio")) { return; } string itemName = "RitualDagger"; for (int i = 0; i < All.Count; i++) { if (All[i].Kind == EventKind.Sacrifice) { itemName = All[i].ItemName.Value; } } Character val = Targeting.ForNotice(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"Ninguem vivo para receber o sacrificio."); return; } _sacrificeVictim = val; DropInFrontOf(val, itemName); string text = Lang.SacrificeThreat(seconds); if (val.IsLocal) { MessageOverlay.Show(text, seconds, Skin.Bad, seconds); Sounds.Play("dexter", 0.7f); StartScoutmasterMusic(); } else { Net.SendNotice(Net.ActorOf(val), "sacrifice_threat", text, seconds, seconds, "dexter"); } SacrificeUsed = true; _sacrificeRun++; if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(RevealPrank(seconds, _sacrificeRun)); } Plugin.Log.LogInfo((object)("Evento: Sacrifique ou Morra para " + Targeting.NameOf(val) + " (" + seconds + "s de suspense).")); } private static IEnumerator RevealPrank(float seconds, int run) { float until = Time.unscaledTime + seconds + 0.2f; while (true) { if (Time.unscaledTime < until) { if (_sacrificeRun == run) { yield return null; continue; } break; } StopScoutmasterMusic(); string punchline = Lang.SacrificeReveal; Character victim = _sacrificeVictim; _sacrificeVictim = null; if ((Object)(object)victim != (Object)null && !victim.IsLocal) { Net.SendNotice(Net.ActorOf(victim), "sacrifice_reveal", punchline, 10f, -1f, "gyro"); } else { MessageOverlay.Show(punchline, 10f, Skin.Good); Sounds.Play("gyro"); } if (Plugin.CfgSpeakEvents.Value) { Tts.Speak(punchline.Replace("\n", " "), Plugin.CfgVoicePitch.Value); } Plugin.Log.LogInfo((object)"Sacrifique ou Morra: era brincadeira, ninguem morreu."); break; } } public static void StopSacrifice() { _sacrificeRun++; _sacrificeVictim = null; StopScoutmasterMusic(); Sounds.StopAll(); } private static void StartScoutmasterMusic() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown StopScoutmasterMusic(); AudioClip val = FindScoutmasterClip(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogInfo((object)"Nao achei o som do Scoutmaster; o evento roda em silencio."); return; } GameObject val2 = new GameObject("ChatChaos_Suspense"); Object.DontDestroyOnLoad((Object)(object)val2); _suspenseSource = val2.AddComponent(); _suspenseSource.clip = val; _suspenseSource.loop = false; _suspenseSource.volume = 0.28f; _suspenseSource.spatialBlend = 0f; if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(TollSuspense()); } Plugin.Log.LogInfo((object)("Tocando '" + ((Object)val).name + "' a cada " + Plugin.CfgSuspenseInterval.Value + "s durante o suspense.")); } private static IEnumerator TollSuspense() { AudioSource source = _suspenseSource; while ((Object)(object)source != (Object)null && (Object)(object)_suspenseSource == (Object)(object)source) { source.Play(); float wait = Mathf.Max(1f, Plugin.CfgSuspenseInterval.Value); float until = Time.unscaledTime + wait; while (Time.unscaledTime < until) { if (!((Object)(object)_suspenseSource != (Object)(object)source)) { yield return null; continue; } yield break; } } } private static void StopScoutmasterMusic() { if (!((Object)(object)_suspenseSource == (Object)null)) { try { _suspenseSource.Stop(); Object.Destroy((Object)(object)((Component)_suspenseSource).gameObject); } catch { } _suspenseSource = null; } } private static AudioClip FindScoutmasterClip() { string value = Plugin.CfgSuspenseSound.Value; AudioClip[] array = Resources.FindObjectsOfTypeAll(); if (array == null || array.Length == 0) { return null; } if (!string.IsNullOrEmpty(value)) { for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null) && ((Object)array[i]).name != null && string.Equals(((Object)array[i]).name, value, StringComparison.OrdinalIgnoreCase)) { return array[i]; } } for (int j = 0; j < array.Length; j++) { if (!((Object)(object)array[j] == (Object)null) && ((Object)array[j]).name != null && ((Object)array[j]).name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return array[j]; } } Plugin.Log.LogWarning((object)("Som '" + value + "' nao existe; procurando alternativa.")); } string[] array2 = new string[3] { "Au_BugleCursed", "Au_Mandrake_Scream", "Au_AirHorn" }; for (int k = 0; k < array2.Length; k++) { for (int l = 0; l < array.Length; l++) { if (!((Object)(object)array[l] == (Object)null) && ((Object)array[l]).name != null && string.Equals(((Object)array[l]).name, array2[k], StringComparison.OrdinalIgnoreCase)) { return array[l]; } } } return null; } private static void DropInFrontOf(Character character, string itemName) { //IL_002b: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) //IL_0047: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) string text = ItemCatalog.Resolve(itemName); if (text == null) { Plugin.Log.LogWarning((object)("Item '" + itemName + "' nao existe neste jogo.")); return; } Vector3 forward = ((Component)character).transform.forward; Vector3 val = character.Center + forward * 1.5f + Vector3.up * 0.5f; try { PhotonNetwork.Instantiate(text.StartsWith("0_Items/") ? text : ("0_Items/" + text), val, Quaternion.identity, (byte)0, (object[])null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui largar '" + text + "': " + ex.Message)); } } public static void ReleaseScoutmaster(float seconds) { if (RequireHost("scoutmaster")) { _scoutmasterRun++; ScoutmasterPatch.Hold(); List list = LivingCharacters(); if (list.Count == 0) { Plugin.Log.LogWarning((object)"Ninguem vivo para o Scoutmaster cacar."); } else if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(SpinThenRelease(list, seconds)); } else { ReleaseScoutmasterAt(PickVictim(), seconds); } } } private static IEnumerator SpinThenRelease(List alive, float seconds) { Character victim = alive[Random.Range(0, alive.Count)]; yield return SpinWheel(victim, Lang.WheelHuntTitle); ReleaseScoutmasterAt(victim, seconds); } private static IEnumerator SpinWheel(Character winner, string title) { List alive = Targeting.Living(); string[] names = new string[alive.Count]; int winnerIndex = 0; for (int i = 0; i < alive.Count; i++) { names[i] = Targeting.NameOf(alive[i]); if ((Object)(object)alive[i] == (Object)(object)winner) { winnerIndex = i; } } if (names.Length != 0) { Net.SendWheel(title, names, winnerIndex); yield return SpinWheelLocal(title, names, winnerIndex); } } public static IEnumerator SpinWheelLocal(string title, string[] names, int winnerIndex) { if (names != null && names.Length != 0) { int index = Random.Range(0, names.Length); float delay; for (float elapsed = 0f; elapsed < 4f; elapsed += delay) { index = (index + 1) % names.Length; MessageOverlay.ShowWheel(title, names, index, settled: false); delay = Mathf.Lerp(0.05f, 0.45f, elapsed / 4f); yield return (object)new WaitForSecondsRealtime(delay); } while (index != winnerIndex) { index = (index + 1) % names.Length; MessageOverlay.ShowWheel(title, names, index, settled: false); yield return (object)new WaitForSecondsRealtime(0.45f); } MessageOverlay.ShowWheel(Lang.WheelChosen, names, winnerIndex, settled: true); yield return (object)new WaitForSecondsRealtime(2.5f); MessageOverlay.HideWheel(); } } private static void ReleaseScoutmasterAt(Character victim, float seconds) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) Scoutmaster val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null) { Vector3 val2 = FindGround(PickSpawnPoint(10f)); try { GameObject val3 = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val2, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val3 != (Object)null) { val = val3.GetComponent(); } Plugin.Log.LogInfo((object)"Scoutmaster criado."); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui criar o Scoutmaster: " + ex.Message)); return; } } else { Plugin.Log.LogInfo((object)"Ja existia um Scoutmaster; usando ele."); } if ((Object)(object)val != (Object)null && (Object)(object)victim != (Object)null) { ForceTarget(val, victim, seconds); BringScoutmasterToTarget(val); } MessageOverlay.Show("O SCOUTMASTER ESTÁ VINDO!" + (((Object)(object)victim != (Object)null) ? ("\nEle está atrás de " + ((Object)victim).name) : ""), 6f, Skin.Bad); if (seconds > 0f) { MessageOverlay.ShowClock("SOBREVIVA", seconds); if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(SendScoutmasterAway(val, seconds, _scoutmasterRun)); } } Plugin.Log.LogInfo((object)("Evento: Scoutmaster solto" + ((seconds > 0f) ? (" por " + seconds + "s.") : " (sem prazo)."))); } private static void ForceTarget(Scoutmaster scoutmaster, Character victim, float seconds) { try { MethodInfo method = typeof(Scoutmaster).GetMethod("SetCurrentTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(scoutmaster, new object[2] { victim, Mathf.Max(seconds, 60f) }); Plugin.Log.LogInfo((object)("Alvo travado: " + ((Object)victim).name + " por " + Mathf.Max(seconds, 60f) + "s.")); return; } } catch (Exception ex) { Plugin.Log.LogInfo((object)("SetCurrentTarget falhou: " + ex.Message)); } try { scoutmaster.currentTarget = victim; } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Nao consegui marcar o alvo: " + ex2.Message)); } } private static List LivingCharacters() { List list = new List(); List allCharacters = Character.AllCharacters; if (allCharacters == null) { return list; } for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.data == (Object)null) && !val.data.dead) { list.Add(val); } } return list; } private static void BringScoutmasterToTarget(Scoutmaster scoutmaster) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) try { MethodInfo method = typeof(Scoutmaster).GetMethod("TeleportCloseToTarget", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(scoutmaster, null); Plugin.Log.LogInfo((object)"Scoutmaster trazido para perto do alvo."); return; } } catch (Exception ex) { Plugin.Log.LogInfo((object)("TeleportCloseToTarget falhou: " + ex.Message)); } try { Character currentTarget = scoutmaster.currentTarget; if (!((Object)(object)currentTarget == (Object)null)) { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; Vector3 val = new Vector3(normalized.x, 0f, normalized.y) * 25f; ((Component)scoutmaster).transform.position = FindGround(currentTarget.Center + val); Plugin.Log.LogInfo((object)"Scoutmaster posicionado perto do alvo manualmente."); } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Nao consegui trazer o Scoutmaster: " + ex2.Message)); } } private static IEnumerator SendScoutmasterAway(Scoutmaster scoutmaster, float seconds, int run) { float until = Time.unscaledTime + seconds; while (true) { if (Time.unscaledTime < until) { if (_scoutmasterRun == run) { yield return null; continue; } break; } if (_scoutmasterRun == run) { MessageOverlay.ClearClock(); ScoutmasterPatch.Release(); if (!((Object)(object)scoutmaster == (Object)null) && PhotonNetwork.IsMasterClient) { try { scoutmaster.TeleportFarAway(); MessageOverlay.Show("VOCÊS SOBREVIVERAM!\nO Scoutmaster foi embora.", 6f, Skin.Good); Plugin.Log.LogInfo((object)"Scoutmaster mandado para longe."); break; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui mandar o Scoutmaster embora: " + ex.Message)); break; } } break; } break; } } private static Character PickVictim() { List allCharacters = Character.AllCharacters; if (allCharacters == null) { return null; } List list = new List(); for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.data == (Object)null) && !val.data.dead) { list.Add(val); } } if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } public static void SpawnRandomAnything(int count) { if (!RequireHost("item aleatorio")) { return; } int num = 0; for (int i = 0; i < count; i++) { string text = ItemCatalog.RandomSpawnable(); if (text == null) { Plugin.Log.LogWarning((object)"Catalogo de itens vazio; entre numa partida."); return; } if ((Object)(object)TrySpawnOne(text) != (Object)null) { num++; Plugin.Log.LogInfo((object)("Item aleatorio: " + text)); } } if (num > 0) { Plugin.Log.LogInfo((object)("Evento: " + num + " item(ns) aleatorio(s).")); } } public static void SpawnHorde(int count) { //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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (!RequireHost("walking dead")) { return; } ZombieManager instance = ZombieManager.Instance; if ((Object)(object)instance != (Object)null && instance.zombies != null) { instance.maxActiveZombies = Mathf.Max(instance.maxActiveZombies, instance.zombies.Count + count); } float num = 0.35f; for (int i = 0; i < All.Count; i++) { if (All[i].Kind == EventKind.Horde) { num = All[i].Intensity.Value; } } int num2 = 0; for (int j = 0; j < count; j++) { Vector3 val = FindGround(PickSpawnPoint(14f)); try { GameObject val2 = PhotonNetwork.Instantiate("MushroomZombie", val, Quaternion.identity, (byte)0, (object[])null); num2++; if ((Object)(object)val2 != (Object)null) { MushroomZombie component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { ZombieTuning.ApplyScaled(component, num, num * 0.6f, 1f); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha na horda: " + ex.Message)); break; } } Plugin.Log.LogInfo((object)("Evento Walking Dead: " + num2 + " zumbi(s) fracos (x" + num + ").")); } public static void CleanseEveryone() { //IL_006e: 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_0081: Unknown result type (might be due to invalid IL or missing references) List allCharacters = Character.AllCharacters; if (allCharacters == null) { return; } Array values = Enum.GetValues(typeof(STATUSTYPE)); int num = 0; for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if ((Object)(object)val == (Object)null || val.refs == null || (Object)(object)val.refs.afflictions == (Object)null) { continue; } try { foreach (object item in values) { STATUSTYPE val2 = (STATUSTYPE)item; val.refs.afflictions.SubtractStatus(val2, 1f, false, false); } num++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha limpando status: " + ex.Message)); } } Plugin.Log.LogInfo((object)("Evento: efeitos negativos removidos de " + num + ".")); } public static void WakeZombies(int count) { if (RequireHost("zumbis")) { ZombieManager instance = ZombieManager.Instance; if ((Object)(object)instance != (Object)null && instance.zombies != null && instance.maxActiveZombies < instance.zombies.Count + count) { instance.maxActiveZombies = instance.zombies.Count + count; } List list = SpawnZombiesFromPrefab(count); if (list.Count > 0) { DropDefenceForEveryone(); } if ((Object)(object)Plugin.Instance != (Object)null && Plugin.CfgZombieLifetime.Value > 0f) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(RemoveAfter(list, Plugin.CfgZombieLifetime.Value)); } } } public static void WakeZombiesForEveryone() { int count = Targeting.Living().Count; if (count <= 0) { Plugin.Log.LogWarning((object)"Ninguem vivo; nenhum zumbi criado."); } else { WakeZombies(count); } } private static IEnumerator RemoveAfter(List zombies, float seconds) { float until = Time.unscaledTime + seconds; while (Time.unscaledTime < until) { yield return null; } int removed = 0; for (int i = 0; i < zombies.Count; i++) { GameObject val = zombies[i]; if ((Object)(object)val == (Object)null) { continue; } try { MushroomZombie component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.DestroyZombie(); } else { PhotonNetwork.Destroy(val); } removed++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui remover um zumbi: " + ex.Message)); } } Plugin.Log.LogInfo((object)("Zumbis do evento removidos: " + removed + ".")); } private static void DropDefenceForEveryone() { string value = Plugin.CfgZombieDefenseItem.Value; if (string.IsNullOrEmpty(value)) { return; } if (ItemCatalog.Resolve(value) == null) { Plugin.Log.LogWarning((object)("Item de defesa '" + value + "' nao existe neste jogo (mods de item podem precisar do PEAKLib). Pulei.")); return; } List list = Targeting.Living(); int num = Mathf.Max(1, Plugin.CfgZombieDefenseCount.Value); for (int i = 0; i < list.Count; i++) { for (int j = 0; j < num; j++) { DropInFrontOf(list[i], value); } } Plugin.Log.LogInfo((object)("Defesa: " + num + "x " + value + " na frente de " + list.Count + " jogador(es) vivo(s).")); } public static void AddStatusToEveryone(STATUSTYPE status, float amount) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_007e: Unknown result type (might be due to invalid IL or missing references) int num = 0; List allCharacters = Character.AllCharacters; if (allCharacters == null) { return; } for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if ((Object)(object)val == (Object)null || val.refs == null || (Object)(object)val.refs.afflictions == (Object)null) { continue; } try { if (val.refs.afflictions.AddStatus(status, amount, false, true, true)) { num++; continue; } Plugin.Log.LogWarning((object)string.Concat("O jogo recusou ", status, " em ", Targeting.NameOf(val), ".")); } catch (Exception ex) { Plugin.Log.LogWarning((object)string.Concat("Falha aplicando ", status, ": ", ex.Message)); } } Plugin.Log.LogInfo((object)string.Concat("Evento: ", status, " +", amount, " em ", num, ".")); } private static Vector3 PickSpawnPoint(float spread) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) Character val = Character.localCharacter; List allCharacters = Character.AllCharacters; if (allCharacters != null && allCharacters.Count > 0) { Character val2 = allCharacters[Random.Range(0, allCharacters.Count)]; if ((Object)(object)val2 != (Object)null) { val = val2; } } Vector3 val3 = (((Object)(object)val != (Object)null) ? val.Center : Vector3.zero); Vector2 val4 = Random.insideUnitCircle * spread; return val3 + new Vector3(val4.x, 0f, val4.y); } private static bool RequireRoom(string what) { if (PhotonNetwork.InRoom) { return true; } Plugin.Log.LogWarning((object)("'" + what + "' precisa que voce esteja numa partida.")); return false; } private static bool RequireHost(string what) { if (PhotonNetwork.IsMasterClient) { return true; } Plugin.Log.LogWarning((object)("'" + what + "' precisa que voce seja o host. Ignorado.")); return false; } public static List BuildBallot() { List list = new List(); List list2 = new List(); for (int i = 0; i < All.Count; i++) { GameEvent gameEvent = All[i]; if (gameEvent.Enabled.Value && !gameEvent.ManualOnly && gameEvent.CanRunNow()) { if (gameEvent.IsGood) { list.Add(gameEvent); } else { list2.Add(gameEvent); } } } List list3 = new List(); Draw(list, list3, 2); Draw(list2, list3, 3); for (int num = list3.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); GameEvent value = list3[num]; list3[num] = list3[index]; list3[index] = value; } return list3; } private static void Draw(List pool, List ballot, int count) { for (int i = 0; i < count; i++) { if (pool.Count <= 0) { break; } float num = 0f; float[] array = new float[pool.Count]; for (int j = 0; j < pool.Count; j++) { array[j] = WeightOf(pool[j]); num += array[j]; } float num2 = Random.Range(0f, num); int index = pool.Count - 1; for (int k = 0; k < pool.Count; k++) { num2 -= array[k]; if (num2 <= 0f) { index = k; break; } } ballot.Add(pool[index]); pool.RemoveAt(index); } } private static float WeightOf(GameEvent option) { if (!_lastSeen.TryGetValue(option.Id, out var value)) { return 1f; } int num = _ballotNumber - value; return Mathf.Clamp(0.2f + (float)num * 0.2f, 0.2f, 1f); } public static void ResetSacrificeUse() { SacrificeUsed = false; } public static void RememberBallot(List ballot) { _ballotNumber++; for (int i = 0; i < ballot.Count; i++) { _lastSeen[ballot[i].Id] = _ballotNumber; } } } public static class Hide { private static readonly Dictionary> _hidden = new Dictionary>(); public static void Apply(Character character, bool hide) { if ((Object)(object)character == (Object)null) { return; } int instanceID = ((Object)character).GetInstanceID(); try { if (hide) { if (_hidden.ContainsKey(instanceID)) { return; } List list = new List(); Renderer[] componentsInChildren = ((Component)character).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)null) && componentsInChildren[i].enabled) { componentsInChildren[i].enabled = false; list.Add(componentsInChildren[i]); } } _hidden[instanceID] = list; } else { if (!_hidden.TryGetValue(instanceID, out var value)) { return; } for (int j = 0; j < value.Count; j++) { if ((Object)(object)value[j] != (Object)null) { value[j].enabled = true; } } _hidden.Remove(instanceID); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui mudar a visibilidade: " + ex.Message)); } } public static Character ByActor(int actorNumber) { List allCharacters = Character.AllCharacters; if (allCharacters == null) { return null; } for (int i = 0; i < allCharacters.Count; i++) { if (Net.ActorOf(allCharacters[i]) == actorNumber) { return allCharacters[i]; } } return null; } } public class HostPrompt : MonoBehaviour { private const float AskSeconds = 45f; private bool _wasInRoom; private bool _asking; private float _hideAt; private CursorLockMode _previousLock; private bool _previousVisible; private bool _draftIsHost = true; private bool _draftSpeak = true; public bool IsAsking => _asking; private void Update() { bool inRoom = PhotonNetwork.InRoom; if (inRoom != _wasInRoom) { _wasInRoom = inRoom; if (inRoom && Plugin.CfgAskOnJoin.Value) { Ask(); } else if (!inRoom && _asking) { Stop(); } } if (_asking) { if (Time.unscaledTime >= _hideAt) { Stop(); Plugin.Log.LogInfo((object)("Ninguem respondeu; mantendo a configuracao atual (" + (Plugin.IsGuest ? "convidado" : "host") + ").")); } else if (KeyDown((Key)33) || KeyDown((Key)41)) { _draftIsHost = true; } else if (KeyDown((Key)28) || KeyDown((Key)42)) { _draftIsHost = false; } else if (KeyDown((Key)2) || KeyDown((Key)77)) { Confirm(); } else if (KeyDown((Key)60)) { Dismiss(); } } } private void Ask() { //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) _asking = true; _hideAt = Time.unscaledTime + 45f; _draftIsHost = !Plugin.IsGuest; _draftSpeak = Plugin.CfgSpeakEvents.Value; _previousLock = Cursor.lockState; _previousVisible = Cursor.visible; ForceCursor(); } private void Stop() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _asking = false; Cursor.lockState = _previousLock; Cursor.visible = _previousVisible; } private void ForceCursor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } private void LateUpdate() { if (_asking) { ForceCursor(); } } private void Dismiss() { Stop(); } private void Confirm() { Stop(); Plugin.CfgGuest.Value = !_draftIsHost; Plugin.CfgSpeakEvents.Value = _draftSpeak; if (_draftIsHost) { Plugin.Log.LogInfo((object)"Voce e o host: os eventos vao rodar por aqui."); Plugin.Reconnect(); } else { Plugin.Log.LogInfo((object)"Modo convidado: nao vou abrir votacao nem ler o chat."); Plugin.Disconnect(); } } private void OnGUI() { //IL_004a: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) if (_asking) { ForceCursor(); float num = 500f * Skin.Scale; float num2 = 420f * Skin.Scale; Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, (float)Screen.height * 0.16f, num, num2); GUI.Box(val, GUIContent.none, Skin.Panel); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 16f, ((Rect)(ref val)).width - 40f, ((Rect)(ref val)).height - 32f)); Color color = GUI.color; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = (Lang.English ? Skin.Muted : Skin.Accent); if (GUILayout.Button((Lang.English ? " " : "> ") + Lang.LanguagePt, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(52f * Skin.Scale) })) { Lang.SetEnglish(english: false); } GUILayout.Space(10f); GUI.color = (Lang.English ? Skin.Accent : Skin.Muted); if (GUILayout.Button((Lang.English ? "> " : " ") + Lang.LanguageEn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(52f * Skin.Scale) })) { Lang.SetEnglish(english: true); } GUILayout.EndHorizontal(); GUI.color = color; GUILayout.Space(14f); GUILayout.Label(Lang.HostQuestion, Skin.Header, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(4f); GUILayout.Label(Lang.HostQuestionHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = (_draftIsHost ? Skin.Good : Skin.Muted); if (GUILayout.Button((_draftIsHost ? "> " : " ") + Lang.HostYes, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(44f * Skin.Scale) })) { _draftIsHost = true; } GUILayout.Space(10f); GUI.color = (_draftIsHost ? Skin.Muted : Skin.Warn); if (GUILayout.Button((_draftIsHost ? " " : "> ") + Lang.HostNoAnswer, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(44f * Skin.Scale) })) { _draftIsHost = false; } GUILayout.EndHorizontal(); GUI.color = color; GUILayout.Space(14f); _draftSpeak = GUILayout.Toggle(_draftSpeak, Lang.SpeakEventsToggle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.SpeakEventsHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(14f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = Skin.Good; if (GUILayout.Button(Lang.Ok, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f * Skin.Scale) })) { Confirm(); } GUILayout.Space(10f); GUI.color = Skin.Muted; if (GUILayout.Button(Lang.Close, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f * Skin.Scale) })) { Dismiss(); } GUILayout.EndHorizontal(); GUI.color = color; GUILayout.Space(6f); GUILayout.Label(Lang.HostQuestionKeys, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndArea(); } } private static bool KeyDown(Key key) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) try { Keyboard current = Keyboard.current; if (current != null) { return ((ButtonControl)current[key]).wasPressedThisFrame; } } catch { } return false; } } public static class ItemCatalog { private static string[] _names; private static readonly string[] Excluded = new string[28] { "C_", "Guidebook", "_Prop", "Variant", "UNUSED", "Cheat", "Bugfix", "Amulet", "PandorasBox", "Cursed", "Strange Gem", "AncientIdol", "ScoutmasterSoul", "RitualDagger", "BookOfBones", "ScoutEffigy", "ScoutsHonor", "Anti-Rope", "AntiRope", "RopeShooterAnti", "AntiZooka", "Chalk", "Peel", "Hidden", "Poison", "Flag_", "Passport", "Compass" }; public static string[] Names { get { if (_names == null) { Refresh(); } return _names; } } public static void Refresh() { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) List list = new List(); try { ItemDatabase[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] == (Object)null || array[i].itemLookup == null) { continue; } foreach (Item value in array[i].itemLookup.Values) { Item val = ((value is Item) ? value : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null)) { string name = ((Object)((Component)val).gameObject).name; if (!string.IsNullOrEmpty(name) && !list.Contains(name)) { list.Add(name); } } } } if (list.Count > 0) { Plugin.Log.LogInfo((object)("ItemDatabase: " + list.Count + " itens registrados.")); } } catch (Exception ex) { Plugin.Log.LogInfo((object)("Nao consegui ler o ItemDatabase (" + ex.Message + "); usando so os prefabs carregados.")); } try { Item[] array2 = Resources.FindObjectsOfTypeAll(); foreach (Item val2 in array2) { if ((Object)(object)val2 == (Object)null) { continue; } Scene scene = ((Component)val2).gameObject.scene; if (!((Scene)(ref scene)).IsValid()) { string name2 = ((Object)((Component)val2).gameObject).name; if (!string.IsNullOrEmpty(name2) && !list.Contains(name2)) { list.Add(name2); } } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Nao consegui listar os itens do jogo: " + ex2.Message)); } list.Sort(StringComparer.OrdinalIgnoreCase); _names = list.ToArray(); Plugin.Log.LogInfo((object)("Catalogo de itens: " + _names.Length + " itens.")); Plugin.Log.LogInfo((object)("Itens disponiveis: " + string.Join(", ", _names))); } public static string Resolve(string wanted) { if (string.IsNullOrEmpty(wanted)) { return null; } string[] names = Names; if (names.Length == 0) { return wanted; } for (int i = 0; i < names.Length; i++) { if (string.Equals(names[i], wanted, StringComparison.OrdinalIgnoreCase)) { return names[i]; } } for (int j = 0; j < names.Length; j++) { if (names[j].StartsWith(wanted, StringComparison.OrdinalIgnoreCase)) { return names[j]; } } for (int k = 0; k < names.Length; k++) { if (names[k].IndexOf(wanted, StringComparison.OrdinalIgnoreCase) >= 0) { return names[k]; } } return null; } public static bool IsSpawnable(string name) { if (string.IsNullOrEmpty(name)) { return false; } for (int i = 0; i < Excluded.Length; i++) { if (name.IndexOf(Excluded[i], StringComparison.OrdinalIgnoreCase) >= 0) { return false; } } return true; } public static string RandomSpawnable() { string[] names = Names; if (names.Length == 0) { return null; } List list = new List(); for (int i = 0; i < names.Length; i++) { if (IsSpawnable(names[i])) { list.Add(names[i]); } } if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } public static int IndexOf(string name) { string[] names = Names; for (int i = 0; i < names.Length; i++) { if (string.Equals(names[i], name, StringComparison.OrdinalIgnoreCase)) { return i; } } return -1; } } public static class ItemSkins { private class Original { public Material[] Materials; public Renderer[] Renderers; public Texture2D Icon; public string Name; } private const string HelpText = "COMO TROCAR A TEXTURA DE UM ITEM\r\n================================\r\n\r\nColoque um PNG nesta pasta com o NOME EXATO do item.\r\n\r\n Energy Drink.png -> textura 3D do energetico\r\n Energy Drink_icon.png -> icone da mochila (opcional)\r\n Energy Drink.txt -> nome novo do item (opcional, uma linha)\r\n\r\nCOMO CONSEGUIR A TEXTURA ORIGINAL PARA PINTAR POR CIMA\r\n No jogo: F6 -> aba Skins -> ache o item na lista -> clique nele.\r\n O mod salva aqui:\r\n\r\n Energy Drink_original.png <- a textura 3D do jogo\r\n Energy Drink_icon_original.png <- o icone do jogo\r\n\r\n Pinte por cima desses arquivos, salve com o nome SEM o _original\r\n (Energy Drink.png) e aperte RECARREGAR SKINS.\r\n\r\n Mantenha o mesmo tamanho da imagem original.\r\n\r\nNomes com espaco funcionam normalmente (Energy Drink, Airplane Food).\r\n\r\nDepois de mexer nos arquivos, aperte F6 -> Itens -> RECARREGAR SKINS.\r\nNao precisa fechar o jogo.\r\n\r\nIMPORTANTE PARA JOGAR JUNTO\r\n---------------------------\r\nA troca e local: quem quiser ver os mesmos itens precisa ter os\r\nMESMOS arquivos nesta pasta. Mande a pasta inteira para os amigos.\r\n"; private static readonly Dictionary _originals = new Dictionary(); public static string Status = ""; public static int Applied { get; private set; } public static string Folder { get { try { string location = Assembly.GetExecutingAssembly().Location; return Path.Combine(Path.GetDirectoryName(location), "skins"); } catch { return null; } } } public static IEnumerator ApplyWhenReady() { float giveUpAt = Time.unscaledTime + 120f; while (Time.unscaledTime < giveUpAt) { ItemCatalog.Refresh(); if (ItemCatalog.Names.Length > 0) { Apply(); yield break; } yield return (object)new WaitForSecondsRealtime(2f); } Plugin.Log.LogInfo((object)"Os itens do jogo nao apareceram; as skins ficam para quando voce entrar numa partida."); } public static void EnsureFolder() { string folder = Folder; if (string.IsNullOrEmpty(folder)) { return; } try { if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string path = Path.Combine(folder, "LEIA-ME.txt"); if (!File.Exists(path)) { File.WriteAllText(path, "COMO TROCAR A TEXTURA DE UM ITEM\r\n================================\r\n\r\nColoque um PNG nesta pasta com o NOME EXATO do item.\r\n\r\n Energy Drink.png -> textura 3D do energetico\r\n Energy Drink_icon.png -> icone da mochila (opcional)\r\n Energy Drink.txt -> nome novo do item (opcional, uma linha)\r\n\r\nCOMO CONSEGUIR A TEXTURA ORIGINAL PARA PINTAR POR CIMA\r\n No jogo: F6 -> aba Skins -> ache o item na lista -> clique nele.\r\n O mod salva aqui:\r\n\r\n Energy Drink_original.png <- a textura 3D do jogo\r\n Energy Drink_icon_original.png <- o icone do jogo\r\n\r\n Pinte por cima desses arquivos, salve com o nome SEM o _original\r\n (Energy Drink.png) e aperte RECARREGAR SKINS.\r\n\r\n Mantenha o mesmo tamanho da imagem original.\r\n\r\nNomes com espaco funcionam normalmente (Energy Drink, Airplane Food).\r\n\r\nDepois de mexer nos arquivos, aperte F6 -> Itens -> RECARREGAR SKINS.\r\nNao precisa fechar o jogo.\r\n\r\nIMPORTANTE PARA JOGAR JUNTO\r\n---------------------------\r\nA troca e local: quem quiser ver os mesmos itens precisa ter os\r\nMESMOS arquivos nesta pasta. Mande a pasta inteira para os amigos.\r\n"); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui preparar a pasta de skins: " + ex.Message)); } } public static void Apply() { string folder = Folder; if (string.IsNullOrEmpty(folder) || !Directory.Exists(folder)) { Status = "pasta de skins nao encontrada"; return; } RestoreAll(); string[] files; try { files = Directory.GetFiles(folder, "*.png"); } catch (Exception ex) { Status = "nao consegui ler a pasta: " + ex.Message; return; } int num = 0; int num2 = 0; for (int i = 0; i < files.Length; i++) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(files[i]); if (!fileNameWithoutExtension.EndsWith("_icon", StringComparison.OrdinalIgnoreCase) && !fileNameWithoutExtension.EndsWith("_original", StringComparison.OrdinalIgnoreCase) && (!Regex.IsMatch(fileNameWithoutExtension, "_\\d+$") || ItemCatalog.Resolve(fileNameWithoutExtension) != null)) { Plugin.Log.LogInfo((object)("Skin encontrada: '" + fileNameWithoutExtension + "'.")); string text = ItemCatalog.Resolve(fileNameWithoutExtension); if (text == null) { Plugin.Log.LogWarning((object)("Skin '" + fileNameWithoutExtension + "': nao existe item com esse nome. Confira a lista de itens no log.")); num2++; } else if (Paint(text, files[i], folder, fileNameWithoutExtension)) { num++; } } } Applied = num; Status = num + " item(ns) repintado(s)" + ((num2 > 0) ? (", " + num2 + " nome(s) nao encontrado(s)") : ""); Plugin.Log.LogInfo((object)("Skins: " + Status)); } private static bool Paint(string itemName, string texturePath, string folder, string bare) { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown Item val = FindPrefab(itemName); if ((Object)(object)val == (Object)null) { return false; } try { Texture2D val2 = Load(texturePath); if ((Object)(object)val2 == (Object)null) { return false; } Remember(itemName, val); List list = AllRenderersOf(val); bool flag = false; for (int i = 1; i < list.Count; i++) { if (File.Exists(Path.Combine(folder, bare + "_" + (i + 1) + ".png"))) { flag = true; break; } } for (int j = 0; j < list.Count; j++) { Renderer val3 = list[j]; if ((Object)(object)val3 == (Object)null || (Object)(object)val3.sharedMaterial == (Object)null) { continue; } Texture2D val4 = val2; if (flag && j > 0) { string path = Path.Combine(folder, bare + "_" + (j + 1) + ".png"); if (!File.Exists(path)) { continue; } val4 = Load(path); if ((Object)(object)val4 == (Object)null) { continue; } } Material val5 = new Material(val3.sharedMaterial); ((Object)val5).hideFlags = (HideFlags)61; string text = MainTextureProperty(val3.sharedMaterial); if (text != null) { val5.SetTexture(text, (Texture)(object)val4); } else { val5.mainTexture = (Texture)(object)val4; } val3.sharedMaterial = val5; } string path2 = Path.Combine(folder, bare + "_icon.png"); if (File.Exists(path2)) { Texture2D val6 = Load(path2); if ((Object)(object)val6 != (Object)null && val.UIData != null) { val.UIData.icon = val6; } } string path3 = Path.Combine(folder, bare + ".txt"); if (File.Exists(path3) && val.UIData != null) { string text2 = File.ReadAllText(path3).Trim(); if (text2.Length > 0) { val.UIData.itemName = text2; } } int num = PaintLiveCopies(itemName, val2, folder, bare); Plugin.Log.LogInfo((object)("Skin aplicada em '" + itemName + "'" + ((num > 0) ? (" e em " + num + " copia(s) ja no mundo.") : "."))); return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha pintando '" + itemName + "': " + ex.Message)); return false; } } private static int PaintLiveCopies(string itemName, Texture2D texture, string folder, string bare) { int num = 0; Item[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] == (Object)null || (Object)(object)((Component)array[i]).gameObject == (Object)null) { continue; } string a = ((Object)((Component)array[i]).gameObject).name.Replace("(Clone)", "").Trim(); if (!string.Equals(a, itemName, StringComparison.OrdinalIgnoreCase)) { continue; } List list = AllRenderersOf(array[i]); for (int j = 0; j < list.Count; j++) { Renderer val = list[j]; if ((Object)(object)val == (Object)null || (Object)(object)val.sharedMaterial == (Object)null) { continue; } Texture2D val2 = texture; if (j > 0) { string path = Path.Combine(folder, bare + "_" + (j + 1) + ".png"); if (!File.Exists(path)) { continue; } val2 = Load(path); if ((Object)(object)val2 == (Object)null) { continue; } } string text = MainTextureProperty(val.sharedMaterial); if (text != null) { val.material.SetTexture(text, (Texture)(object)val2); } else { val.material.mainTexture = (Texture)(object)val2; } } num++; } return num; } public static void RestoreAll() { foreach (KeyValuePair original in _originals) { Original value = original.Value; if (value == null || value.Renderers == null) { continue; } for (int i = 0; i < value.Renderers.Length; i++) { if (!((Object)(object)value.Renderers[i] == (Object)null)) { value.Renderers[i].sharedMaterial = value.Materials[i]; } } Item val = FindPrefab(original.Key); if ((Object)(object)val != (Object)null && val.UIData != null) { val.UIData.icon = value.Icon; val.UIData.itemName = value.Name; } } _originals.Clear(); Applied = 0; } private static void Remember(string itemName, Item item) { if (!_originals.ContainsKey(itemName)) { List list = RenderersOf(item); Original original = new Original(); original.Renderers = list.ToArray(); original.Materials = (Material[])(object)new Material[list.Count]; for (int i = 0; i < list.Count; i++) { original.Materials[i] = (((Object)(object)list[i] == (Object)null) ? null : list[i].sharedMaterial); } if (item.UIData != null) { original.Icon = item.UIData.icon; original.Name = item.UIData.itemName; } _originals[itemName] = original; } } private static List AllRenderersOf(Item item) { List list = RenderersOf(item); Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)null) && !list.Contains(componentsInChildren[i])) { list.Add(componentsInChildren[i]); } } return list; } private static List RenderersOf(Item item) { List list = new List(); if ((Object)(object)item.mainRenderer != (Object)null) { list.Add(item.mainRenderer); } if (item.addtlRenderers != null) { for (int i = 0; i < item.addtlRenderers.Length; i++) { if ((Object)(object)item.addtlRenderers[i] != (Object)null) { list.Add(item.addtlRenderers[i]); } } } if (list.Count == 0) { list.AddRange(((Component)item).GetComponentsInChildren(true)); } return list; } private static Item FindPrefab(string name) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Item[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null) && !((Object)(object)((Component)array[i]).gameObject == (Object)null)) { Scene scene = ((Component)array[i]).gameObject.scene; if (!((Scene)(ref scene)).IsValid() && string.Equals(((Object)((Component)array[i]).gameObject).name, name, StringComparison.OrdinalIgnoreCase)) { return array[i]; } } } return null; } public static void Export(string itemName) { EnsureFolder(); string folder = Folder; if (string.IsNullOrEmpty(folder)) { return; } Item val = FindPrefab(itemName); if ((Object)(object)val == (Object)null) { Status = "nao achei o item '" + itemName + "'"; return; } int num = 0; List list = AllRenderersOf(val); for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] == (Object)null || (Object)(object)list[i].sharedMaterial == (Object)null) { continue; } Material sharedMaterial = list[i].sharedMaterial; string text = MainTextureProperty(sharedMaterial); if (text == null) { Plugin.Log.LogInfo((object)("'" + itemName + "': o material '" + ((Object)sharedMaterial).name + "' nao tem textura para exportar.")); continue; } Texture texture = sharedMaterial.GetTexture(text); if (!((Object)(object)texture == (Object)null)) { Plugin.Log.LogInfo((object)("'" + itemName + "': textura em " + text + ".")); string text2 = ((num == 0) ? "" : ("_" + (num + 1))); string path = Path.Combine(folder, itemName + text2 + "_original.png"); if (Save(texture, path)) { num++; } } } if (val.UIData != null && (Object)(object)val.UIData.icon != (Object)null && Save((Texture)(object)val.UIData.icon, Path.Combine(folder, itemName + "_icon_original.png"))) { num++; } Status = ((num > 0) ? (num + " arquivo(s) exportado(s) para a pasta de skins") : "esse item nao tem textura para exportar"); Plugin.Log.LogInfo((object)("Skins: " + Status)); } private static string MainTextureProperty(Material material) { if ((Object)(object)material == (Object)null || (Object)(object)material.shader == (Object)null) { return null; } string[] array = new string[9] { "_MainTex", "_BaseMap", "_BaseColorMap", "_AlbedoMap", "_Albedo", "_Diffuse", "_DiffuseMap", "_Color_Texture", "_Texture" }; string[] texturePropertyNames; try { texturePropertyNames = material.GetTexturePropertyNames(); } catch { return null; } for (int i = 0; i < array.Length; i++) { for (int j = 0; j < texturePropertyNames.Length; j++) { if (texturePropertyNames[j] == array[i] && (Object)(object)material.GetTexture(texturePropertyNames[j]) != (Object)null) { return texturePropertyNames[j]; } } } for (int k = 0; k < texturePropertyNames.Length; k++) { string text = texturePropertyNames[k].ToLowerInvariant(); if (!text.Contains("normal") && !text.Contains("bump") && !text.Contains("metal") && !text.Contains("rough") && !text.Contains("occlusion") && !text.Contains("emission") && !text.Contains("mask") && !text.Contains("detail") && !text.Contains("height") && !text.Contains("specular") && (Object)(object)material.GetTexture(texturePropertyNames[k]) != (Object)null) { return texturePropertyNames[k]; } } for (int l = 0; l < texturePropertyNames.Length; l++) { if ((Object)(object)material.GetTexture(texturePropertyNames[l]) != (Object)null) { return texturePropertyNames[l]; } } return null; } private static bool Save(Texture source, string path) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) RenderTexture val = null; RenderTexture active = RenderTexture.active; try { val = RenderTexture.GetTemporary(source.width, source.height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); Graphics.Blit(source, val); RenderTexture.active = val; Texture2D val2 = new Texture2D(source.width, source.height, (TextureFormat)4, false); ((Object)val2).hideFlags = (HideFlags)61; val2.ReadPixels(new Rect(0f, 0f, (float)source.width, (float)source.height), 0, 0); val2.Apply(); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val2)); Object.Destroy((Object)(object)val2); Plugin.Log.LogInfo((object)("Exportado: " + Path.GetFileName(path) + " (" + source.width + "x" + source.height + ")")); return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui exportar '" + path + "': " + ex.Message)); return false; } finally { RenderTexture.active = active; if ((Object)(object)val != (Object)null) { RenderTexture.ReleaseTemporary(val); } } } private static Texture2D Load(string path) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ((Object)val).hideFlags = (HideFlags)61; if (!ImageConversion.LoadImage(val, array)) { Plugin.Log.LogWarning((object)("'" + Path.GetFileName(path) + "' nao e um PNG valido.")); return null; } return val; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui ler '" + path + "': " + ex.Message)); return null; } } } public static class Lang { public static bool English; private static readonly Dictionary Events = new Dictionary { { "dinamite", new string[2] { "Dynamite", "Dynamite drops next to you" } }, { "tornado", new string[2] { "Tornado", "A tornado appears on the mountain" } }, { "zumbis", new string[2] { "Zombies", "One zombie for every living scout" } }, { "nevasca", new string[2] { "Windstorm", "Hard freezing wind that shoves climbers around" } }, { "walkingdead", new string[2] { "Walking Dead", "A horde of weak zombies, but a lot of them" } }, { "itemaleatorio", new string[2] { "3 random items", "Three random items drop, anything goes" } }, { "viratornado", new string[2] { "Turn into a tornado", "A drawn scout becomes a real tornado" } }, { "reviver", new string[2] { "Revive a friend", "A Scout Effigy drops, the item that brings someone back" } }, { "bingbong", new string[2] { "Bing Bong!", "A rain of Bing Bongs falls from the sky" } }, { "sapo", new string[2] { "Frogs", "Three frogs show up out of nowhere" } }, { "humilhar", new string[2] { "Humiliate", "A countdown, and then the shame" } }, { "vozmaluca", new string[2] { "Silly voices", "Half the group goes deep, the other half goes squeaky" } }, { "sacrificio", new string[2] { "Sacrifice or Die", "A dagger drops and the clock starts running" } }, { "scoutmaster", new string[2] { "SCOUTMASTER", "He comes after you. Never in the vote: button only." } }, { "fome", new string[2] { "Hunger", "Hunger hits all at once" } }, { "curar", new string[2] { "Cure everything", "Removes every negative effect from everyone" } }, { "cura", new string[2] { "Healing item", "A random healing item falls from the sky" } }, { "comida", new string[2] { "Food", "Random food to get your strength back" } }, { "escalada", new string[2] { "Climbing item", "A random climbing item to help with the ascent" } } }; public static string LanguagePt => "Português BR"; public static string LanguageEn => "English"; public static string VoteTitle { get { if (!English) { return "VOTAÇÃO DO CHAT"; } return "CHAT VOTE"; } } public static string ResultTitle { get { if (!English) { return "RESULTADO"; } return "RESULT"; } } public static string TypeNumber { get { if (!English) { return "Digite o número no chat"; } return "Type the number in chat"; } } public static string TabGeneral { get { if (!English) { return "Geral"; } return "General"; } } public static string TabEvents { get { if (!English) { return "Eventos"; } return "Events"; } } public static string TabTest { get { if (!English) { return "Testar"; } return "Test"; } } public static string TabSkins { get { if (!English) { return "Skins"; } return "Skins"; } } public static string SkinsTitle { get { if (!English) { return "Trocar a textura dos itens"; } return "Repaint the game's items"; } } public static string SkinsHint { get { if (!English) { return "Ponha um PNG com o nome do item na pasta de skins e todos aqueles itens passam a usar ele. Use _icon para o ícone da mochila, ou um txt com o mesmo nome para renomear o item."; } return "Drop a PNG named after an item into the skins folder and every one of those items wears it. Add _icon for the backpack picture, or a txt with the same name to rename the item."; } } public static string ReloadSkins { get { if (!English) { return "RECARREGAR SKINS"; } return "RELOAD SKINS"; } } public static string OpenSkinsFolder { get { if (!English) { return "Abrir a pasta"; } return "Open the folder"; } } public static string RestoreSkins { get { if (!English) { return "Desfazer tudo"; } return "Undo all"; } } public static string SkinsItemList { get { if (!English) { return "Itens — clique para exportar"; } return "Items — click to export"; } } public static string SkinsExportHint { get { if (!English) { return "Clique num item para exportar a textura e o ícone atuais em PNG. Pinte por cima, salve sem o _original, e recarregue."; } return "Click an item to export its current texture and icon as PNG. Paint over those, save without the _original, and reload."; } } public static string SkinsItemListHint { get { if (!English) { return "Nomeie o PNG exatamente como um destes. Espaços podem."; } return "Name the PNG exactly like one of these. Spaces are fine."; } } public static string Channel { get { if (!English) { return "Canal da Twitch"; } return "Twitch channel"; } } public static string ChannelHint { get { if (!English) { return "Só o nome, sem o https://twitch.tv/"; } return "Just the name, without https://twitch.tv/"; } } public static string Apply { get { if (!English) { return "OK"; } return "OK"; } } public static string Connected { get { if (!English) { return "Conectado em"; } return "Connected to"; } } public static string Connecting { get { if (!English) { return "Conectando..."; } return "Connecting..."; } } public static string NotConnected { get { if (!English) { return "Sem conexão - o chat não vota"; } return "Not connected - chat cannot vote"; } } public static string Pacing { get { if (!English) { return "Ritmo"; } return "Pacing"; } } public static string SecondsBetween { get { if (!English) { return "Segundos entre eventos"; } return "Seconds between events"; } } public static string VoteDuration { get { if (!English) { return "Duração da votação (s)"; } return "Vote duration (s)"; } } public static string ResultDuration { get { if (!English) { return "Resultado na tela (s)"; } return "Result on screen (s)"; } } public static string PanelSection { get { if (!English) { return "Painel de votação"; } return "Vote panel"; } } public static string PanelLeft { get { if (!English) { return " Mostrar do lado esquerdo"; } return " Show on the left side"; } } public static string PanelWidth { get { if (!English) { return "Largura do painel"; } return "Panel width"; } } public static string PanelTop { get { if (!English) { return "Distância do topo"; } return "Distance from top"; } } public static string CursorNote { get { if (!English) { return "O painel de votação não mexe no mouse: você continua controlando o personagem enquanto o chat vota."; } return "The vote panel never touches the mouse: you keep controlling your character while chat votes."; } } public static string EventsHint { get { if (!English) { return "Desligue o que não quiser. Cada votação mostra 2 eventos bons e 3 ruins."; } return "Turn off what you do not want. Each vote shows 2 good options and 3 bad ones."; } } public static string Item { get { if (!English) { return "Item:"; } return "Item:"; } } public static string Amount { get { if (!English) { return "Quantidade:"; } return "Amount:"; } } public static string AmountEach { get { if (!English) { return "Por jogador:"; } return "Each player:"; } } public static string Intensity { get { if (!English) { return "Intensidade"; } return "Intensity"; } } public static string Search { get { if (!English) { return "Buscar:"; } return "Search:"; } } public static string NoItems { get { if (!English) { return "Nenhum item encontrado. Entre numa partida e abra de novo."; } return "No items found. Join a game and open this again."; } } public static string NothingNamed { get { if (!English) { return "Nada com esse nome."; } return "Nothing with that name."; } } public static string OpenVoteNow { get { if (!English) { return "Abrir votação agora (ver o HUD)"; } return "Open a vote now (see the HUD)"; } } public static string OpenVoteHint { get { if (!English) { return "Fecha o menu e abre a votação na hora, com a duração configurada."; } return "Closes the menu and starts a vote right away, with the configured duration."; } } public static string FireEvent { get { if (!English) { return "Disparar um evento direto"; } return "Fire an event directly"; } } public static string HostOk { get { if (!English) { return " Você é o HOST - tudo funciona"; } return " You are the HOST - everything works"; } } public static string HostNo { get { if (!English) { return " Você NÃO é o host - tornado, zumbis e itens serão ignorados"; } return " You are NOT the host - tornado, zombies and items will be skipped"; } } public static string NoRoom { get { if (!English) { return " Fora de sala - só efeitos locais funcionam"; } return " Not in a room - only local effects work"; } } public static string ModPausedStart { get { if (!English) { return "Mod Pausado: Iniciar"; } return "Mod paused: START"; } } public static string ModRunningPause { get { if (!English) { return "Mod Rodando: Pausar"; } return "Mod running: PAUSE"; } } public static string PausedLine { get { if (!English) { return " Pausado - a contagem está parada"; } return " Paused - the countdown is stopped"; } } public static string PausedHint { get { if (!English) { return "Todo lobby começa pausado. Aperte Iniciar quando a partida estiver realmente rolando."; } return "Every lobby starts paused. Press START when the run is actually underway."; } } public static string RestoreDefaults { get { if (!English) { return "RESTAURAR PADRÃO"; } return "RESTORE DEFAULTS"; } } public static string RestoreDefaultsHint { get { if (!English) { return "Volta esta aba aos valores originais do mod. O nome do seu canal e a sua chave da ElevenLabs nunca são mexidos."; } return "Puts this tab back to the values the mod ships with. Your channel name and your ElevenLabs key are never touched."; } } public static string StartNow { get { if (!English) { return "INICIAR VOTAÇÃO"; } return "START VOTE NOW"; } } public static string GuestSection { get { if (!English) { return "Quem é você neste lobby"; } return "Who are you in this lobby"; } } public static string GuestToggle { get { if (!English) { return " Não sou o host"; } return " I am NOT the host"; } } public static string GuestHint { get { if (!English) { return "Ligue quando estiver jogando no lobby de outra pessoa. O mod para de ler o chat e nunca abre votação aqui, então você não interfere. Você continua vendo tudo, e os botões de teste continuam funcionando."; } return "Turn this on when you are playing in someone else's lobby. The mod stops reading chat and never opens a vote here, so you cannot interfere. You still see everything, and the test buttons still work."; } } public static string GuestActive { get { if (!English) { return " MODO CONVIDADO - nenhuma votação automática roda aqui"; } return " GUEST MODE - no automatic vote runs here"; } } public static string AskOnJoin { get { if (!English) { return " Perguntar ao entrar no lobby"; } return " Ask when I join a lobby"; } } public static string HostQuestion { get { if (!English) { return "Você é o host?"; } return "Are you the host?"; } } public static string HostQuestionHint { get { if (!English) { return "Só o host deve disparar eventos. Se responder errado, você joga tornado na jogatina dos outros."; } return "Only the host should fire events. Answer wrong and you would be throwing tornadoes into someone else's run."; } } public static string HostYes { get { if (!English) { return "SOU SIM"; } return "YES, I am"; } } public static string HostNoAnswer { get { if (!English) { return "NÃO, sou convidado"; } return "NO, I am a guest"; } } public static string WheelHuntTitle { get { if (!English) { return "QUEM SERÁ CAÇADO?"; } return "WHO GETS HUNTED?"; } } public static string WheelTornadoTitle { get { if (!English) { return "QUEM VIRA O TORNADO?"; } return "WHO BECOMES THE TORNADO?"; } } public static string WheelChosen { get { if (!English) { return "O ESCOLHIDO"; } return "THE CHOSEN ONE"; } } public static string TornadoMissing { get { if (!English) { return "O mod I_am_a_Tornado não está instalado aqui, então nada aconteceu."; } return "The I_am_a_Tornado mod is not installed here, so nothing happened."; } } public static string HumiliateWarning { get { if (!English) { return "SE PREPARA..."; } return "BRACE YOURSELF..."; } } public static string TornadoLetGo { get { if (!English) { return "SOLTE A PAREDE! Não dá para virar tornado escalando."; } return "LET GO OF THE WALL! You cannot become a tornado while climbing."; } } public static string TornadoMissedIt { get { if (!English) { return "Você ficou na parede o tempo todo. Sem tornado para você."; } return "You stayed on the wall the whole time. No tornado for you."; } } public static string TornadoYouAre { get { if (!English) { return "VOCÊ É O TORNADO!"; } return "YOU ARE THE TORNADO!"; } } public static string SacrificeReveal { get { if (!English) { return "Eu não sei se você sacrificou alguém ou não, mas eu estava só brincando!\nVocê não sacrificou ninguém, né?"; } return "I have no idea whether you sacrificed anyone, but I was only joking!\nYou didn't sacrifice anyone... right?"; } } public static string TabVoice { get { if (!English) { return "Voz"; } return "Voice"; } } public static string TabAdmin { get { if (!English) { return "(admin não mexer!)"; } return "(admin do not touch!)"; } } public static string VoiceOverTitle { get { if (!English) { return "Falar na cabeça de todos"; } return "Speak into everyone head"; } } public static string VoiceOverHint { get { if (!English) { return "Escreva e envie: a frase sai na voz da ElevenLabs e toca para todo jogador que tenha o mod, esteja onde estiver. Só a sua chave é cobrada."; } return "Type and send: the line is spoken by the ElevenLabs voice and plays for every player who has the mod, wherever they are. Only your key is charged."; } } public static string Speak { get { if (!English) { return "FALAR"; } return "SPEAK"; } } public static string NeedKey { get { if (!English) { return "Sem chave da ElevenLabs ainda. Aperte F6, aba Voz."; } return "No ElevenLabs key yet. Press F6, Voice tab."; } } public static string VoicePitch { get { if (!English) { return "Tom da voz"; } return "Pitch"; } } public static string VoiceVolume { get { if (!English) { return "Volume da voz"; } return "Volume"; } } public static string AdminWarning { get { if (!English) { return "Trapaças - não mexer"; } return "Cheats - do not touch"; } } public static string AdminHint { get { if (!English) { return "Tudo isto vale só para você, que clicou. Mais ninguém no lobby ganha nada disso, e ninguém mais pode ser afetado."; } return "These only ever apply to you, the one clicking. Nobody else in the lobby gets them, and nobody else can be affected by them."; } } public static string Invisible { get { if (!English) { return " Invisível"; } return " Invisible"; } } public static string Fly { get { if (!English) { return " Voar"; } return " Fly"; } } public static string Invincible { get { if (!English) { return " Invencível"; } return " Invincible"; } } public static string InvincibleHint { get { if (!English) { return "Segura todos os efeitos em zero, então nada te mata. Só você."; } return "Holds every affliction at zero, so nothing can kill you. Only you."; } } public static string FlyHint { get { if (!English) { return "Voando: WASD anda, Espaço sobe, Ctrl esquerdo desce."; } return "While flying: WASD moves, Space goes up, Left Ctrl goes down."; } } public static string FontSize { get { if (!English) { return "Tamanho da letra"; } return "Menu font size"; } } public static string ReceiverSection { get { if (!English) { return "Quem recebe os itens"; } return "Who receives the items"; } } public static string ReceiverRandom { get { if (!English) { return " Um jogador vivo aleatório (desligado = o host)"; } return " A random living player (off = the host)"; } } public static string ReceiverHint { get { if (!English) { return "Só um jogador recebe os itens. O padrão é o host; se o host estiver morto vai para um jogador vivo de qualquer jeito."; } return "Only one player receives an item drop. The host is the default; if the host is dead it always goes to a living player instead."; } } public static string ApiKeyLabel { get { if (!English) { return "Chave da ElevenLabs"; } return "ElevenLabs key"; } } public static string ApiKeyHint { get { if (!English) { return "Fica só na sua máquina e nunca vai junto com o mod. Nunca compartilhe o arquivo de config: quem tiver a chave gasta os seus créditos."; } return "Stays on your machine only and never ships with the mod. Never share your config file: whoever has the key spends your credits."; } } public static string ModelLabel { get { if (!English) { return "Modelo da ElevenLabs"; } return "ElevenLabs model"; } } public static string ModelMultilingual { get { if (!English) { return "Multi-idioma"; } return "Multilingual"; } } public static string ModelTurbo { get { if (!English) { return "Turbo (rapido)"; } return "Turbo (faster)"; } } public static string ModelHint { get { if (!English) { return "O Multi-idioma lê português direito. O Turbo é mais rápido e barato, mas o sotaque dele em português é pior."; } return "Multilingual reads Portuguese properly. Turbo is faster and cheaper, but its accent on non-English text is worse."; } } public static string LoadVoices { get { if (!English) { return "CARREGAR VOZES"; } return "LOAD VOICES"; } } public static string SpeakEventsToggle { get { if (!English) { return " Ler em voz alta o evento que ganhou"; } return " Read the winning event out loud"; } } public static string SpeakEventsHint { get { if (!English) { return "Só o título do evento é lido. A contagem regressiva nunca é lida."; } return "Only the event title is read. The countdown is never read."; } } public static string SacrificeEndSeconds { get { if (!English) { return "Fim do sacrifício (s)"; } return "Sacrifice ending (s)"; } } public static string SacrificeEndHint { get { if (!English) { return "Quanto do áudio final toca. 0 toca ele inteiro."; } return "How much of the closing clip plays. 0 plays all of it."; } } public static string SuspenseInterval { get { if (!English) { return "Som de suspense a cada (s)"; } return "Suspense sound every (s)"; } } public static string TestVoice { get { if (!English) { return "TESTAR"; } return "TEST"; } } public static string MemeSoundsToggle { get { if (!English) { return " Sons de meme dos eventos"; } return " Event meme sounds"; } } public static string Ok { get { if (!English) { return "OK"; } return "OK"; } } public static string HostQuestionKeys { get { if (!English) { return "Teclado: S = sim, N = não, Enter = OK, Esc = fechar."; } return "Keyboard: S = yes, N = no, Enter = OK, Esc = close."; } } public static string NextVoteIn { get { if (!English) { return "Próxima votação em"; } return "Next vote in"; } } public static string TimerWaitingRoom { get { if (!English) { return "O relógio começa quando a partida começar"; } return "Timer starts when the run begins"; } } public static string TimerRunningNow { get { if (!English) { return "Tem votação acontecendo agora"; } return "A vote is running now"; } } public static string TimerUnavailable { get { if (!English) { return "Relógio indisponível"; } return "Timer unavailable"; } } public static string TabZombies { get { if (!English) { return "Zumbis"; } return "Zombies"; } } public static string ZombieTuning { get { if (!English) { return "Comportamento dos zumbis"; } return "Zombie behaviour"; } } public static string ZombieTuningHint { get { if (!English) { return "1.00 é o valor original do jogo. Os valores escalam o padrão, então não quebram."; } return "1.00 is the game's own value. These scale the prefab, so they stay sane."; } } public static string ZombieStrength { get { if (!English) { return "Força"; } return "Strength"; } } public static string ZombieStrengthHint { get { if (!English) { return "Empurrão da investida e quanto tempo a mordida atordoa."; } return "Lunge shove and how long a bite stuns you."; } } public static string ZombieSpeed { get { if (!English) { return "Velocidade"; } return "Speed"; } } public static string ZombieSpeedHint { get { if (!English) { return "De quão longe disparam a correr e quão rápido partem pra cima."; } return "How far away they start sprinting and how quickly they commit."; } } public static string ZombieAggression { get { if (!English) { return "Agressividade"; } return "Aggression"; } } public static string ZombieAggressionHint { get { if (!English) { return "De quão longe acordam, perseguem e dão o bote."; } return "How far away they wake up, chase and lunge."; } } public static string PresetWeak { get { if (!English) { return "Fracos"; } return "Weak"; } } public static string PresetNormal { get { if (!English) { return "Normais"; } return "Normal"; } } public static string PresetBrutal { get { if (!English) { return "Brutais"; } return "Brutal"; } } public static string ApplyToExisting { get { if (!English) { return "Aplicar nos zumbis já vivos"; } return "Apply to zombies already alive"; } } public static string ApplyToExistingHint { get { if (!English) { return "Normalmente os valores só valem para os zumbis criados daqui pra frente."; } return "New settings normally only reach zombies spawned from now on."; } } public static string ZombieDefence { get { if (!English) { return "Itens de defesa com a horda"; } return "Defence items with the horde"; } } public static string ZombieDefenceHint { get { if (!English) { return "Por jogador vivo. Quando o evento de zumbis dispara, cada sobrevivente recebe esta quantidade largada na frente dele."; } return "Per living player. When the zombie event fires, each survivor gets this many dropped right in front of them."; } } public static string StopAll { get { if (!English) { return "PARAR TUDO AGORA"; } return "STOP EVERYTHING NOW"; } } public static string StopAllHint { get { if (!English) { return "Remove tornados e zumbis, desliga a ventania e cancela o sacrifício."; } return "Removes every tornado and zombie, switches the wind off and calls off the sacrifice."; } } public static string Close { get { if (!English) { return "Fechar"; } return "Close"; } } public static string Votes { get { if (!English) { return "votos"; } return "votes"; } } public static void SetEnglish(bool english) { English = english; if (Plugin.CfgEnglish != null) { Plugin.CfgEnglish.Value = english; } } public static string EventTitle(string id, string fallback) { if (!English || id == null) { return fallback; } if (Events.TryGetValue(id, out var value)) { return value[0]; } return fallback; } public static string EventDescription(string id, string fallback) { if (!English || id == null) { return fallback; } if (Events.TryGetValue(id, out var value)) { return value[1]; } return fallback; } public static string TornadoWarning(string who) { if (!English) { return "Player " + who + " se transformará em um TORNADO!"; } return "Player " + who + " will turn into a TORNADO!"; } public static string SacrificeThreat(float seconds) { int num = Mathf.RoundToInt(seconds / 60f); int num2 = Mathf.RoundToInt(seconds); string text = ((!English) ? ((seconds >= 90f) ? (num + ((num == 1) ? " minuto" : " minutos")) : (num2 + " segundos")) : ((seconds >= 90f) ? (num + ((num == 1) ? " minute" : " minutes")) : (num2 + " seconds"))); if (!English) { return "Você tem " + text + " para SACRIFICAR um escoteiro ou MORRERÁ!\nBOA SORTE!"; } return "You have " + text + " to SACRIFICE a scout or you will DIE!\nGOOD LUCK!"; } } public class MessageOverlay : MonoBehaviour { private const float ClockScale = 1.3f; public static MessageOverlay Instance; private string _text = ""; private float _hideAt; private float _countdownEndsAt = -1f; private Color _tint = Color.white; private string _clockLabel = ""; private float _clockEndsAt = -1f; private string _bannerText = ""; private float _bannerHideAt; private Color _bannerTint = Color.white; private GUIStyle _big; private GUIStyle _timer; private GUIStyle _clockText; private GUIStyle _clockDigits; private string[] _wheelNames; private int _wheelIndex = -1; private bool _wheelSettled; private string _wheelTitle = ""; private float _builtAtScale = -1f; private void Awake() { Instance = this; } public static void Show(string text, float seconds, Color tint, float countdown = -1f) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null)) { Instance._text = text; Instance._tint = tint; Instance._hideAt = Time.unscaledTime + seconds; Instance._countdownEndsAt = ((countdown > 0f) ? (Time.unscaledTime + countdown) : (-1f)); } } public static void ShowBanner(string text, float seconds, Color tint) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null)) { Instance._bannerText = text; Instance._bannerTint = tint; Instance._bannerHideAt = Time.unscaledTime + seconds; } } public static void ShowClock(string label, float seconds) { if (!((Object)(object)Instance == (Object)null)) { Instance._clockLabel = label; Instance._clockEndsAt = ((seconds > 0f) ? (Time.unscaledTime + seconds) : (-1f)); } } public static void ClearClock() { if (!((Object)(object)Instance == (Object)null)) { Instance._clockEndsAt = -1f; } } public static void Clear() { if (!((Object)(object)Instance == (Object)null)) { Instance._text = ""; Instance._countdownEndsAt = -1f; Instance._clockEndsAt = -1f; Instance._bannerText = ""; } } public static void ShowWheel(string title, string[] names, int highlighted, bool settled) { if (!((Object)(object)Instance == (Object)null)) { Instance._wheelTitle = title; Instance._wheelNames = names; Instance._wheelIndex = highlighted; Instance._wheelSettled = settled; } } public static void HideWheel() { if (!((Object)(object)Instance == (Object)null)) { Instance._wheelNames = null; Instance._wheelIndex = -1; } } private void EnsureStyles() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown if (_big == null || !Mathf.Approximately(_builtAtScale, Skin.Scale)) { _builtAtScale = Skin.Scale; _big = new GUIStyle(GUI.skin.label); _big.fontSize = 30; _big.fontStyle = (FontStyle)1; _big.alignment = (TextAnchor)4; _big.wordWrap = true; _timer = new GUIStyle(GUI.skin.label); _timer.fontSize = 56; _timer.fontStyle = (FontStyle)1; _timer.alignment = (TextAnchor)4; _clockText = new GUIStyle(GUI.skin.label); _clockText.fontSize = Mathf.RoundToInt(23.4f); _clockText.fontStyle = (FontStyle)1; _clockText.alignment = (TextAnchor)4; _clockDigits = new GUIStyle(GUI.skin.label); _clockDigits.fontSize = Mathf.RoundToInt(52f); _clockDigits.fontStyle = (FontStyle)1; _clockDigits.alignment = (TextAnchor)4; } } private void OnGUI() { //IL_0093: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) EnsureStyles(); DrawClock(); DrawWheel(); DrawBanner(); if (string.IsNullOrEmpty(_text)) { return; } if (Time.unscaledTime >= _hideAt) { _text = ""; return; } float num = Mathf.Min(900f, (float)Screen.width * 0.8f); float num2 = ((_countdownEndsAt > 0f) ? 200f : 130f); Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, (float)Screen.height * 0.18f, num, num2); GUI.Box(val, GUIContent.none, Skin.Panel); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 16f, ((Rect)(ref val)).width - 40f, ((Rect)(ref val)).height - 32f)); Color color = GUI.color; GUI.color = _tint; GUILayout.Label(_text, _big, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; if (_countdownEndsAt > 0f) { int num3 = Mathf.Max(0, Mathf.CeilToInt(_countdownEndsAt - Time.unscaledTime)); GUILayout.Space(6f); GUI.color = ((num3 <= 5) ? Skin.Bad : Skin.Warn); GUILayout.Label(num3 + "s", _timer, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; } GUILayout.EndArea(); } private void DrawBanner() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_bannerText)) { if (Time.unscaledTime >= _bannerHideAt) { _bannerText = ""; return; } float num = Mathf.Min(760f, (float)Screen.width * 0.7f); Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, (float)Screen.height * 0.6f, num, 110f); GUI.Box(val, GUIContent.none, Skin.Panel); Color color = GUI.color; GUI.color = _bannerTint; GUI.Label(new Rect(((Rect)(ref val)).x + 16f, ((Rect)(ref val)).y + 12f, ((Rect)(ref val)).width - 32f, ((Rect)(ref val)).height - 24f), _bannerText, _big); GUI.color = color; } } private void DrawWheel() { //IL_0052: 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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00a1: 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) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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) //IL_012b: 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_0178: Unknown result type (might be due to invalid IL or missing references) if (_wheelNames == null || _wheelNames.Length == 0) { return; } float num = 420f; float num2 = 90f + (float)_wheelNames.Length * 42f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, (float)Screen.height * 0.22f, num, num2); GUI.Box(val, GUIContent.none, Skin.Panel); Color color = GUI.color; GUI.color = (_wheelSettled ? Skin.Bad : Skin.Warn); GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 12f, ((Rect)(ref val)).width, 32f), _wheelTitle, _big); GUI.color = color; Rect val2 = default(Rect); for (int i = 0; i < _wheelNames.Length; i++) { ((Rect)(ref val2))..ctor(((Rect)(ref val)).x + 20f, ((Rect)(ref val)).y + 58f + (float)i * 42f, ((Rect)(ref val)).width - 40f, 36f); bool flag = i == _wheelIndex; if (flag) { GUI.color = (_wheelSettled ? Skin.Bad : Skin.Accent); GUI.DrawTexture(val2, (Texture)(object)Skin.White); GUI.color = Color.black; } else { GUI.color = Skin.Muted; } GUI.Label(val2, (flag ? "► " : " ") + _wheelNames[i], _clockText); GUI.color = color; } } private void DrawClock() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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) //IL_0183: Unknown result type (might be due to invalid IL or missing references) if (!(_clockEndsAt < 0f)) { float num = _clockEndsAt - Time.unscaledTime; if (num <= 0f) { _clockEndsAt = -1f; return; } float num2 = 286f; float num3 = 111.799995f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num2) / 2f, 12f, num2, num3); GUI.Box(val, GUIContent.none, Skin.Panel); int num4 = Mathf.FloorToInt(num / 60f); int num5 = Mathf.FloorToInt(num % 60f); float num6 = ((num <= 10f) ? 8f : 3f); float num7 = (Mathf.Sin(Time.unscaledTime * num6) + 1f) * 0.5f; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.55f, 0.05f, 0.08f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.25f, 0.25f); Color color = Color.Lerp(val2, val3, num7); Color color2 = GUI.color; GUI.color = color; GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 10.4f, ((Rect)(ref val)).width, 31.199999f), _clockLabel, _clockText); GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 41.6f, ((Rect)(ref val)).width, 62.399998f), num4.ToString("00") + ":" + num5.ToString("00"), _clockDigits); GUI.color = color2; } } } public class Net : MonoBehaviour, IOnEventCallback { public class MirroredVote { public string[] Titles = new string[0]; public bool[] Good = new bool[0]; public int[] Votes = new int[0]; public float SecondsLeft; public byte Phase; public float ReceivedAt; public string WinnerLine = ""; public int WinnerIndex = -1; } private const byte CodeVoteState = 180; private const byte CodeAnnounce = 181; private const byte CodeNotice = 182; private const byte CodeVoice = 183; private const byte CodeCommand = 184; private const byte CodeWheel = 185; private const byte CodeSound = 186; private const byte CodeHide = 187; private const byte CodeVoicePitch = 188; public static Net Instance; public static MirroredVote Mirror; private readonly Dictionary _voiceParts = new Dictionary(); private static bool Ready => PhotonNetwork.InRoom; private void Awake() { Instance = this; } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } private static void Send(byte code, object content, int targetActor) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return; } try { RaiseEventOptions val = new RaiseEventOptions(); if (targetActor > 0) { val.TargetActors = new int[1] { targetActor }; } else if (targetActor < 0) { val.Receivers = (ReceiverGroup)0; } else { val.Receivers = (ReceiverGroup)1; } PhotonNetwork.RaiseEvent(code, content, val, SendOptions.SendReliable); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui enviar pela rede: " + ex.Message)); } } public static void SendVoteState(string[] titles, bool[] good, int[] votes, float secondsLeft, byte phase, string winnerLine, int winnerIndex) { Send(180, new object[7] { titles, good, votes, secondsLeft, phase, (winnerLine == null) ? "" : winnerLine, winnerIndex }, 0); } public static void SendAnnounce(string eventId, string fallbackTitle, string fallbackDescription, bool isGood) { Send(181, new object[4] { (eventId == null) ? "" : eventId, (fallbackTitle == null) ? "" : fallbackTitle, (fallbackDescription == null) ? "" : fallbackDescription, isGood }, 0); } public static void SendNotice(int targetActor, string key, string text, float seconds, float countdown, string sound) { Send(182, new object[5] { (key == null) ? "" : key, (text == null) ? "" : text, seconds, countdown, (sound == null) ? "" : sound }, targetActor); } public static void SendCommand(int targetActor, string command, float value) { Send(184, new object[2] { command, value }, targetActor); } public static void SendStopAll() { Send(184, new object[2] { "stop", 0f }, -1); } public static void SendWheel(string title, string[] names, int winnerIndex) { Send(185, new object[3] { (title == null) ? "" : title, names, winnerIndex }, 0); } public static void PlaySoundEverywhere(string name, float volumeScale) { Sounds.Play(name, volumeScale); Send(186, new object[2] { name, volumeScale }, -1); } private static void OnSound(object[] data) { Sounds.Play((string)data[0], (float)data[1]); } public static void SendHide(int actorNumber, bool hide) { if (actorNumber > 0) { Send(187, new object[2] { actorNumber, hide }, -1); } } public static void SendVoicePitch(int[] actors, float[] pitches, float seconds) { Send(188, new object[3] { actors, pitches, seconds }, -1); } private static void OnVoicePitch(object[] data) { VoiceChaos.Apply((int[])data[0], (float[])data[1], (float)data[2]); } private static void OnHide(object[] data) { Character val = Hide.ByActor((int)data[0]); if ((Object)(object)val != (Object)null) { Hide.Apply(val, (bool)data[1]); } } public static void SendVoice(byte[] mp3, float pitch) { if (mp3 != null && mp3.Length != 0) { int num = (mp3.Length + 24576 - 1) / 24576; int num2 = Random.Range(1, int.MaxValue); for (int i = 0; i < num; i++) { int num3 = i * 24576; int num4 = Mathf.Min(24576, mp3.Length - num3); byte[] array = new byte[num4]; Buffer.BlockCopy(mp3, num3, array, 0, num4); Send(183, new object[5] { num2, i, num, array, pitch }, -1); } Plugin.Log.LogInfo((object)("Voz enviada em " + num + " pedaco(s).")); } } public void OnEvent(EventData photonEvent) { if (photonEvent.Code < 180 || photonEvent.Code > 188 || !(photonEvent.CustomData is object[] data)) { return; } try { switch (photonEvent.Code) { case 180: OnVoteState(data); break; case 181: OnAnnounce(data); break; case 182: OnNotice(data); break; case 184: OnCommand(data); break; case 183: OnVoice(data); break; case 185: OnWheel(data); break; case 186: OnSound(data); break; case 187: OnHide(data); break; case 188: OnVoicePitch(data); break; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Erro tratando evento de rede: " + ex.Message)); } } private static void OnVoteState(object[] data) { if (!PhotonNetwork.IsMasterClient) { if (Mirror == null) { Mirror = new MirroredVote(); } Mirror.Titles = (string[])data[0]; Mirror.Good = (bool[])data[1]; Mirror.Votes = (int[])data[2]; Mirror.SecondsLeft = (float)data[3]; Mirror.Phase = (byte)data[4]; Mirror.WinnerLine = (string)data[5]; Mirror.WinnerIndex = (int)data[6]; Mirror.ReceivedAt = Time.unscaledTime; } } private static void OnAnnounce(object[] data) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) string text = (string)data[0]; string text2 = (string)data[1]; string text3 = (string)data[2]; bool flag = (bool)data[3]; for (int i = 0; i < GameEvents.All.Count; i++) { if (!(GameEvents.All[i].Id != text)) { text2 = GameEvents.All[i].Title; text3 = GameEvents.All[i].Description; break; } } MessageOverlay.ShowBanner(text2 + "\n" + text3, 6f, flag ? Skin.Good : Skin.Bad); } private static void OnNotice(object[] data) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) string text = (string)data[0]; string text2 = (string)data[1]; float seconds = (float)data[2]; float num = (float)data[3]; string text3 = (string)data[4]; switch (text) { case "sacrifice_threat": text2 = Lang.SacrificeThreat(num); break; case "sacrifice_reveal": text2 = Lang.SacrificeReveal; break; case "humiliate": text2 = Lang.HumiliateWarning; break; } MessageOverlay.Show(text2, seconds, Skin.Bad, num); if (!string.IsNullOrEmpty(text3)) { Sounds.Play(text3); } } private static void OnWheel(object[] data) { if (!PhotonNetwork.IsMasterClient && !((Object)(object)Plugin.Instance == (Object)null)) { string title = (string)data[0]; string[] names = (string[])data[1]; int winnerIndex = (int)data[2]; ((MonoBehaviour)Plugin.Instance).StartCoroutine(GameEvents.SpinWheelLocal(title, names, winnerIndex)); } } private static void OnCommand(object[] data) { string text = (string)data[0]; float seconds = (float)data[1]; if (text == "tornado") { TornadoForm.BecomeTornado(seconds); } else if (text == "stop") { MessageOverlay.Clear(); MessageOverlay.HideWheel(); Sounds.StopAll(); VoiceChaos.Clear(); Plugin.Log.LogInfo((object)"O host encerrou os eventos."); } } private void OnVoice(object[] data) { int key = (int)data[0]; int num = (int)data[1]; int num2 = (int)data[2]; byte[] array = (byte[])data[3]; float pitch = (float)data[4]; if (!_voiceParts.TryGetValue(key, out var value)) { value = new byte[num2][]; _voiceParts[key] = value; } if (num < 0 || num >= value.Length) { return; } value[num] = array; int num3 = 0; for (int i = 0; i < value.Length; i++) { if (value[i] == null) { return; } num3 += value[i].Length; } byte[] array2 = new byte[num3]; int num4 = 0; for (int j = 0; j < value.Length; j++) { Buffer.BlockCopy(value[j], 0, array2, num4, value[j].Length); num4 += value[j].Length; } _voiceParts.Remove(key); Sounds.PlayMp3Bytes(array2, pitch); } public static Player OwnerOf(Character character) { if ((Object)(object)character == (Object)null) { return null; } try { if ((Object)(object)character.player != (Object)null && (Object)(object)((MonoBehaviourPun)character.player).photonView != (Object)null) { return ((MonoBehaviourPun)character.player).photonView.Owner; } } catch { } return null; } public static int ActorOf(Character character) { if ((Object)(object)character == (Object)null) { return 0; } try { Player val = OwnerOf(character); if (val != null) { return val.ActorNumber; } } catch { } return 0; } } public class PassOutWatcher : MonoBehaviour { private readonly HashSet _down = new HashSet(); private void Update() { if (!Plugin.CfgMemeSounds.Value || string.IsNullOrEmpty(Plugin.CfgPassOutSound.Value)) { return; } List allCharacters = Character.AllCharacters; if (allCharacters == null) { return; } for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null) { continue; } int instanceID = ((Object)val).GetInstanceID(); if (val.data.passedOut || val.data.fullyPassedOut) { if (_down.Add(instanceID) && (val.IsLocal || Plugin.CfgPassOutAnyone.Value)) { Sounds.Play(Plugin.CfgPassOutSound.Value, Plugin.CfgPassOutVolume.Value); Plugin.Log.LogInfo((object)(Targeting.NameOf(val) + " desmaiou.")); } } else { _down.Remove(instanceID); } } } } public static class PlayerTornado { public static void Become(float seconds) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { Plugin.Log.LogWarning((object)"Sem personagem local; nao da para virar tornado."); } else if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Routine(localCharacter, seconds)); } } private static IEnumerator Routine(Character character, float seconds) { GameObject tornado = null; try { tornado = PhotonNetwork.Instantiate("Tornado", character.Center, Quaternion.identity, (byte)0, (object[])null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui criar o tornado: " + ex.Message)); } if ((Object)(object)tornado == (Object)null) { yield break; } Tornado behaviour = tornado.GetComponent(); if ((Object)(object)behaviour != (Object)null) { behaviour.tornadoLifetimeMin = seconds + 5f; behaviour.tornadoLifetimeMax = seconds + 5f; } Hide.Apply(character, hide: true); Net.SendHide(Net.ActorOf(character), hide: true); MessageOverlay.Show(Lang.TornadoYouAre, 4f, Skin.Accent); Plugin.Log.LogInfo((object)("Virei um tornado por " + seconds + "s.")); float until = Time.unscaledTime + seconds; while (Time.unscaledTime < until && !((Object)(object)character == (Object)null) && !((Object)(object)tornado == (Object)null)) { tornado.transform.position = character.Center; yield return null; } if ((Object)(object)tornado != (Object)null) { try { PhotonNetwork.Destroy(tornado); } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Nao consegui remover o tornado: " + ex2.Message)); } } if ((Object)(object)character != (Object)null) { Hide.Apply(character, hide: false); Net.SendHide(Net.ActorOf(character), hide: false); } Plugin.Log.LogInfo((object)"Voltei ao normal."); } } [BepInPlugin("rodr313.chatchaos", "MrFallTwitchChatChallenge", "1.0.5")] public class Plugin : BaseUnityPlugin { public const string Guid = "rodr313.chatchaos"; public const string Name = "MrFallTwitchChatChallenge"; public const string Version = "1.0.5"; public static Plugin Instance; public static ManualLogSource Log; public static ConfigEntry CfgEnabled; public static ConfigEntry CfgEnglish; public static ConfigEntry CfgGuest; public static ConfigEntry CfgAskOnJoin; public static ConfigEntry CfgChannel; public static ConfigEntry CfgSecondsBetween; public static ConfigEntry CfgVoteSeconds; public static ConfigEntry CfgResultSeconds; public static ConfigEntry CfgPanelOnLeft; public static ConfigEntry CfgTornadoSeconds; public static ConfigEntry CfgZombieStrength; public static ConfigEntry CfgZombieSpeed; public static ConfigEntry CfgZombieAggression; public static ConfigEntry CfgZombieLifetime; public static ConfigEntry CfgZombieDefenseItem; public static ConfigEntry CfgZombieDefenseCount; public static ConfigEntry CfgSuspenseSound; public static ConfigEntry CfgSuspenseInterval; public static ConfigEntry CfgHoverSeconds; public static ConfigEntry CfgQuickKeys; public static ConfigEntry CfgPanelWidth; public static ConfigEntry CfgPanelTop; public static ConfigEntry CfgFontScale; public static ConfigEntry CfgRandomReceiver; public static ConfigEntry CfgMemeSounds; public static ConfigEntry CfgMemeVolume; public static ConfigEntry CfgSacrificeEndSeconds; public static ConfigEntry CfgPassOutSound; public static ConfigEntry CfgPassOutVolume; public static ConfigEntry CfgPassOutAnyone; public static ConfigEntry CfgVoiceVolume; public static ConfigEntry CfgVoicePitch; public static ConfigEntry CfgSpeakEvents; public static ConfigEntry CfgElevenApiKey; public static ConfigEntry CfgElevenVoiceId; public static ConfigEntry CfgElevenModel; public static ConfigEntry CfgElevenTimeout; public static ConfigEntry CfgElevenMinGap; private TwitchIrc _irc; private EventVoting _voting; public static bool IsGuest { get { if (CfgGuest != null) { return CfgGuest.Value; } return false; } } public static bool ChatConnected { get { if ((Object)(object)Instance != (Object)null && Instance._irc != null) { return Instance._irc.Connected; } return false; } } public static string CurrentChannel { get { if (!((Object)(object)Instance != (Object)null) || Instance._irc == null) { return ""; } return Instance._irc.Channel; } } private void Awake() { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Expected O, but got Unknown //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Expected O, but got Unknown //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Expected O, but got Unknown //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Expected O, but got Unknown //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Expected O, but got Unknown //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Expected O, but got Unknown //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Expected O, but got Unknown //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Expected O, but got Unknown //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Expected O, but got Unknown //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; CfgEnabled = ((BaseUnityPlugin)this).Config.Bind("1. Geral", "Enabled", true, "Liga o sistema de eventos votados pelo chat."); CfgEnglish = ((BaseUnityPlugin)this).Config.Bind("1. Geral", "English", false, "Idioma dos paineis: ligado = English, desligado = Portugues BR. Muda tudo, inclusive os nomes dos eventos."); Lang.English = CfgEnglish.Value; CfgGuest = ((BaseUnityPlugin)this).Config.Bind("1. Geral", "NotTheHost", false, "Ligue isto se voce NAO e o streamer, so esta jogando no lobby de outra pessoa. O mod passa a ser so espectador: nao abre votacao, nao le o chat e nao dispara nenhum evento. Voce continua vendo e vivendo tudo que o host causar."); CfgAskOnJoin = ((BaseUnityPlugin)this).Config.Bind("1. Geral", "AskOnJoin", true, "Pergunta 'voce e o host?' toda vez que entrar num lobby. Desligue se voce ja deixou a resposta certa marcada e nao quer mais ser perguntado."); CfgChannel = ((BaseUnityPlugin)this).Config.Bind("1. Geral", "Channel", "", "Nome do seu canal da Twitch (so o nome). A leitura do chat e anonima: nao precisa de token nem senha."); CfgSecondsBetween = ((BaseUnityPlugin)this).Config.Bind("2. Ritmo", "SecondsBetweenEvents", 30f, new ConfigDescription("Segundos entre o fim de uma votacao e o inicio da proxima. Padrao: 30 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 3600f), new object[0])); CfgVoteSeconds = ((BaseUnityPlugin)this).Config.Bind("2. Ritmo", "VoteSeconds", 40f, new ConfigDescription("Quanto tempo a votacao fica aberta (e o painel fica na tela). Padrao: 40 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 300f), new object[0])); CfgResultSeconds = ((BaseUnityPlugin)this).Config.Bind("2. Ritmo", "ResultSeconds", 16f, new ConfigDescription("Quanto tempo o resultado fica na tela depois da votacao. Padrao: 16 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 60f), new object[0])); CfgPanelOnLeft = ((BaseUnityPlugin)this).Config.Bind("3. Painel", "OnLeftSide", false, "Mostra o painel no canto esquerdo em vez do direito."); CfgPanelWidth = ((BaseUnityPlugin)this).Config.Bind("3. Painel", "Width", 480f, new ConfigDescription("Largura do painel de votacao, em pixels.", (AcceptableValueBase)(object)new AcceptableValueRange(300f, 900f), new object[0])); CfgPanelTop = ((BaseUnityPlugin)this).Config.Bind("3. Painel", "TopOffset", 80f, new ConfigDescription("Distancia do topo da tela, em pixels.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 900f), new object[0])); CfgTornadoSeconds = ((BaseUnityPlugin)this).Config.Bind("2. Ritmo", "TornadoSeconds", 20f, new ConfigDescription("Quantos segundos o tornado dura antes de sumir.", (AcceptableValueBase)(object)new AcceptableValueRange(3f, 120f), new object[0])); CfgZombieStrength = ((BaseUnityPlugin)this).Config.Bind("5. Zumbis", "Strength", 1f, new ConfigDescription("Forca do zumbi: empurrao da investida e tempo que a mordida atordoa. 1 = normal do jogo.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 4f), new object[0])); CfgZombieSpeed = ((BaseUnityPlugin)this).Config.Bind("5. Zumbis", "Speed", 1f, new ConfigDescription("Velocidade: de quao longe disparam e quao rapido partem para a corrida. 1 = normal do jogo.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 4f), new object[0])); CfgZombieAggression = ((BaseUnityPlugin)this).Config.Bind("5. Zumbis", "Aggression", 1f, new ConfigDescription("Agressividade: de quao longe acordam e comecam a perseguir. 1 = normal do jogo.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 4f), new object[0])); CfgZombieLifetime = ((BaseUnityPlugin)this).Config.Bind("5. Zumbis", "LifetimeSeconds", 180f, new ConfigDescription("Quantos segundos os zumbis do evento duram antes de sumir. Padrao: 3 minutos. 0 = ficam para sempre.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 900f), new object[0])); CfgZombieDefenseItem = ((BaseUnityPlugin)this).Config.Bind("5. Zumbis", "DefenseItem", "BoxingGlove", "Item que cai junto com os zumbis, para o grupo se defender. O mod BoxingGlove vem junto como dependencia. Se voce remover esse mod, escreva um item do jogo base aqui, como Dynamite. Deixe vazio para nao cair nada."); CfgZombieDefenseCount = ((BaseUnityPlugin)this).Config.Bind("5. Zumbis", "DefensePerPlayer", 1, new ConfigDescription("Quantos itens de defesa cada jogador vivo recebe. Cai na frente de cada um, um por pessoa.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), new object[0])); CfgSuspenseSound = ((BaseUnityPlugin)this).Config.Bind("7. Som", "SuspenseSound", "Au_BugleCursed", "Som que toca no 'Sacrifique ou Morra'. Alternativas: Au_Mandrake_Scream, Au_AirHorn. Deixe vazio para o evento rodar em silencio."); CfgSuspenseInterval = ((BaseUnityPlugin)this).Config.Bind("7. Som", "SuspenseInterval", 20f, new ConfigDescription("De quantos em quantos segundos o som do 'Sacrifique ou Morra' toca.", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 120f), new object[0])); CfgHoverSeconds = ((BaseUnityPlugin)this).Config.Bind("6. Itens", "HoverSeconds", 12f, new ConfigDescription("Quanto tempo os itens bons ficam pairando em volta do jogador antes de cair. 0 desliga o efeito.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), new object[0])); CfgQuickKeys = ((BaseUnityPlugin)this).Config.Bind("4. Atalhos", "QuickKeys", true, "Liga o atalho de teste: J spawna 1 zumbi. Desligue se atrapalhar o jogo."); CfgFontScale = ((BaseUnityPlugin)this).Config.Bind("3. Painel", "FontScale", 1f, new ConfigDescription("Tamanho da letra do menu F6 e dos paineis. 1 = normal, 1.5 = metade maior.", (AcceptableValueBase)(object)new AcceptableValueRange(0.7f, 2.5f), new object[0])); CfgRandomReceiver = ((BaseUnityPlugin)this).Config.Bind("6. Itens", "RandomReceiver", false, "Desligado (padrao): os itens caem para o host. Ligado: caem para um jogador vivo aleatorio. Se o host estiver morto, vai para um vivo aleatorio de qualquer jeito -- item no chao do defunto nao serve."); CfgMemeSounds = ((BaseUnityPlugin)this).Config.Bind("7. Som", "MemeSounds", true, "Liga os audios dos eventos (sacrificio, comida)."); CfgMemeVolume = ((BaseUnityPlugin)this).Config.Bind("7. Som", "MemeVolume", 0.6f, new ConfigDescription("Volume dos audios dos eventos.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), new object[0])); CfgSacrificeEndSeconds = ((BaseUnityPlugin)this).Config.Bind("7. Som", "SacrificeEndSeconds", 0f, new ConfigDescription("Quantos segundos do audio final do 'Sacrifique ou Morra' tocam. 0 = toca o audio inteiro.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), new object[0])); CfgPassOutSound = ((BaseUnityPlugin)this).Config.Bind("7. Som", "PassOutSound", "desmaiar", "Som que toca quando alguem desmaia. Escreva o nome de um audio embutido no mod (sem o .mp3). Deixe vazio para nao tocar nada."); CfgPassOutVolume = ((BaseUnityPlugin)this).Config.Bind("7. Som", "PassOutVolume", 1f, new ConfigDescription("Volume do som de desmaio, multiplicado pelo volume geral dos memes.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), new object[0])); CfgPassOutAnyone = ((BaseUnityPlugin)this).Config.Bind("7. Som", "PassOutAnyone", false, "Desligado: toca so quando VOCE desmaia. Ligado: toca quando qualquer jogador desmaiar, o que numa sala cheia vira barulho constante."); CfgVoiceVolume = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "VoiceVolume", 1f, new ConfigDescription("Volume da voz falada na cabeca de todos.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), new object[0])); CfgVoicePitch = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "VoicePitch", 0.71f, new ConfigDescription("Tom da voz. Acima de 1 fica agudo, no estilo do Bing Bong. 1 = voz original da ElevenLabs.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 2f), new object[0])); CfgSpeakEvents = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "SpeakEvents", true, "Le em voz alta o titulo do evento que ganhou a votacao. So o titulo: contagem regressiva e descricao nao sao lidas."); CfgElevenApiKey = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "ApiKey", "", "Sua chave da ElevenLabs. Fica so no SEU computador e nunca vai junto com o mod. NUNCA mande este arquivo para outra pessoa: quem tiver a chave gasta os seus creditos."); CfgElevenVoiceId = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "VoiceId", "", "Id da voz. Deixe vazio para escolher pelo menu F6."); CfgElevenModel = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "Model", "eleven_multilingual_v2", "Modelo da ElevenLabs. O multilingual le portugues."); CfgElevenTimeout = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "TimeoutSeconds", 20f, new ConfigDescription("Quanto esperar pela resposta da API.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 60f), new object[0])); CfgElevenMinGap = ((BaseUnityPlugin)this).Config.Bind("8. Voz", "MinSecondsBetweenCalls", 3f, new ConfigDescription("Intervalo minimo entre duas chamadas da API, para nao torrar creditos.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 60f), new object[0])); GameEvents.Build(((BaseUnityPlugin)this).Config); _voting = ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ScoutmasterPatch.Apply(); ItemSkins.EnsureFolder(); ((MonoBehaviour)this).StartCoroutine(ItemSkins.ApplyWhenReady()); Connect(); Log.LogInfo((object)("MrFallTwitchChatChallenge pronto. Uma votacao a cada " + CfgSecondsBetween.Value + " segundos.")); } public static void Reconnect() { Disconnect(); if ((Object)(object)Instance != (Object)null) { Instance.Connect(); } } public static void Disconnect() { if (!((Object)(object)Instance == (Object)null) && Instance._irc != null) { Instance._irc.Stop(); Instance._irc = null; } } private void Connect() { if (!CfgEnabled.Value) { return; } if (IsGuest) { Log.LogInfo((object)"Modo convidado ligado: nao vou ler o chat nem criar eventos."); return; } if (string.IsNullOrEmpty(CfgChannel.Value)) { Log.LogWarning((object)"Nenhum canal definido. Aperte F6 e escreva o nome do seu canal."); return; } _irc = new TwitchIrc(CfgChannel.Value, delegate(string m) { Log.LogInfo((object)m); }, delegate(string m) { Log.LogWarning((object)m); }); _irc.Start(); } private void Update() { if (_irc != null && !((Object)(object)_voting == (Object)null)) { ChatMessage message; while (_irc.TryDequeue(out message)) { _voting.RegisterVote(message.Author, message.Text); } } } private void OnDestroy() { if (_irc != null) { _irc.Stop(); } } } public class QuickKeys : MonoBehaviour { private ConfigMenu _menu; private void Start() { _menu = ((Component)this).GetComponent(); } private void Update() { if (Plugin.CfgQuickKeys.Value && (!((Object)(object)_menu != (Object)null) || !_menu.IsOpen) && Pressed()) { GameEvents.WakeZombies(1); } } private static bool Pressed() { try { Keyboard current = Keyboard.current; if (current != null) { return ((ButtonControl)current[(Key)24]).wasPressedThisFrame; } } catch { } try { return Input.GetKeyDown((KeyCode)106); } catch { } return false; } } public static class ScoutmasterPatch { public static bool Holding; public static int Attacks; private static Harmony _harmony; public static void Apply() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (_harmony != null) { return; } try { _harmony = new Harmony("rodr313.chatchaos.scoutmaster"); Patch("RPCA_Throw", null, "CountThrow"); Patch("Flee", "BlockRetreat", null); Patch("TeleportFarAway", "BlockRetreat", null); Patch("EvasiveBehaviour", "BlockRetreat", null); Plugin.Log.LogInfo((object)"Scoutmaster: patches aplicados."); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui preparar o Scoutmaster: " + ex.Message)); } } private static void Patch(string method, string prefix, string postfix) { //IL_0053: 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) try { MethodInfo methodInfo = AccessTools.Method(typeof(Scoutmaster), method, (Type[])null, (Type[])null); if (methodInfo == null) { Plugin.Log.LogInfo((object)("Scoutmaster." + method + " nao existe nesta versao do jogo; seguindo sem esse patch.")); } else { _harmony.Patch((MethodBase)methodInfo, (prefix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(AccessTools.Method(typeof(ScoutmasterPatch), prefix, (Type[])null, (Type[])null)), (postfix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(AccessTools.Method(typeof(ScoutmasterPatch), postfix, (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha no patch de " + method + ": " + ex.Message)); } } public static void Hold() { Apply(); Holding = true; Attacks = 0; Plugin.Log.LogInfo((object)"Scoutmaster preso ate o tempo acabar."); } public static void Release() { if (Holding) { Plugin.Log.LogInfo((object)("Scoutmaster liberado depois de " + Attacks + " ataque(s).")); } Holding = false; Attacks = 0; } private static void CountThrow() { if (Holding) { Attacks++; Plugin.Log.LogInfo((object)("Scoutmaster atacou (" + Attacks + ").")); } } private static bool BlockRetreat() { return !Holding; } } public static class Skin { public static readonly Color Ink = new Color(0.96f, 0.96f, 0.98f); public static readonly Color Muted = new Color(0.72f, 0.73f, 0.8f); public static readonly Color Good = new Color(0.42f, 0.92f, 0.55f); public static readonly Color Bad = new Color(1f, 0.45f, 0.45f); public static readonly Color Accent = new Color(0.62f, 0.45f, 1f); public static readonly Color Warn = new Color(1f, 0.8f, 0.35f); private static Texture2D _panel; private static Texture2D _header; private static Texture2D _rowGood; private static Texture2D _rowBad; private static Texture2D _row; private static Texture2D _rowAlt; private static Texture2D _barBack; private static Texture2D _barGood; private static Texture2D _barBad; private static Texture2D _white; private static GUIStyle _panelStyle; private static GUIStyle _headerStyle; private static GUIStyle _headerFlatStyle; private static GUIStyle _headerRightStyle; private static GUIStyle _titleStyle; private static GUIStyle _labelStyle; private static GUIStyle _smallStyle; private static GUIStyle _optionStyle; private static GUIStyle _countStyle; private static float _builtAtScale = -1f; public static GUIStyle Panel { get { Build(); return _panelStyle; } } public static GUIStyle Header { get { Build(); return _headerStyle; } } public static GUIStyle HeaderFlat { get { Build(); return _headerFlatStyle; } } public static GUIStyle HeaderRight { get { Build(); return _headerRightStyle; } } public static GUIStyle Title { get { Build(); return _titleStyle; } } public static GUIStyle Label { get { Build(); return _labelStyle; } } public static GUIStyle Small { get { Build(); return _smallStyle; } } public static GUIStyle Option { get { Build(); return _optionStyle; } } public static GUIStyle Count { get { Build(); return _countStyle; } } public static Texture2D RowGood { get { Build(); return _rowGood; } } public static Texture2D RowBad { get { Build(); return _rowBad; } } public static Texture2D BarBack { get { Build(); return _barBack; } } public static Texture2D BarGood { get { Build(); return _barGood; } } public static Texture2D BarBad { get { Build(); return _barBad; } } public static Texture2D White { get { Build(); return _white; } } public static float Scale { get { if (Plugin.CfgFontScale != null) { return Mathf.Clamp(Plugin.CfgFontScale.Value, 0.7f, 2.5f); } return 1f; } } public static void Invalidate() { _panelStyle = null; } private static int Sized(int size) { return Mathf.Max(8, Mathf.RoundToInt((float)size * Scale)); } private static void Build() { //IL_0037: 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_0073: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Expected O, but got Unknown //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Expected O, but got Unknown //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Expected O, but got Unknown //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown //IL_048f: Unknown result type (might be due to invalid IL or missing references) if (_panelStyle == null || !Mathf.Approximately(_builtAtScale, Scale)) { _builtAtScale = Scale; _panel = Gradient(new Color(0.09f, 0.09f, 0.13f, 0.97f), new Color(0.05f, 0.05f, 0.08f, 0.97f)); _header = Gradient(new Color(0.4f, 0.26f, 0.72f, 1f), new Color(0.24f, 0.15f, 0.48f, 1f)); _rowGood = Gradient(new Color(0.2f, 0.62f, 0.28f, 1f), new Color(0.09f, 0.34f, 0.16f, 1f)); _rowBad = Gradient(new Color(0.7f, 0.18f, 0.2f, 1f), new Color(0.38f, 0.07f, 0.1f, 1f)); _row = Solid(new Color(1f, 1f, 1f, 0.05f)); _rowAlt = Solid(new Color(1f, 1f, 1f, 0.1f)); _barBack = Solid(new Color(1f, 1f, 1f, 0.13f)); _barGood = Gradient(new Color(0.35f, 0.95f, 0.5f), new Color(0.15f, 0.7f, 0.35f)); _barBad = Gradient(new Color(1f, 0.5f, 0.45f), new Color(0.8f, 0.2f, 0.25f)); _white = Solid(Color.white); _panelStyle = new GUIStyle(GUI.skin.box); _panelStyle.normal.background = _panel; _panelStyle.border = new RectOffset(2, 2, 2, 2); _panelStyle.padding = new RectOffset(14, 14, 12, 12); _headerStyle = new GUIStyle(GUI.skin.box); _headerStyle.normal.background = _header; _headerStyle.normal.textColor = Color.white; _headerStyle.fontStyle = (FontStyle)1; _headerStyle.fontSize = Sized(20); _headerStyle.alignment = (TextAnchor)3; _headerStyle.padding = new RectOffset(12, 12, 8, 8); _headerFlatStyle = new GUIStyle(GUI.skin.label); _headerFlatStyle.fontSize = Sized(20); _headerFlatStyle.fontStyle = (FontStyle)1; _headerFlatStyle.alignment = (TextAnchor)3; _headerFlatStyle.clipping = (TextClipping)1; _headerRightStyle = new GUIStyle(GUI.skin.label); _headerRightStyle.fontSize = Sized(20); _headerRightStyle.fontStyle = (FontStyle)1; _headerRightStyle.alignment = (TextAnchor)5; _titleStyle = new GUIStyle(GUI.skin.label); _titleStyle.fontSize = Sized(17); _titleStyle.fontStyle = (FontStyle)1; _titleStyle.normal.textColor = Ink; _labelStyle = new GUIStyle(GUI.skin.label); _labelStyle.fontSize = Sized(14); _labelStyle.normal.textColor = Ink; _labelStyle.wordWrap = true; _smallStyle = new GUIStyle(GUI.skin.label); _smallStyle.fontSize = Sized(12); _smallStyle.normal.textColor = Muted; _smallStyle.wordWrap = true; _optionStyle = new GUIStyle(GUI.skin.label); _optionStyle.fontSize = Sized(19); _optionStyle.fontStyle = (FontStyle)1; _optionStyle.normal.textColor = Ink; _countStyle = new GUIStyle(GUI.skin.label); _countStyle.fontSize = Sized(17); _countStyle.fontStyle = (FontStyle)1; _countStyle.alignment = (TextAnchor)5; _countStyle.normal.textColor = Muted; } } private static Texture2D Solid(Color colour) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, colour); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; return val; } private static Texture2D Gradient(Color top, Color bottom) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 64); for (int i = 0; i < 64; i++) { val.SetPixel(0, i, Color.Lerp(bottom, top, (float)i / 63f)); } ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); ((Object)val).hideFlags = (HideFlags)61; return val; } public static void OutlinedLabel(Rect rect, string text, GUIStyle style, Color colour, float thickness) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0070: 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) Color color = GUI.color; GUI.color = Color.black; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (i != 0 || j != 0) { GUI.Label(new Rect(((Rect)(ref rect)).x + (float)i * thickness, ((Rect)(ref rect)).y + (float)j * thickness, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); } } } GUI.color = colour; GUI.Label(rect, text, style); GUI.color = color; } public static void Fill(Rect rect, Texture2D texture) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)texture == (Object)null)) { GUI.DrawTexture(rect, (Texture)(object)texture); } } public static Texture2D RowBackground(bool alternate) { Build(); if (!alternate) { return _row; } return _rowAlt; } } public static class Sounds { public const string Sacrifice = "dexter"; public const string SacrificeEnd = "gyro"; public const string Food = "mickey"; public const string Wind = "ventania"; public const string PassOut = "desmaiar"; public const string Humiliate = "aura"; private static readonly Dictionary _cache = new Dictionary(); private static string _stagingDirectory; private static readonly List _playing = new List(); private static string Staging { get { if (_stagingDirectory != null) { return _stagingDirectory; } _stagingDirectory = Path.Combine(Path.GetTempPath(), "ChatChaosAudio"); try { Directory.CreateDirectory(_stagingDirectory); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui criar a pasta de audio: " + ex.Message)); } return _stagingDirectory; } } public static void Play(string name) { Play(name, 1f); } private static float MaxLengthOf(string name) { if (name == "gyro" && Plugin.CfgSacrificeEndSeconds != null) { return Plugin.CfgSacrificeEndSeconds.Value; } return 0f; } public static void Play(string name, float volumeScale) { if (!((Object)(object)Plugin.Instance == (Object)null) && !string.IsNullOrEmpty(name) && Plugin.CfgMemeSounds.Value && !Lang.English) { if (_cache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { PlayClip(value, Plugin.CfgMemeVolume.Value * volumeScale, 1f, MaxLengthOf(name)); } else { ((MonoBehaviour)Plugin.Instance).StartCoroutine(LoadEmbedded(name, volumeScale)); } } } private static IEnumerator LoadEmbedded(string name, float volumeScale) { string file = Path.Combine(Staging, name + ".mp3"); if (!File.Exists(file)) { byte[] array = ReadResource(name + ".mp3"); if (array == null) { Plugin.Log.LogWarning((object)("Som '" + name + "' nao esta embutido no mod.")); yield break; } bool flag = false; try { File.WriteAllBytes(file, array); flag = true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui salvar '" + name + "': " + ex.Message)); } if (!flag) { yield break; } } AudioClip clip = null; yield return LoadFromFile(file, delegate(AudioClip result) { clip = result; }); if (!((Object)(object)clip == (Object)null)) { _cache[name] = clip; PlayClip(clip, Plugin.CfgMemeVolume.Value * volumeScale, 1f, MaxLengthOf(name)); } } public static void PlayMp3Bytes(byte[] mp3, float pitch) { if (!((Object)(object)Plugin.Instance == (Object)null) && mp3 != null && mp3.Length != 0) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(PlayBytesRoutine(mp3, pitch)); } } private static IEnumerator PlayBytesRoutine(byte[] mp3, float pitch) { string file = Path.Combine(Staging, "voice_" + DateTime.UtcNow.Ticks + ".mp3"); bool written = false; try { File.WriteAllBytes(file, mp3); written = true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui salvar a voz: " + ex.Message)); } if (written) { AudioClip clip = null; yield return LoadFromFile(file, delegate(AudioClip result) { clip = result; }); if ((Object)(object)clip != (Object)null) { PlayClip(clip, Plugin.CfgVoiceVolume.Value, pitch, 0f); } try { File.Delete(file); } catch { } } } private static IEnumerator LoadFromFile(string file, Action done) { string url = "file://" + file.Replace("\\", "/"); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)13); try { DownloadHandler downloadHandler = request.downloadHandler; DownloadHandlerAudioClip handler = (DownloadHandlerAudioClip)(object)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null); if (handler != null) { handler.streamAudio = false; } yield return request.SendWebRequest(); if ((int)request.result != 1) { Plugin.Log.LogWarning((object)("Nao consegui carregar o audio: " + request.error)); done(null); yield break; } AudioClip clip = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)clip != (Object)null && (int)clip.loadState != 2) { clip.LoadAudioData(); float waited = 0f; while ((int)clip.loadState == 1 && waited < 5f) { waited += Time.unscaledDeltaTime; yield return null; } } if ((Object)(object)clip != (Object)null) { ((Object)clip).hideFlags = (HideFlags)61; } done(clip); } finally { ((IDisposable)request)?.Dispose(); } } private static void PlayClip(AudioClip clip, float volume, float pitch) { PlayClip(clip, volume, pitch, 0f); } private static void PlayClip(AudioClip clip, float volume, float pitch, float maxSeconds) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null) && !((Object)(object)Plugin.Instance == (Object)null)) { GameObject val = new GameObject("ChatChaos_Sound"); Object.DontDestroyOnLoad((Object)(object)val); AudioSource val2 = val.AddComponent(); val2.clip = clip; val2.volume = Mathf.Clamp01(volume); val2.pitch = Mathf.Clamp(pitch, 0.3f, 3f); val2.spatialBlend = 0f; val2.Play(); _playing.Add(val2); ((MonoBehaviour)Plugin.Instance).StartCoroutine(DestroyWhenDone(val, val2, maxSeconds)); } } private static IEnumerator DestroyWhenDone(GameObject holder, AudioSource source, float maxSeconds) { yield return null; float stopAt = ((maxSeconds > 0f) ? (Time.unscaledTime + maxSeconds) : (-1f)); while ((Object)(object)source != (Object)null && source.isPlaying) { if (stopAt > 0f && Time.unscaledTime >= stopAt) { source.Stop(); break; } yield return null; } _playing.Remove(source); if ((Object)(object)holder != (Object)null) { Object.Destroy((Object)(object)holder); } } public static int StopAll() { int num = 0; for (int i = 0; i < _playing.Count; i++) { AudioSource val = _playing[i]; if ((Object)(object)val == (Object)null) { continue; } try { val.Stop(); if ((Object)(object)((Component)val).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } num++; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui parar um som: " + ex.Message)); } } _playing.Clear(); return num; } private static byte[] ReadResource(string fileName) { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); for (int i = 0; i < manifestResourceNames.Length; i++) { if (!manifestResourceNames[i].EndsWith(fileName, StringComparison.OrdinalIgnoreCase)) { continue; } using Stream stream = executingAssembly.GetManifestResourceStream(manifestResourceNames[i]); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); return array; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui ler o audio embutido: " + ex.Message)); } return null; } } public static class Targeting { public static bool HostIsDead { get { if (PhotonNetwork.InRoom) { return (Object)(object)LivingHost() == (Object)null; } return false; } } public static List Living() { List list = new List(); List allCharacters = Character.AllCharacters; if (allCharacters == null) { return list; } for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.data == (Object)null) && !val.data.dead) { list.Add(val); } } return list; } public static Character LivingHost() { List allCharacters = Character.AllCharacters; if (allCharacters == null) { return null; } for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.data.dead) { continue; } try { Player val2 = Net.OwnerOf(val); if (val2 != null && val2.IsMasterClient) { return val; } } catch { } } return null; } public static Character ForItems() { List list = Living(); if (list.Count == 0) { return null; } if (!Plugin.CfgRandomReceiver.Value) { Character val = LivingHost(); if ((Object)(object)val != (Object)null) { return val; } Plugin.Log.LogInfo((object)"Host morto: os itens vao para um vivo aleatorio."); } return list[Random.Range(0, list.Count)]; } public static Character ForNotice() { Character val = LivingHost(); if ((Object)(object)val != (Object)null) { return val; } List list = Living(); if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } public static string NameOf(Character character) { if ((Object)(object)character == (Object)null) { return "?"; } try { string characterName = character.characterName; if (!string.IsNullOrEmpty(characterName)) { return characterName; } } catch { } try { Player val = Net.OwnerOf(character); if (val != null) { return val.NickName; } } catch { } return "Escoteiro"; } } public static class TornadoForm { private const string PluginTypeName = "ImTornado.WindPlugin"; private const float WaitForValidState = 5f; private static Object _plugin; private static MethodInfo _canTransform; public static bool Available => FindPlugin() != (Object)null; private static Object FindPlugin() { if (_plugin != (Object)null) { return _plugin; } try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { PluginInfo value = pluginInfo.Value; if (value != null && !((Object)(object)value.Instance == (Object)null) && ((object)value.Instance).GetType().FullName == "ImTornado.WindPlugin") { _plugin = (Object)(object)value.Instance; Plugin.Log.LogInfo((object)("Achei o mod do tornado (" + pluginInfo.Key + ").")); return _plugin; } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui consultar os plugins do BepInEx: " + ex.Message)); } try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = null; try { type = assemblies[i].GetType("ImTornado.WindPlugin", throwOnError: false); } catch { } if (!(type == null)) { _plugin = Object.FindObjectOfType(type); if (_plugin != (Object)null) { return _plugin; } } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Nao consegui achar o mod do tornado: " + ex2.Message)); } return _plugin; } public static void BecomeTornado(float seconds) { Object val = FindPlugin(); if (val == (Object)null) { Plugin.Log.LogInfo((object)"I_am_a_Tornado nao esta aqui; usando a transformacao propria do mod."); PlayerTornado.Become(seconds); } else if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Routine(val, seconds)); } } private static IEnumerator Routine(Object plugin, float seconds) { float waitUntil = Time.unscaledTime + 5f; bool warned = false; while (!CanTransformNow(plugin)) { if (Time.unscaledTime >= waitUntil) { LetGoOfTheWall(); if (CanTransformNow(plugin)) { break; } Plugin.Log.LogWarning((object)"Nao consegui tirar o jogador da parede; a transformacao foi cancelada."); MessageOverlay.Show(Lang.TornadoMissedIt, 5f, Skin.Warn); yield break; } if (!warned) { warned = true; MessageOverlay.Show(Lang.TornadoLetGo, 5f, Skin.Warn); } yield return null; } if (!Invoke(plugin, "ToggleTornadoForm")) { Plugin.Log.LogWarning((object)"Nao consegui ligar a forma de tornado."); yield break; } Plugin.Log.LogInfo((object)("Virei um tornado por " + seconds + "s.")); MessageOverlay.Show(Lang.TornadoYouAre, 4f, Skin.Accent); float until = Time.unscaledTime + Mathf.Max(3f, seconds); while (Time.unscaledTime < until) { yield return null; } if (!Invoke(plugin, "ForceExit")) { Invoke(plugin, "ExitTornado"); } Plugin.Log.LogInfo((object)"Voltei ao normal."); } private static void LetGoOfTheWall() { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null) { return; } try { localCharacter.data.isClimbing = false; localCharacter.data.isRopeClimbing = false; localCharacter.data.isVineClimbing = false; localCharacter.data.fallSeconds = 0f; Plugin.Log.LogInfo((object)"Soltei o jogador da parede para virar tornado."); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui soltar da parede: " + ex.Message)); } } private static bool CanTransformNow(Object plugin) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return false; } try { if (_canTransform == null) { _canTransform = ((object)plugin).GetType().GetMethod("CanTransform", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Character) }, null); } if (_canTransform == null) { return true; } object obj = (_canTransform.IsStatic ? null : plugin); return (bool)_canTransform.Invoke(obj, new object[1] { localCharacter }); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui perguntar ao mod do tornado: " + ex.Message)); return true; } } private static bool Invoke(Object plugin, string methodName) { try { MethodInfo method = ((object)plugin).GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method == null) { return false; } method.Invoke(plugin, null); return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha ao chamar " + methodName + ": " + ex.Message)); return false; } } } public static class Tts { public class VoiceInfo { public string Id; public string Name; public string Description; public bool FreePlanFriendly; public override string ToString() { string text = Name; if (!string.IsNullOrEmpty(Description)) { text = text + " - " + Description; } if (!FreePlanFriendly) { text += (Lang.English ? " [paid plan]" : " [plano pago]"); } return text; } } private const string BaseUrl = "https://api.elevenlabs.io/v1"; private static string _resolvedVoiceId; private static bool _voiceLookupDone; private static float _lastRequestTime = -999f; public static VoiceInfo[] Voices = new VoiceInfo[0]; public static bool Configured { get { if (Plugin.CfgElevenApiKey != null) { return !string.IsNullOrEmpty(Plugin.CfgElevenApiKey.Value.Trim()); } return false; } } public static void Reset() { _resolvedVoiceId = null; _voiceLookupDone = false; } public static void SpeakEventTitle(string title) { if (Plugin.CfgSpeakEvents.Value && !string.IsNullOrEmpty(title)) { Speak(title, Plugin.CfgVoicePitch.Value); } } public static void Speak(string text, float pitch) { if (!((Object)(object)Plugin.Instance == (Object)null)) { if (!Configured) { Plugin.Log.LogInfo((object)"Sem chave da ElevenLabs: nada sera falado. Aperte F6 na aba Voz para colocar a sua."); } else { ((MonoBehaviour)Plugin.Instance).StartCoroutine(SpeakRoutine(text, pitch)); } } } private static IEnumerator SpeakRoutine(string text, float pitch) { byte[] mp3 = null; yield return Synthesize(text, delegate(byte[] result) { mp3 = result; }); if (mp3 != null && mp3.Length != 0) { Sounds.PlayMp3Bytes(mp3, pitch); Net.SendVoice(mp3, pitch); } } public static IEnumerator Synthesize(string text, Action onReady) { if (!Configured) { onReady(null); yield break; } float since = Time.realtimeSinceStartup - _lastRequestTime; float minGap = Plugin.CfgElevenMinGap.Value; if (since < minGap) { Plugin.Log.LogInfo((object)("ElevenLabs: ignorando (faltam " + (minGap - since).ToString("0.0") + "s para a proxima chamada permitida).")); onReady(null); yield break; } _lastRequestTime = Time.realtimeSinceStartup; if (!_voiceLookupDone) { yield return ResolveVoiceId(); _voiceLookupDone = true; } string voiceId = _resolvedVoiceId; if (string.IsNullOrEmpty(voiceId)) { Plugin.Log.LogWarning((object)"ElevenLabs: nenhuma voz disponivel. Escolha uma no F6."); onReady(null); yield break; } JObject body = new JObject(); body["text"] = JToken.op_Implicit(text); body["model_id"] = JToken.op_Implicit(Plugin.CfgElevenModel.Value); string url = "https://api.elevenlabs.io/v1/text-to-speech/" + voiceId + "?output_format=mp3_44100_128"; byte[] payload = Encoding.UTF8.GetBytes(((JToken)body).ToString((Formatting)0, (JsonConverter[])(object)new JsonConverter[0])); UnityWebRequest request = new UnityWebRequest(url, "POST"); try { request.uploadHandler = (UploadHandler)new UploadHandlerRaw(payload); request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); request.SetRequestHeader("xi-api-key", Plugin.CfgElevenApiKey.Value.Trim()); request.timeout = Mathf.CeilToInt(Plugin.CfgElevenTimeout.Value); yield return request.SendWebRequest(); if ((int)request.result != 1) { string text2 = Describe(request); if (request.responseCode == 402 && text2.IndexOf("library voices", StringComparison.OrdinalIgnoreCase) >= 0) { Plugin.Log.LogWarning((object)"ElevenLabs: essa voz e da biblioteca e o plano gratuito nao deixa usa-la pela API. Escolha uma voz SEM a marca [plano pago]."); } else if (request.responseCode == 401) { Plugin.Log.LogWarning((object)"ElevenLabs: chave invalida. Confira no F6."); } else if (request.responseCode == 429) { Plugin.Log.LogWarning((object)"ElevenLabs: muitas chamadas seguidas ou creditos esgotados."); } else { Plugin.Log.LogWarning((object)("ElevenLabs falhou (" + request.responseCode + "): " + request.error + " " + text2)); } onReady(null); } else { onReady(request.downloadHandler.data); } } finally { ((IDisposable)request)?.Dispose(); } } private static IEnumerator ResolveVoiceId() { string configured = Plugin.CfgElevenVoiceId.Value.Trim(); if (!string.IsNullOrEmpty(configured)) { _resolvedVoiceId = configured; yield break; } yield return FetchVoices(null); VoiceInfo pick = PickDefaultVoice(); if (pick != null) { _resolvedVoiceId = pick.Id; Plugin.Log.LogInfo((object)("ElevenLabs: usando a voz '" + pick.Name + "'.")); } } public static VoiceInfo PickDefaultVoice() { VoiceInfo voiceInfo = null; for (int i = 0; i < Voices.Length; i++) { VoiceInfo voiceInfo2 = Voices[i]; if (voiceInfo2.FreePlanFriendly) { if (voiceInfo == null) { voiceInfo = voiceInfo2; } string text = (voiceInfo2.Name + " " + voiceInfo2.Description).ToLowerInvariant(); if (text.Contains("portug") || text.Contains("brazil") || text.Contains("brasil")) { return voiceInfo2; } } } if (voiceInfo != null) { return voiceInfo; } if (Voices.Length <= 0) { return null; } return Voices[0]; } public static IEnumerator FetchVoices(Action onDone) { if (!Configured) { onDone?.Invoke(Lang.English ? "Type the key first." : "Escreva a chave primeiro."); yield break; } UnityWebRequest request = UnityWebRequest.Get("https://api.elevenlabs.io/v1/voices"); try { request.SetRequestHeader("xi-api-key", Plugin.CfgElevenApiKey.Value.Trim()); request.timeout = 20; yield return request.SendWebRequest(); if ((int)request.result != 1) { string text = "Nao consegui buscar as vozes (" + request.responseCode + ")"; if (request.responseCode == 401) { text = "Chave invalida."; } Plugin.Log.LogWarning((object)("ElevenLabs: " + text + " " + request.error)); onDone?.Invoke(text); yield break; } List found = new List(); string failure = null; try { JObject val = JObject.Parse(request.downloadHandler.text); JToken obj = val["voices"]; JArray val2 = (JArray)(object)((obj is JArray) ? obj : null); if (val2 != null) { for (int i = 0; i < ((JContainer)val2).Count; i++) { VoiceInfo voiceInfo = new VoiceInfo(); voiceInfo.Id = (string)val2[i][(object)"voice_id"]; voiceInfo.Name = (string)val2[i][(object)"name"]; JToken val3 = val2[i][(object)"labels"]; if (val3 != null) { string text2 = (string)val3[(object)"accent"]; string text3 = (string)val3[(object)"gender"]; string text4 = (string)val3[(object)"language"]; voiceInfo.Description = string.Join(" ", text3, text2, text4).Trim(); } string text5 = (string)val2[i][(object)"category"]; voiceInfo.FreePlanFriendly = text5 == "premade"; if (!string.IsNullOrEmpty(voiceInfo.Id)) { found.Add(voiceInfo); } } } } catch (Exception ex) { failure = "Resposta ilegivel: " + ex.Message; Plugin.Log.LogWarning((object)("ElevenLabs: " + failure)); } if (failure != null) { onDone?.Invoke(failure); yield break; } Voices = found.ToArray(); Plugin.Log.LogInfo((object)("ElevenLabs: " + Voices.Length + " vozes na conta.")); onDone?.Invoke((Voices.Length == 0) ? "A conta nao tem nenhuma voz." : null); } finally { ((IDisposable)request)?.Dispose(); } } private static string Describe(UnityWebRequest request) { if (request.downloadHandler == null) { return ""; } string text = request.downloadHandler.text; if (string.IsNullOrEmpty(text)) { return ""; } if (text.Length > 300) { text = text.Substring(0, 300); } return text; } } public class ChatMessage { public string Author; public string Text; public bool IsBroadcaster; public bool IsModerator; public bool IsSubscriber; public bool IsVip; } public class TwitchIrc { private const string Host = "irc.chat.twitch.tv"; private const int Port = 6667; private readonly string _channel; private readonly ConcurrentQueue _queue = new ConcurrentQueue(); private readonly Action _log; private readonly Action _logError; private Thread _thread; private volatile bool _running; private TcpClient _client; public volatile bool Connected; public static bool Verbose; public string Channel => _channel; public TwitchIrc(string channel, Action log, Action logError) { _channel = ((channel == null) ? "" : channel).Trim().TrimStart('#').ToLowerInvariant(); _log = log; _logError = logError; } public bool TryDequeue(out ChatMessage message) { return _queue.TryDequeue(out message); } public void Start() { if (!_running) { if (string.IsNullOrEmpty(_channel)) { _logError("Nenhum canal configurado. Preencha Channel no arquivo de config."); return; } _running = true; _thread = new Thread(Loop); _thread.IsBackground = true; _thread.Name = "BingBongTwitchIRC"; _thread.Start(); } } public void Stop() { _running = false; Connected = false; try { if (_client != null) { _client.Close(); } } catch { } _client = null; } private void Loop() { int num = 2; while (_running) { try { RunSession(); num = 2; } catch (Exception ex) { if (_running) { _logError("Conexao com a Twitch caiu: " + ex.Message); } } Connected = false; if (!_running) { break; } for (int i = 0; i < num * 10; i++) { if (!_running) { break; } Thread.Sleep(100); } num = Math.Min(num * 2, 60); } } private void RunSession() { using TcpClient tcpClient = new TcpClient(); _client = tcpClient; tcpClient.Connect("irc.chat.twitch.tv", 6667); using NetworkStream stream = tcpClient.GetStream(); using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); using StreamWriter streamWriter = new StreamWriter(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); streamWriter.NewLine = "\r\n"; streamWriter.AutoFlush = true; streamWriter.WriteLine("PASS SCHMOOPIIE"); streamWriter.WriteLine("NICK justinfan" + new Random().Next(10000, 99999)); streamWriter.WriteLine("CAP REQ :twitch.tv/tags"); streamWriter.WriteLine("JOIN #" + _channel); _log("Conectando ao chat de #" + _channel + " (anonimo, sem token)..."); string text; while (_running && (text = streamReader.ReadLine()) != null) { if (text.StartsWith("PING", StringComparison.Ordinal)) { streamWriter.WriteLine("PONG :tmi.twitch.tv"); continue; } if (!Connected && text.IndexOf(" 001 ", StringComparison.Ordinal) >= 0) { Connected = true; _log("Conectado ao chat de #" + _channel + "."); } ChatMessage chatMessage = Parse(text); if (chatMessage != null) { _queue.Enqueue(chatMessage); if (Verbose) { _log("IRC recebeu de " + chatMessage.Author + ": " + chatMessage.Text); } } else if (Verbose && text.IndexOf("PRIVMSG", StringComparison.Ordinal) >= 0) { _log("IRC nao entendeu esta linha: " + text); } } } private static ChatMessage Parse(string line) { string text = null; string text2 = line; if (text2.Length > 0 && text2[0] == '@') { int num = text2.IndexOf(' '); if (num < 0) { return null; } text = text2.Substring(1, num - 1); text2 = text2.Substring(num + 1); } string author = null; if (text2.Length > 0 && text2[0] == ':') { int num2 = text2.IndexOf(' '); if (num2 < 0) { return null; } string text3 = text2.Substring(1, num2 - 1); int num3 = text3.IndexOf('!'); author = ((num3 > 0) ? text3.Substring(0, num3) : text3); text2 = text2.Substring(num2 + 1); } if (!text2.StartsWith("PRIVMSG ", StringComparison.Ordinal)) { return null; } int num4 = text2.IndexOf(" :", StringComparison.Ordinal); if (num4 < 0) { return null; } string text4 = text2.Substring(num4 + 2); ChatMessage chatMessage = new ChatMessage(); chatMessage.Author = author; chatMessage.Text = text4; if (text != null) { string tag = GetTag(text, "display-name"); if (!string.IsNullOrEmpty(tag)) { chatMessage.Author = tag; } string text5 = GetTag(text, "badges"); if (text5 == null) { text5 = ""; } chatMessage.IsBroadcaster = text5.IndexOf("broadcaster/", StringComparison.Ordinal) >= 0; chatMessage.IsVip = text5.IndexOf("vip/", StringComparison.Ordinal) >= 0; chatMessage.IsModerator = GetTag(text, "mod") == "1" || chatMessage.IsBroadcaster; chatMessage.IsSubscriber = GetTag(text, "subscriber") == "1"; } if (string.IsNullOrEmpty(chatMessage.Author)) { chatMessage.Author = "chat"; } return chatMessage; } private static string GetTag(string tags, string key) { string[] array = tags.Split(';'); for (int i = 0; i < array.Length; i++) { int num = array[i].IndexOf('='); if (num > 0 && string.Equals(array[i].Substring(0, num), key, StringComparison.Ordinal)) { return array[i].Substring(num + 1); } } return null; } } public static class VoiceChaos { public const float Deep = 0.62f; public const float Squeaky = 1.7f; private static readonly List _applied = new List(); public static void Start(float seconds) { List list = Targeting.Living(); if (list.Count == 0) { Plugin.Log.LogWarning((object)"Ninguem vivo para bagunçar a voz."); return; } for (int num = list.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); Character value = list[num]; list[num] = list[index]; list[index] = value; } List list2 = new List(); List list3 = new List(); for (int i = 0; i < list.Count; i++) { int num2 = Net.ActorOf(list[i]); if (num2 > 0) { list2.Add(num2); list3.Add((i < list.Count / 2) ? 0.62f : 1.7f); } } if (list2.Count != 0) { Net.SendVoicePitch(list2.ToArray(), list3.ToArray(), seconds); Apply(list2.ToArray(), list3.ToArray(), seconds); } } public static void Apply(int[] actors, float[] pitches, float seconds) { Clear(); for (int i = 0; i < actors.Length && i < pitches.Length; i++) { Character val = Hide.ByActor(actors[i]); if ((Object)(object)val == (Object)null) { continue; } try { CharacterVoiceHandler componentInChildren = ((Component)val).GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null) { continue; } GameObject gameObject = ((Component)componentInChildren).gameObject; if ((Object)(object)gameObject.GetComponent() == (Object)null) { Plugin.Log.LogInfo((object)("Voz de " + Targeting.NameOf(val) + " nao tem AudioSource aqui; pulei.")); continue; } VoicePitchShifter voicePitchShifter = gameObject.GetComponent(); if ((Object)(object)voicePitchShifter == (Object)null) { voicePitchShifter = gameObject.AddComponent(); } voicePitchShifter.Pitch = pitches[i]; _applied.Add(voicePitchShifter); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Nao consegui mexer numa voz: " + ex.Message)); } } Plugin.Log.LogInfo((object)("Voz maluca em " + _applied.Count + " jogador(es) por " + seconds + "s.")); if ((Object)(object)Plugin.Instance != (Object)null) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(ClearAfter(seconds)); } } private static IEnumerator ClearAfter(float seconds) { float until = Time.unscaledTime + seconds; while (Time.unscaledTime < until) { yield return null; } Clear(); Plugin.Log.LogInfo((object)"As vozes voltaram ao normal."); } public static void Clear() { for (int i = 0; i < _applied.Count; i++) { if (!((Object)(object)_applied[i] == (Object)null)) { _applied[i].Pitch = 1f; try { Object.Destroy((Object)(object)_applied[i]); } catch { } } } _applied.Clear(); } } public class VoicePanel : MonoBehaviour { private bool _open; private Rect _window = new Rect(140f, 120f, 560f, 430f); private string _draft = ""; private int _tab; private Vector2 _scroll; private bool _cursorWasLocked; private bool _cursorWasVisible; private bool _invisible; private bool _flying; private bool _invincible; public bool IsOpen => _open; private void Update() { if (KeyDown((Key)102)) { Toggle(); } if (_open) { ForceCursor(); } if (_flying) { Fly(); } if (_invincible) { KeepAlive(); } } private void ForceCursor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } private void LateUpdate() { if (_open) { ForceCursor(); } } private void Toggle() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 _open = !_open; if (_open) { _cursorWasLocked = (int)Cursor.lockState == 1; _cursorWasVisible = Cursor.visible; ForceCursor(); } else { Cursor.lockState = (CursorLockMode)(_cursorWasLocked ? 1 : 0); Cursor.visible = _cursorWasVisible; } } private void OnGUI() { //IL_0037: 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_0058: Expected O, but got Unknown //IL_0053: 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) if (_open) { ForceCursor(); ((Rect)(ref _window)).width = Mathf.Max(560f, 560f * Skin.Scale); _window = GUILayout.Window(((Object)this).GetInstanceID(), _window, new WindowFunction(DrawWindow), "ChatChaos - F9", (GUILayoutOption[])(object)new GUILayoutOption[0]); } } private void DrawWindow(int id) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[2] { Lang.TabVoice, Lang.TabAdmin }; _tab = GUILayout.Toolbar(_tab, array, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f * Skin.Scale) }); GUILayout.Space(8f); if (_tab == 0) { DrawVoice(); } else { DrawAdmin(); } GUILayout.Space(8f); if (GUILayout.Button(Lang.Close, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * Skin.Scale) })) { Toggle(); } GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f)); } private void DrawVoice() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Lang.VoiceOverTitle, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(Lang.VoiceOverHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(6f); _draft = GUILayout.TextArea(_draft, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(90f * Skin.Scale) }); GUILayout.Space(6f); bool enabled = Tts.Configured && _draft.Trim().Length > 0; GUI.enabled = enabled; Color color = GUI.color; GUI.color = Skin.Good; if (GUILayout.Button(Lang.Speak, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f * Skin.Scale) })) { Tts.Speak(_draft.Trim(), Plugin.CfgVoicePitch.Value); _draft = ""; } GUI.color = color; GUI.enabled = true; if (!Tts.Configured) { GUI.color = Skin.Warn; GUILayout.Label(Lang.NeedKey, Skin.Label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; } GUILayout.Space(8f); Plugin.CfgVoicePitch.Value = Slider(Lang.VoicePitch, Plugin.CfgVoicePitch.Value, 0.5f, 2f); Plugin.CfgVoiceVolume.Value = Slider(Lang.VoiceVolume, Plugin.CfgVoiceVolume.Value, 0f, 1f); } private void DrawAdmin() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = Skin.Bad; GUILayout.Label(Lang.AdminWarning, Skin.Title, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.color = color; GUILayout.Label(Lang.AdminHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); _scroll = GUILayout.BeginScrollView(_scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(200f * Skin.Scale) }); bool flag = GUILayout.Toggle(_invisible, Lang.Invisible, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (flag != _invisible) { SetInvisible(flag); } GUILayout.Space(6f); bool flag2 = GUILayout.Toggle(_flying, Lang.Fly, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (flag2 != _flying) { SetFlying(flag2); } GUILayout.Space(6f); GUILayout.Label(Lang.FlyHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(10f); bool flag3 = GUILayout.Toggle(_invincible, Lang.Invincible, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (flag3 != _invincible) { SetInvincible(flag3); } GUILayout.Label(Lang.InvincibleHint, Skin.Small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndScrollView(); } private void SetInvisible(bool invisible) { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null)) { _invisible = invisible; Hide.Apply(localCharacter, invisible); Net.SendHide(Net.ActorOf(localCharacter), invisible); Plugin.Log.LogInfo((object)(invisible ? "Invisivel ligado." : "Invisivel desligado.")); } } private void KeepAlive() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || localCharacter.refs == null || (Object)(object)localCharacter.refs.afflictions == (Object)null) { return; } try { foreach (object value in Enum.GetValues(typeof(STATUSTYPE))) { localCharacter.refs.afflictions.SubtractStatus((STATUSTYPE)value, 1f, false, false); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha na invencibilidade: " + ex.Message)); _invincible = false; } } private void SetInvincible(bool invincible) { _invincible = invincible; Plugin.Log.LogInfo((object)(invincible ? "Invencivel ligado." : "Invencivel desligado.")); } private void SetFlying(bool flying) { _flying = flying; Plugin.Log.LogInfo((object)(flying ? "Voo ligado." : "Voo desligado.")); } private void Fly() { //IL_0010: 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) //IL_0043: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0091: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } try { Vector3 val = Vector3.zero; Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Keyboard current = Keyboard.current; if (current != null) { if (((ButtonControl)current[(Key)37]).isPressed) { val += ((Component)main).transform.forward; } if (((ButtonControl)current[(Key)33]).isPressed) { val -= ((Component)main).transform.forward; } if (((ButtonControl)current[(Key)15]).isPressed) { val -= ((Component)main).transform.right; } if (((ButtonControl)current[(Key)18]).isPressed) { val += ((Component)main).transform.right; } if (((ButtonControl)current[(Key)1]).isPressed) { val += Vector3.up; } if (((ButtonControl)current[(Key)55]).isPressed) { val -= Vector3.up; } } } Rigidbody[] componentsInChildren = ((Component)localCharacter).GetComponentsInChildren(true); foreach (Rigidbody val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { val2.useGravity = false; val2.velocity = ((Vector3)(ref val)).normalized * 14f; } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Falha no voo: " + ex.Message)); _flying = false; } } private void OnDisable() { if (_flying) { RestoreGravity(); } if (_invisible) { SetInvisible(invisible: false); } } private void RestoreGravity() { _flying = false; Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } try { Rigidbody[] componentsInChildren = ((Component)localCharacter).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i] != (Object)null) { componentsInChildren[i].useGravity = true; } } } catch { } } private static float Slider(string label, float value, float min, float max) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f * Skin.Scale) }); float result = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(result.ToString("0.00"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f * Skin.Scale) }); GUILayout.EndHorizontal(); return result; } private static bool KeyDown(Key key) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) try { Keyboard current = Keyboard.current; if (current != null) { return ((ButtonControl)current[key]).wasPressedThisFrame; } } catch { } return false; } } public class VoicePitchShifter : MonoBehaviour { private const int Size = 4096; public float Pitch = 1f; private float[][] _lines; private int[] _write; private float[] _tap; private int _channels; private void Prepare(int channels) { if (_lines == null || _channels != channels) { _channels = channels; _lines = new float[channels][]; _write = new int[channels]; _tap = new float[channels]; for (int i = 0; i < channels; i++) { _lines[i] = new float[4096]; } } } private void OnAudioFilterRead(float[] data, int channels) { if (channels <= 0 || Mathf.Abs(Pitch - 1f) < 0.01f) { return; } Prepare(channels); float num = Mathf.Clamp(Pitch, 0.4f, 2.5f); int num2 = 2048; for (int i = 0; i < data.Length; i += channels) { for (int j = 0; j < channels; j++) { float[] array = _lines[j]; array[_write[j]] = data[i + j]; _tap[j] += 1f - num; if (_tap[j] < 0f) { _tap[j] += 4096f; } if (_tap[j] >= 4096f) { _tap[j] -= 4096f; } float num3 = Sample(array, (float)_write[j] - _tap[j]); float num4 = Sample(array, (float)_write[j] - _tap[j] - (float)num2); float num5 = _tap[j] / 4096f; float num6 = Mathf.Sin((float)Math.PI * num5); float num7 = Mathf.Sin((float)Math.PI * ((num5 + 0.5f) % 1f)); data[i + j] = num3 * num6 + num4 * num7; _write[j]++; if (_write[j] >= 4096) { _write[j] = 0; } } } } private static float Sample(float[] line, float position) { while (position < 0f) { position += 4096f; } while (position >= 4096f) { position -= 4096f; } int num = (int)position; int num2 = num + 1; if (num2 >= 4096) { num2 = 0; } float num3 = position - (float)num; return line[num] * (1f - num3) + line[num2] * num3; } } public static class ZombieTuning { private static readonly HashSet _tuned = new HashSet(); public static void Reset() { _tuned.Clear(); } public static void Apply(MushroomZombie zombie) { ApplyScaled(zombie, Plugin.CfgZombieStrength.Value, Plugin.CfgZombieSpeed.Value, Plugin.CfgZombieAggression.Value); } public static void ApplyScaled(MushroomZombie zombie, float strength, float speed, float aggression) { if ((Object)(object)zombie == (Object)null) { return; } int instanceID = ((Object)zombie).GetInstanceID(); if (!_tuned.Contains(instanceID)) { _tuned.Add(instanceID); zombie.reachForce *= strength; zombie.biteStunTime *= strength; zombie.zombieSprintDistance *= speed; if (speed > 0.01f) { zombie.chaseTimeBeforeSprint /= speed; zombie.lungeRecoveryTime /= speed; zombie.lungeTime /= speed; } zombie.distanceBeforeWakeup *= aggression; zombie.distanceBeforeChase *= aggression; zombie.zombieLungeDistance *= aggression; } } public static int ApplyToAll() { MushroomZombie[] array = Object.FindObjectsOfType(); int num = 0; for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { Apply(array[i]); num++; } } Plugin.Log.LogInfo((object)("Ajuste aplicado em " + num + " zumbi(s).")); return num; } }