using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Map_Instance_Hider;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MelonLoad), "Map Instance Hider", "1.0.1", "Lilly's PC", null)]
[assembly: MelonGame("KisSoft", "ATLYSS")]
[assembly: MelonOptionalDependencies(new string[] { "BepInEx" })]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Map_Instance_Hider")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d5827827b09a37199d0ddd9250b3a7b3caee7d1f")]
[assembly: AssemblyProduct("Map_Instance_Hider")]
[assembly: AssemblyTitle("Map_Instance_Hider")]
[assembly: NeutralResourcesLanguage("en-US")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Map_Instance_Hider
{
[BepInPlugin("d5c377bb-e7f5-454a-ae86-9d409a0f2685", "Lilly's Map Instance Hider", "1.0.1")]
public class Bepin : BaseUnityPlugin
{
private Instance_Hider_Core core;
private void Awake()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
if (!((Object)(object)Instance_Hider_Core.Hider_Instance != (Object)null))
{
GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3));
((Object)val).hideFlags = (HideFlags)61;
core = val.AddComponent<Instance_Hider_Core>();
core.Logger = logger;
((Object)val).name = "Map Instance Hider";
Harmony val2 = new Harmony("Lilly's Map Instance Hider");
val2.PatchAll();
}
}
public bool logger(string mesg)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)(mesg ?? ""));
return true;
}
}
public class Instance_Hider_Core : MonoBehaviour
{
[HarmonyPatch(typeof(Player), "Handle_ServerParameters")]
public static class RandomizeMapName
{
private static void Postfix(ref Player __instance)
{
if (__instance.Network_mapName == "")
{
return;
}
if (((NetworkBehaviour)__instance).isLocalPlayer)
{
if (!((NetworkBehaviour)__instance).isServer)
{
Hider_Instance.isServer = false;
return;
}
Hider_Instance.isServer = true;
}
if (!Hider_Instance.isServer)
{
return;
}
try
{
if (Hider_Instance.maps.ContainsKey(__instance.Network_mapName))
{
__instance.Network_mapName = Hider_Instance.maps[__instance.Network_mapName];
return;
}
string network_mapName = __instance.Network_mapName;
List<char> list = __instance.Network_mapName.ToList();
List<char> list2 = new List<char>();
for (int i = 0; i < 10; i++)
{
list2.Add((char)Random.Range(33, 126));
}
__instance.Network_mapName = new string(list2.ToArray());
Hider_Instance.maps.Add(network_mapName, new string(list2.ToArray()));
}
catch (Exception ex)
{
Hider_Instance.Logger(ex.Message);
}
}
}
public static Instance_Hider_Core Hider_Instance;
public Func<string, bool> Logger;
public Dictionary<string, string> maps = new Dictionary<string, string>();
public bool isServer = false;
private float timer = 1f;
public void Start()
{
Hider_Instance = this;
}
public void Update()
{
timer -= Time.deltaTime;
if (timer < 0f)
{
Logger("regen");
maps.Clear();
timer = 1f;
}
}
}
public class MelonLoad : MelonMod
{
private Instance_Hider_Core core;
public override void OnInitializeMelon()
{
if (!((Object)(object)Instance_Hider_Core.Hider_Instance != (Object)null))
{
GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3));
((Object)val).hideFlags = (HideFlags)61;
core = val.AddComponent<Instance_Hider_Core>();
((Object)val).name = "Map Instance Hider";
core.Logger = logger;
}
}
public bool logger(string msg)
{
MelonLogger.Msg(msg);
return true;
}
}
}