Decompiled source of MrFallTwitchChatChallenge v1.0.5
plugins/MrFallTwitchChatChallenge.dll
Decompiled 6 days ago
The result has been truncated due to the large size, download it to view full contents!
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<EventVoting>(); } 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> { (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> { (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<ConfigEntryBase> 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<ConfigEntryBase> 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<ConfigEntryBase> EventEntries() { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); 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<int> 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<int> 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<int> 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<int> cfgZombieDefenseCount2 = Plugin.CfgZombieDefenseCount; cfgZombieDefenseCount2.Value += 1; } GUILayout.EndHorizontal(); GUILayout.Label(Lang.ZombieDefenceHint, _sub, (GUILayoutOption[])(object)new GUILayoutOption[0]); DrawDefaultsButton(new List<ConfigEntryBase> { (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<ConfigEntryBase> list = new List<ConfigEntryBase>(); 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<GameEvent> _ballot = new List<GameEvent>(); private readonly int[] _votes = new int[5]; private readonly HashSet<string> _voters = new HashSet<string>(); 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<FloatingItem>() != (Object)null)) { FloatingItem floatingItem = target.AddComponent<FloatingItem>(); floatingItem._target = follow; floatingItem._endsAt = Time.time + seconds; } } private void Start() { _body = ((Component)this).GetComponent<Rigidbody>(); _item = ((Component)this).GetComponent<Item>(); 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<bool> Enabled; public ConfigEntry<string> ItemName; public ConfigEntry<int> Amount; public ConfigEntry<float> 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<GameEvent> All = new List<GameEvent>(); 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<GameObject> _temporary = new List<GameObject>(); 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<string, int> _lastSeen = new Dictionary<string, int>(); 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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.ItemName = config.Bind<string>(text, "Item", defaultItem, "Qual item e criado."); gameEvent.Amount = config.Bind<int>(text, "Amount", defaultAmount, new ConfigDescription("Quantos.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), new object[0])); gameEvent.Intensity = config.Bind<float>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind<float>(text, "Intensity", defaultAmount, new ConfigDescription("Quao forte (0 a 1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1f), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind<int>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind<int>(text, "Amount", 1, new ConfigDescription("Quantos tornados.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Intensity = config.Bind<float>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind<int>(text, "Amount", defaultAmount, new ConfigDescription("Quantos itens.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado: o item e sorteado."); gameEvent.Intensity = config.Bind<float>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind<float>(text, "Seconds", 25f, new ConfigDescription("Quantos segundos a ventania dura.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 180f), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind<int>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind<int>(text, "Amount", 13, new ConfigDescription("Quantos zumbis na horda.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 60), new object[0])); gameEvent.Intensity = config.Bind<float>(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<float>(0.1f, 1f), new object[0])); gameEvent.ItemName = config.Bind<string>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind<int>(text, "Amount", 3, new ConfigDescription("Quantos itens caem.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado: o item e sorteado."); gameEvent.Intensity = config.Bind<float>(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<bool>(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<float>(text, "Seconds", 20f, new ConfigDescription("Quanto tempo o jogador fica como tornado.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 180f), new object[0])); gameEvent.Amount = config.Bind<int>(text, "WarningSeconds", 5, new ConfigDescription("Contagem regressiva antes da transformacao. Padrao: 5 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 60), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); All.Add(gameEvent); } public static void TurnSomeoneIntoTornado(float seconds) { if (!RequireHost("vira tornado")) { return; } List<Character> 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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind<float>(text, "CountdownSeconds", 5f, new ConfigDescription("Contagem regressiva antes do som tocar.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Sound", "aura", "Qual audio embutido toca no fim da contagem (sem o .mp3)."); gameEvent.Amount = config.Bind<int>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind<float>(text, "Seconds", 75f, new ConfigDescription("Quanto tempo as vozes ficam distorcidas. Padrao: 1 minuto e 15 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 600f), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind<int>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao, e continua disponivel no botao do menu."); gameEvent.Intensity = config.Bind<float>(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<float>(0f, 900f), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind<int>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Intensity = config.Bind<float>(text, "Seconds", 70f, new ConfigDescription("Quanto tempo o relogio corre antes da revelacao. Padrao: 1 minuto e 10 segundos.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Item", "RitualDagger", "Qual item cai na frente do jogador."); gameEvent.Amount = config.Bind<int>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Amount = config.Bind<int>(text, "UnusedAmount", 1, "Nao usado neste evento."); gameEvent.Intensity = config.Bind<float>(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<bool>(text, "Enabled", true, "Entra no sorteio da votacao."); gameEvent.Amount = config.Bind<int>(text, "Amount", 2, new ConfigDescription("Quantos zumbis acordam.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), new object[0])); gameEvent.ItemName = config.Bind<string>(text, "Unused", "", "Nao usado neste evento."); gameEvent.Intensity = config.Bind<float>(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<Tornado>(); 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<GameObject> list = new List<GameObject>(); 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<GameObject> 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<string> list = new List<string>(); 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<GameObject> 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<GameObject> list = new List<GameObject>(); 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<MushroomZombie>(); 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<PhotonView>(); 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<PhotonView>(); 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<Character> 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<Tornado>(); 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<MushroomZombie>(); 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<PhotonView>(); 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<AudioSource>(); _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<AudioClip>(); 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[] arra