using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using REPOLib.Modules; using Sirenix.Serialization.Utilities; using TMPro; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Discord.Sdk")] [assembly: IgnoresAccessChecksTo("Domain_Reload")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Modules.UnityLocalization")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.Addressables")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.InternalAPIEngineBridge.013")] [assembly: IgnoresAccessChecksTo("Unity.Localization")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.ResourceManager")] [assembly: IgnoresAccessChecksTo("Unity.ScriptableBuildPipeline")] [assembly: IgnoresAccessChecksTo("Unity.Splines")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("mihmi125")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fork of MapVote: Vote between 3 random maps in R.E.P.O.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ae18e60d6ea58cb78b8363e87e76ffe5f01fea2e")] [assembly: AssemblyProduct("MapVote")] [assembly: AssemblyTitle("mihmi125.MapVote")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/mihmi125/Repo-MapVote")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MapVote { internal class CompatibilityPatches { private static Dictionary Patches = new Dictionary(); public static void PopulatePatches() { Patches.Add("ViViKo.StartInShop", delegate { MapVote.HideInMenu.Value = true; }); } public static void RunPatches(List pluginGUIDs) { List pluginGUIDs2 = pluginGUIDs; PopulatePatches(); LinqExtensions.ForEach>(Patches.Where>((KeyValuePair x) => pluginGUIDs2.Contains(x.Key)), (Action>)delegate(KeyValuePair plugin) { plugin.Value(); MapVote.Logger.LogInfo((object)("Ran Compatibility Patch for " + plugin.Key)); }); } } internal class DebugManager { public static void InitializeDebug() { PopulateMockData(); } private static void PopulateMockData() { MapVote.SelectedMaps = new List { "Level - Arctic", "Level - Manor", "Level - Wizard" }; MapVote.CurrentVotes[10] = "Level - Arctic"; MapVote.CurrentVotes[11] = "Level - Manor"; MapVote.CurrentVotes[12] = "Level - Wizard"; MapVote.CurrentVotes[13] = "Level - Wizard"; MapVote.CurrentVotes[14] = "Level - Wizard"; MapVote.CurrentVotes[15] = "Random"; } } internal static class LevelColorDictionary { private static readonly Dictionary _dictionary = new Dictionary { { "Random", "#21D710" }, { "Level - Manor", "#E79F0E" }, { "Level - Arctic", "#75DCD9" }, { "Level - Wizard", "#CB11CE" }, { "Level - Stronghold", "#A56695" }, { "Level - Museum", "#915829" }, { "Level - Bunker", "#D6C87E" }, { "Level - MtHolly", "#508AE1" }, { "Level - Garden", "#04A831" }, { "Level - Facility", "#A3BA8C" }, { "Level - Hospital", "#D53C35" }, { "Level - Backrooms", "#B7C13D" }, { "Level - DampMine", "#FA7902" } }; public static string GetColor(string key) { if (!_dictionary.TryGetValue(key, out string value)) { return "#ffffff"; } return value; } } [BepInPlugin("mihmi125.MapVote", "MapVote", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal sealed class MapVote : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Predicate <>9__32_0; public static Func, string> <>9__36_0; public static Action <>9__39_1; public static BuilderDelegate <>9__39_0; public static Action> <>9__44_0; public static Funcf__AnonymousType0> <>9__48_0; public static Funcf__AnonymousType0, int> <>9__48_1; public static Funcf__AnonymousType0, VoteOptionButton> <>9__48_2; public static Func <>9__52_0; public static Func <>9__52_1; public static Func <>9__52_2; public static Func <>9__53_0; public static Action <>9__53_3; public static ScrollViewBuilderDelegate <>9__53_1; public static Func <>9__53_4; public static Action <>9__54_0; public static Predicate <>9__55_0; public static Func <>9__55_1; public static Func, int> <>9__55_2; public static Predicate <>9__55_3; public static Predicate <>9__55_4; public static Predicate <>9__55_5; public static Predicate <>9__55_6; internal bool b__32_0(Level x) { return ((Object)x).name == WonMap; } internal string b__36_0(KeyValuePair x) { return x.Key; } internal void b__39_0(Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Map Vote", (Action)delegate { CreateVotePopup(isInMenu: true); }, parent, new Vector2(175.2f, 62.8f)); } internal void b__39_1() { CreateVotePopup(isInMenu: true); } internal void b__44_0(KeyValuePair x) { CurrentVotes[x.Key] = x.Value; } internal global::<>f__AnonymousType0 b__48_0(VoteOptionButton b) { return new { Item = b, Count = b.GetVotes(CurrentVotes.Values) }; } internal int b__48_1(global::<>f__AnonymousType0 b) { return b.Count; } internal VoteOptionButton b__48_2(global::<>f__AnonymousType0 b) { return b.Item; } internal bool b__52_0(Level l) { if (((Object)l).name != "Level - Lobby") { return ((Object)l).name != "Level - Shop"; } return false; } internal bool b__52_1(Level l) { return !HasBeenLastPlayed(((Object)l).name); } internal string b__52_2(Level l) { return ((Object)l).name; } internal bool b__53_0(Level l) { return SelectedMaps.Contains(((Object)l).name); } internal RectTransform b__53_1(Transform parent) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) REPOButton val = MenuAPI.CreateREPOButton((string)null, (Action)delegate { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!DisableInput) { OwnVoteLevel = "Random"; NetworkedEvent? onVoteEvent = OnVoteEvent; if (onVoteEvent != null) { onVoteEvent.RaiseEvent((object)"Random", NetworkingEvents.RaiseAll, SendOptions.SendReliable); } } }, parent, default(Vector2)); HorizontalLayoutGroup val2 = ComponentHolderProtocol.AddComponent((Object)(object)val); ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = false; ((Component)val.labelTMP).GetComponent().sizeDelta = new Vector2(269f, 0f); VoteOptionButtons.Add(new VoteOptionButton("Random", 0, val, _isRandomButton: true)); return ((REPOElement)val).rectTransform; } internal void b__53_3() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!DisableInput) { OwnVoteLevel = "Random"; NetworkedEvent? onVoteEvent = OnVoteEvent; if (onVoteEvent != null) { onVoteEvent.RaiseEvent((object)"Random", NetworkingEvents.RaiseAll, SendOptions.SendReliable); } } } internal (Level level, int index) b__53_4(Level level, int index) { return (level, index); } internal void b__54_0(VoteOptionButton b) { b.UpdateLabel(_highlight: false, HasBeenLastPlayed(b.Level)); } internal bool b__55_0(VoteOptionButton x) { return !x.IsRandomButton; } internal int b__55_1(VoteOptionButton x) { return x.GetVotes(CurrentVotes.Values); } internal int b__55_2(IGrouping x) { return x.Key; } internal bool b__55_3(VoteOptionButton x) { return x.Level == "Random"; } internal bool b__55_4(VoteOptionButton x) { return !HasBeenLastPlayed(x.Level); } internal bool b__55_5(VoteOptionButton x) { return !x.IsRandomButton; } internal bool b__55_6(VoteOptionButton x) { return x.IsRandomButton; } } [CompilerGenerated] private sealed class <>c__DisplayClass57_0 { public string winningMap; internal bool b__0(VoteOptionButton x) { return x.Level == winningMap; } } [CompilerGenerated] private sealed class d__58 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public VoteOptionButton voteOption; private int 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__58(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = (int)Mathf.Ceil(6f); 5__3 = 0; break; case 1: <>1__state = -1; voteOption.UpdateLabel(); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; case 2: <>1__state = -1; 5__3++; break; } if (5__3 < 5__2) { voteOption.UpdateLabel(_highlight: true); <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__57 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string winningMap; private List 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__57(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>c__DisplayClass57_0 CS$<>8__locals0 = new <>c__DisplayClass57_0 { winningMap = winningMap }; DisableInput = true; ShouldHookRunMangerSetRunLevel = true; WonMap = CS$<>8__locals0.winningMap; 5__2 = GetEligibleOptions(); if (5__2.Count > 1) { 5__3 = 5__2.FindIndex((VoteOptionButton x) => x.Level == CS$<>8__locals0.winningMap); <>2__current = ((MonoBehaviour)Instance).StartCoroutine(SpinWheelOptions(5__2, 5__3)); <>1__state = 1; return true; } VoteOptionButton voteOptionButton = 5__2.FirstOrDefault(); if (voteOptionButton != null) { <>2__current = ((MonoBehaviour)Instance).StartCoroutine(BlinkButton(voteOptionButton)); <>1__state = 3; return true; } break; } case 1: <>1__state = -1; <>2__current = ((MonoBehaviour)Instance).StartCoroutine(BlinkButton(5__2[5__3])); <>1__state = 2; return true; case 2: <>1__state = -1; break; case 3: <>1__state = -1; break; } DisableInput = false; if (SemiFunc.RunIsLobby()) { CreateNextMapLabel(WonMap); if ((Object)(object)VotePopup != (Object)null) { VotePopup.ClosePage(true); } MenuAPI.CloseAllPagesAddedOnTop(); } if (SemiFunc.IsMasterClient() && SemiFunc.RunIsLobbyMenu()) { MenuPageLobby.instance.ButtonStart(); } Reset(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__59 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int winningIndex; public List eligibleOptions; private float 5__2; private int 5__3; private int 5__4; private int 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (5__2 > 0.4f && 5__3 == 5__4) { goto IL_0112; } 5__2 *= 1.15f; 5__5 = 5__3; 5__3 = (5__3 + 1) % eligibleOptions.Count; } else { <>1__state = -1; 5__2 = 0.05f; 5__3 = 0; 5__4 = winningIndex; 5__5 = -1; } if (5__3 != 5__4 || 5__2 < 0.5f) { eligibleOptions[5__3].UpdateLabel(_highlight: true); if (5__5 >= 0) { eligibleOptions[5__5].UpdateLabel(); } <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 1; return true; } goto IL_0112; IL_0112: eligibleOptions[5__5].UpdateLabel(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__51 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private string 5__2; private NumberFormatInfo 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__51(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (SemiFunc.IsMasterClientOrSingleplayer()) { VotingTimeLeft = VotingTime.Value; NetworkedEvent? onStartCountdown = OnStartCountdown; if (onStartCountdown != null) { onStartCountdown.RaiseEvent((object)VotingTimeLeft, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } 5__2 = "00.00"; 5__3 = new NumberFormatInfo { NumberDecimalSeparator = ":" }; break; case 1: <>1__state = -1; break; } if (VotingTimeLeft > 0f) { VotingTimeLeft -= Time.deltaTime; if ((Object)(object)VotingTimeLabel != (Object)null) { ((TMP_Text)VotingTimeLabel.labelTMP).text = "" + VotingTimeLeft.ToString(5__2, 5__3) + " Seconds Left"; } <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)VotingTimeLabel != (Object)null && (Object)(object)((Component)VotingTimeLabel).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)VotingTimeLabel).gameObject); } if (SemiFunc.IsMasterClientOrSingleplayer()) { string winningMap = GetWinningMap(); NetworkedEvent? onVoteEndedEvent = OnVoteEndedEvent; if (onVoteEndedEvent != null) { onVoteEndedEvent.RaiseEvent((object)winningMap, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } ((MonoBehaviour)Instance).StartCoroutine(OnVotingDone(winningMap)); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__50 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (CurrentVotes.Values.Count <= 0) { UpdateButtonLabels(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return false; } ((MonoBehaviour)Instance).StartCoroutine(StartCountdown()); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string VOTE_RANDOM_LABEL = "Random"; public const string TRUCK_LEVEL_NAME = "Level - Lobby"; public const string SHOP_LEVEL_NAME = "Level - Shop"; public const string REQUEST_VOTE_LEVEL = "Level - Lobby"; public const bool IS_DEBUG = false; internal static readonly ManualLogSource Logger = Logger.CreateLogSource("MapVote"); public static NetworkedEvent? OnVoteEvent; public static NetworkedEvent? OnVoteEndedEvent; public static NetworkedEvent? OnSyncVotes; public static NetworkedEvent? OnSyncLastMapPlayed; public static NetworkedEvent? OnStartCountdown; public static NetworkedEvent? OnSyncSelectedMaps; public static ConfigEntry VotingTime; public static ConfigEntry HideInMenu; public static ConfigEntry NoRepeatedMaps; public static VotesDictionary CurrentVotes = new VotesDictionary(); public static readonly List VoteOptionButtons = new List(); public static string? OwnVoteLevel; public static string? WonMap; public static List SelectedMaps = new List(); public static REPOPopupPage? VotePopup; public static float VotingTimeLeft = 0f; public static REPOLabel? VotingTimeLabel; public static bool DisableInput = false; public static bool ShouldHookRunMangerSetRunLevel = false; public static string? LastMapPlayed; public static MapVote Instance; private static Hook RunManagerSetRunLevelHook = new Hook((MethodBase)AccessTools.DeclaredMethod(typeof(RunManager), "SetRunLevel", (Type[])null, (Type[])null), (Delegate)new Action, RunManager>(HookRunManagerSetRunLevel)); private static int ButtonStartHookRunAmount = 0; private static Hook ButtonStartHook = new Hook((MethodBase)AccessTools.DeclaredMethod(typeof(MenuPageLobby), "ButtonStart", (Type[])null, (Type[])null), (Delegate)new Action, MenuPageLobby>(HookButtonStart)); internal Harmony? Harmony { get; set; } private static void HookRunManagerSetRunLevel(Action orig, RunManager self) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && ShouldHookRunMangerSetRunLevel) { self.levelCurrent = self.levels.Find((Level x) => ((Object)x).name == WonMap); ShouldHookRunMangerSetRunLevel = false; LastMapPlayed = WonMap; NetworkedEvent? onSyncLastMapPlayed = OnSyncLastMapPlayed; if (onSyncLastMapPlayed != null) { onSyncLastMapPlayed.RaiseEvent((object)LastMapPlayed, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } Reset(); WonMap = null; } else { orig(self); } } private static void HookButtonStart(Action orig, MenuPageLobby self) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (DisableInput) { return; } if (ButtonStartHookRunAmount > 0 || HideInMenu.Value) { ButtonStartHookRunAmount = 0; orig(self); return; } ButtonStartHookRunAmount++; string winningMap = GetWinningMap(); NetworkedEvent? onVoteEndedEvent = OnVoteEndedEvent; if (onVoteEndedEvent != null) { onVoteEndedEvent.RaiseEvent((object)winningMap, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } ((MonoBehaviour)Instance).StartCoroutine(OnVotingDone(winningMap)); } public void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); VotingTime = ((BaseUnityPlugin)this).Config.Bind("General", "Voting Time", 10, new ConfigDescription("The amount of seconds until the voting ends, after the first player voted.", (AcceptableValueBase)(object)new AcceptableValueRange(3, 30), Array.Empty())); HideInMenu = ((BaseUnityPlugin)this).Config.Bind("General", "Hide in Menu", false, new ConfigDescription("When true - hides the Menu in the lobby menu and randomly selects a random map - Voting is still enabled in the truck", (AcceptableValueBase)null, Array.Empty())); NoRepeatedMaps = ((BaseUnityPlugin)this).Config.Bind("General", "No Repeated Maps", false, new ConfigDescription("When true - disallows votes for the most recently played map - You won't play the same map twice in a row", (AcceptableValueBase)null, Array.Empty())); CompatibilityPatches.RunPatches(Chainloader.PluginInfos.Select((KeyValuePair x) => x.Key).ToList()); Initialize(); Logger.LogDebug((object)"Loaded MapVote V1.0.0!"); } internal void Patch() { //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_0020: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown try { if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } catch (Exception ex) { Logger.LogError((object)ex); } } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static void Initialize() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown OnVoteEvent = new NetworkedEvent("OnVoteEvent", (Action)HandleOnVoteEvent); OnVoteEndedEvent = new NetworkedEvent("OnVoteEndedEvent", (Action)HandleOnVoteEndEvent); OnSyncVotes = new NetworkedEvent("OnSyncVotes", (Action)HandleOnSyncVotes); OnSyncLastMapPlayed = new NetworkedEvent("OnSyncLastMapPlayed", (Action)HandleOnSyncLastMapPlayed); OnStartCountdown = new NetworkedEvent("OnStartCountdown", (Action)HandleOnStartCountdown); OnSyncSelectedMaps = new NetworkedEvent("OnSyncSelectedMaps", (Action)HandleOnSyncSelectedMaps); if (HideInMenu.Value) { return; } object obj = <>c.<>9__39_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Map Vote", (Action)delegate { CreateVotePopup(isInMenu: true); }, parent, new Vector2(175.2f, 62.8f)); }; <>c.<>9__39_0 = val; obj = (object)val; } MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj); } public static bool HasBeenLastPlayed(string? level) { if (level == null || !NoRepeatedMaps.Value) { return false; } if (LastMapPlayed == level) { return LastMapPlayed != WonMap; } return false; } public static void Reset() { CurrentVotes.Values.Clear(); VoteOptionButtons.Clear(); OwnVoteLevel = null; SelectedMaps.Clear(); UpdateButtonLabels(); } private static void HandleOnSyncLastMapPlayed(EventData data) { string lastMapPlayed = (string)data.CustomData; LastMapPlayed = lastMapPlayed; WonMap = null; } private static void HandleOnStartCountdown(EventData data) { if (!SemiFunc.IsMasterClient()) { float votingTimeLeft = (float)data.CustomData; VotingTimeLeft = votingTimeLeft; ((MonoBehaviour)Instance).StartCoroutine(StartCountdown()); } } private static void HandleOnSyncVotes(EventData data) { if (SemiFunc.IsMasterClient()) { UpdateButtonLabels(); return; } Dictionary dictionary = (Dictionary)data.CustomData; if (dictionary != null) { Reset(); WonMap = null; LinqExtensions.ForEach>((IEnumerable>)dictionary, (Action>)delegate(KeyValuePair x) { CurrentVotes[x.Key] = x.Value; }); UpdateButtonLabels(); } } private static void HandleOnSyncSelectedMaps(EventData data) { if (!SemiFunc.IsMasterClient()) { string[] array = (string[])data.CustomData; if (array != null) { SelectedMaps = new List(array); } } } private static void HandleOnVoteEvent(EventData data) { string value = (string)data.CustomData; CurrentVotes[data.sender] = value; } private static void HandleOnVoteEndEvent(EventData data) { string winningMap = (string)data.CustomData; ((MonoBehaviour)Instance).StartCoroutine(OnVotingDone(winningMap)); } public static List GetSortedVoteOptions() { return (from b in VoteOptionButtons select new { Item = b, Count = b.GetVotes(CurrentVotes.Values) } into b orderby b.Count descending select b.Item).ToList(); } public static void CreateNextMapLabel(string mapName) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) REPOLabel val = MenuAPI.CreateREPOLabel((string)null, GameObject.Find("Game Hud").transform, new Vector2(-100f, 110f)); ((TMP_Text)val.labelTMP).horizontalAlignment = (HorizontalAlignmentOptions)2; ((TMP_Text)val.labelTMP).text = "Next Map: " + Utilities.RemoveLevelPrefix(mapName) + ""; } [IteratorStateMachine(typeof(d__50))] public static IEnumerator WaitForVote() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__50(0); } [IteratorStateMachine(typeof(d__51))] public static IEnumerator StartCountdown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__51(0); } public static List GetRandomMapSelection(List allLevels, int count) { List list = (from l in allLevels where ((Object)l).name != "Level - Lobby" && ((Object)l).name != "Level - Shop" where !HasBeenLastPlayed(((Object)l).name) select ((Object)l).name).ToList(); for (int num = list.Count - 1; num > 0; num--) { int num2 = Random.RandomRangeInt(0, num + 1); List list2 = list; int index = num; int index2 = num2; string value = list[num2]; string value2 = list[num]; list2[index] = value; list[index2] = value2; } return list.Take(count).ToList(); } public static void CreateVotePopup(bool isInMenu = false) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown MenuAPI.CloseAllPagesAddedOnTop(); VoteOptionButtons.Clear(); if ((Object)(object)VotePopup != (Object)null) { VotePopup.ClosePage(true); VotePopup = null; } if (((Object)RunManager.instance.levelCurrent).name == "Level - Lobby") { GameDirector.instance.DisableInput = true; } VotePopup = MenuAPI.CreateREPOPopupPage("Next map", true, !isInMenu, 0f, (Vector2?)(isInMenu ? new Vector2(40f, 0f) : new Vector2(-100f, 0f))); RunManager val = Object.FindObjectOfType(); if (SemiFunc.IsMasterClientOrSingleplayer() && SelectedMaps.Count == 0) { SelectedMaps = GetRandomMapSelection(val.levels, 3); NetworkedEvent? onSyncSelectedMaps = OnSyncSelectedMaps; if (onSyncSelectedMaps != null) { onSyncSelectedMaps.RaiseEvent((object)SelectedMaps.ToArray(), NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } List source = ((SelectedMaps.Count > 0) ? val.levels.Where((Level l) => SelectedMaps.Contains(((Object)l).name)).ToList() : val.levels); REPOPopupPage? votePopup = VotePopup; object obj = <>c.<>9__53_1; if (obj == null) { ScrollViewBuilderDelegate val2 = delegate(Transform parent) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) REPOButton val5 = MenuAPI.CreateREPOButton((string)null, (Action)delegate { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!DisableInput) { OwnVoteLevel = "Random"; NetworkedEvent? onVoteEvent2 = OnVoteEvent; if (onVoteEvent2 != null) { onVoteEvent2.RaiseEvent((object)"Random", NetworkingEvents.RaiseAll, SendOptions.SendReliable); } } }, parent, default(Vector2)); HorizontalLayoutGroup val6 = ComponentHolderProtocol.AddComponent((Object)(object)val5); ((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = false; ((Component)val5.labelTMP).GetComponent().sizeDelta = new Vector2(269f, 0f); VoteOptionButtons.Add(new VoteOptionButton("Random", 0, val5, _isRandomButton: true)); return ((REPOElement)val5).rectTransform; }; <>c.<>9__53_1 = val2; obj = (object)val2; } votePopup.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f); foreach (var item3 in source.Select((Level level, int index) => (level, index))) { Level item = item3.Item1; int item2 = item3.Item2; string name = ((Object)item).name; VotePopup.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) REPOButton val3 = MenuAPI.CreateREPOButton((string)null, (Action)delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!DisableInput) { OwnVoteLevel = name; NetworkedEvent? onVoteEvent = OnVoteEvent; if (onVoteEvent != null) { onVoteEvent.RaiseEvent((object)name, NetworkingEvents.RaiseAll, SendOptions.SendReliable); } } }, parent, default(Vector2)); if (HasBeenLastPlayed(name)) { ((Component)val3).gameObject.GetComponent().disabled = true; } HorizontalLayoutGroup val4 = ComponentHolderProtocol.AddComponent((Object)(object)val3); ((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = false; ((Component)val3.labelTMP).GetComponent().sizeDelta = new Vector2(269f, 0f); VoteOptionButtons.Add(new VoteOptionButton(name, 0, val3)); return ((REPOElement)val3).rectTransform; }, 0f, 0f); } VotePopup.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) VotingTimeLabel = MenuAPI.CreateREPOLabel((string)null, parent, new Vector2(isInMenu ? 394f : 254f, 30f)); }); VotePopup.OpenPage(true); UpdateButtonLabels(); ((Component)VotePopup).GetComponent().PageStateSet((PageState)1); } public static void UpdateButtonLabels() { VoteOptionButtons.ForEach(delegate(VoteOptionButton b) { b.UpdateLabel(_highlight: false, HasBeenLastPlayed(b.Level)); }); } public static List GetEligibleOptions() { if (CurrentVotes.Values.Count == 0) { return VoteOptionButtons.FindAll((VoteOptionButton x) => !x.IsRandomButton); } List list = new List(); List sortedVoteOptions = GetSortedVoteOptions(); List list2 = (from x in sortedVoteOptions group x by x.GetVotes(CurrentVotes.Values) into x orderby x.Key descending select x).FirstOrDefault().ToList(); list = ((list2.Find((VoteOptionButton x) => x.Level == "Random") == null) ? (list2 ?? list) : VoteOptionButtons); if (NoRepeatedMaps.Value) { list = list.FindAll((VoteOptionButton x) => !HasBeenLastPlayed(x.Level)); } if (list.FindAll((VoteOptionButton x) => !x.IsRandomButton).Count <= 0) { list = VoteOptionButtons; } list.RemoveAll((VoteOptionButton x) => x.IsRandomButton); return list; } public static string GetWinningMap() { List eligibleOptions = GetEligibleOptions(); int index = Random.RandomRangeInt(0, eligibleOptions.Count - 1); return eligibleOptions[index].Level; } [IteratorStateMachine(typeof(d__57))] public static IEnumerator OnVotingDone(string winningMap) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__57(0) { winningMap = winningMap }; } [IteratorStateMachine(typeof(d__58))] public static IEnumerator BlinkButton(VoteOptionButton voteOption) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__58(0) { voteOption = voteOption }; } [IteratorStateMachine(typeof(d__59))] public static IEnumerator SpinWheelOptions(List eligibleOptions, int winningIndex) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__59(0) { eligibleOptions = eligibleOptions, winningIndex = winningIndex }; } } internal sealed class Utilities { public static string ColorString(string text, string colorHex) { return "" + text + ""; } public static string ColorString(string text, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return "" + text + ""; } public static string RemoveLevelPrefix(string text) { return text.Replace("Level - ", ""); } } internal sealed class VoteOptionButton { public string Level { get; set; } public REPOButton Button { get; set; } public bool IsRandomButton { get; set; } public VoteOptionButton(string _level, int _votes, REPOButton _button, bool _isRandomButton = false) { Level = _level; Button = _button; IsRandomButton = _isRandomButton; } public int GetVotes(Dictionary votes) { int num = 0; foreach (KeyValuePair vote in votes) { if (vote.Value == Level) { num++; } } return num; } public void UpdateLabel(bool _highlight = false, bool _disabled = false) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) Dictionary values = MapVote.CurrentVotes.Values; bool flag = MapVote.OwnVoteLevel == Level; int num = Math.Max(Math.Min(GameDirector.instance.PlayerList.Count, 12), 4); int votes = GetVotes(values); Color color = (_disabled ? Color.gray : (_highlight ? Color.green : (flag ? Color.yellow : Color.white))); StringBuilder stringBuilder = new StringBuilder(); if (_disabled) { stringBuilder.Append(""); } stringBuilder.Append("[" + Utilities.ColorString((flag || _highlight) ? "X" : " ", color) + "] "); if (!_disabled) { stringBuilder.Append(""); } stringBuilder.Append((IsRandomButton ? "Random" : Utilities.RemoveLevelPrefix(Level)) ?? ""); if (!_disabled) { stringBuilder.Append(""); } if (_disabled) { stringBuilder.Append(""); } stringBuilder.Append("\n"); stringBuilder.Append("" + Utilities.ColorString(new string('I', votes), Color.green) + Utilities.ColorString(new string('I', num - votes), Color.white) + ""); ((TMP_Text)Button.labelTMP).text = stringBuilder.ToString() ?? ""; } } public class VotesDictionary { public readonly Dictionary Values = new Dictionary(); public string this[int key] { get { return Values[key]; } set { Values[key] = value; MapVote.UpdateButtonLabels(); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "mihmi125.MapVote"; public const string PLUGIN_NAME = "MapVote"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MapVote.Patches { [HarmonyPatch(typeof(HealthUI))] public class HealthUIPatch { [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (SemiFunc.IsMasterClientOrSingleplayer()) { MapVote.CreateVotePopup(); return false; } 5__2 = 0f; break; case 1: <>1__state = -1; break; } if (MapVote.SelectedMaps.Count == 0 && 5__2 < 5f) { 5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } if (MapVote.SelectedMaps.Count == 0) { MapVote.Logger.LogWarning((object)"HealthUIPatch: timed out waiting for SelectedMaps sync — opening popup with all levels as fallback."); } MapVote.CreateVotePopup(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostfixStart(HealthUI __instance) { if (((Object)RunManager.instance.levelCurrent).name == "Level - Lobby") { ((MonoBehaviour)MapVote.Instance).StartCoroutine(MapVote.WaitForVote()); ((MonoBehaviour)MapVote.Instance).StartCoroutine(WaitForSelectedMapsAndCreatePopup()); } } [IteratorStateMachine(typeof(d__1))] private static IEnumerator WaitForSelectedMapsAndCreatePopup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0); } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatch { [HarmonyPatch("PageOpen")] [HarmonyPostfix] private static void PageOpenPostfix(MenuPageIndex menuPageIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)menuPageIndex == 8) { if (SemiFunc.IsMasterClientOrSingleplayer()) { MapVote.Reset(); MapVote.WonMap = null; } else { MapVote.OwnVoteLevel = null; MapVote.VoteOptionButtons.Clear(); } if (!MapVote.HideInMenu.Value) { MapVote.CreateVotePopup(isInMenu: true); } } } } [HarmonyPatch(typeof(MenuPageLobby))] internal class SteamManagerPatch { [HarmonyPatch("PlayerAdd")] [HarmonyPostfix] public static void PostfixJoiningPlayer() { //IL_0021: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClient()) { return; } NetworkedEvent? onSyncVotes = MapVote.OnSyncVotes; if (onSyncVotes != null) { onSyncVotes.RaiseEvent((object)MapVote.CurrentVotes.Values, NetworkingEvents.RaiseAll, SendOptions.SendReliable); } NetworkedEvent? onSyncLastMapPlayed = MapVote.OnSyncLastMapPlayed; if (onSyncLastMapPlayed != null) { onSyncLastMapPlayed.RaiseEvent((object)MapVote.LastMapPlayed, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } if (MapVote.SelectedMaps.Count > 0) { NetworkedEvent? onSyncSelectedMaps = MapVote.OnSyncSelectedMaps; if (onSyncSelectedMaps != null) { onSyncSelectedMaps.RaiseEvent((object)MapVote.SelectedMaps.ToArray(), NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } } } }