using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("MultiplayerRegionBypass")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MultiplayerRegionBypass")]
[assembly: AssemblyTitle("MultiplayerRegionBypass")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("sparroh.multiplayerregionbypass", "MultiplayerRegionBypass", "1.1.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class MultiplayerRegionBypassPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.multiplayerregionbypass";
public const string PluginName = "MultiplayerRegionBypass";
public const string PluginVersion = "1.1.0";
internal static ManualLogSource Logger;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
try
{
new Harmony("sparroh.multiplayerregionbypass").PatchAll(typeof(RegionBypassPatches));
}
catch (Exception ex)
{
Logger.LogError((object)("Error applying patches: " + ex.Message));
return;
}
Logger.LogInfo((object)"MultiplayerRegionBypass loaded successfully.");
}
}
internal static class RegionBypassPatches
{
[HarmonyPatch(typeof(Option), "OnEnable")]
[HarmonyPrefix]
private static void Option_OnEnable_Prefix(Option __instance)
{
if (!(__instance.ID == "LobbyDistance"))
{
return;
}
Traverse.Create((object)__instance).Field<float>("maxValue").Value = 3f;
Transform val = ((Component)__instance).gameObject.transform.Find("ScrollRect/ScrollBar");
if ((Object)(object)val != (Object)null)
{
ScrollBar component = ((Component)val).GetComponent<ScrollBar>();
if ((Object)(object)component != (Object)null)
{
component.SetSnapPoints(4, 0);
}
}
}
[HarmonyPatch(typeof(Option), "SaveValue", new Type[] { typeof(float) })]
[HarmonyPostfix]
private static void Option_SaveValue_Postfix(Option __instance, float value)
{
if (!(__instance.ID == "LobbyDistance"))
{
return;
}
string text = Mathf.RoundToInt(value) switch
{
0 => "Close",
1 => "Medium",
2 => "Far",
3 => "Worldwide",
_ => "Unknown",
};
Transform val = ((Component)__instance).transform.Find("Num");
if ((Object)(object)val != (Object)null)
{
TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)component).text = text;
}
}
}
}
namespace MultiplayerRegionBypass
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "MultiplayerRegionBypass";
public const string PLUGIN_NAME = "MultiplayerRegionBypass";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}