using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AllowAnyNames")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2fcc9e59149d007618d0d62e62244ba2ab702e33")]
[assembly: AssemblyProduct("AllowAnyNames")]
[assembly: AssemblyTitle("AllowAnyNames")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 Marioalexsan.AllowAnyNames
{
[BepInPlugin("Marioalexsan.AllowAnyNames", "AllowAnyNames", "1.0.0")]
public class AllowAnyNamesMod : BaseUnityPlugin
{
private Harmony _harmony;
private void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
_harmony = new Harmony("Marioalexsan.AllowAnyNames");
_harmony.PatchAll();
Debug.Log((object)"Hello from Marioalexsan.AllowAnyNames!");
}
}
}
namespace Marioalexsan.AllowAnyNames.HarmonyPatches
{
[HarmonyPatch(typeof(Player), "Handle_ServerConditions")]
internal static class Player_Handle_NicknameParams
{
private static void Throw(string reason)
{
throw new Exception("Failed to transpile Assign_PlayerStats, please notify the mod developer about it! Reason: " + reason);
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
MethodInfo methodInfo = AccessTools.GetDeclaredMethods(typeof(Player)).FirstOrDefault((MethodInfo x) => x.Name.Contains("Handle_NicknameParams"));
if (methodInfo == null)
{
Throw("Failed to find method.");
}
CodeMatcher val = new CodeMatcher(code, (ILGenerator)null);
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)methodInfo, (string)null)
});
if (val.IsInvalid)
{
Throw("Failed to find method.");
}
int pos = val.Pos;
val.InstructionAt(2).labels = new List<Label>(val.InstructionAt(0).labels);
val.InstructionAt(0).labels.Clear();
val.RemoveInstructionsInRange(pos, pos + 1);
return val.InstructionEnumeration();
}
}
[HarmonyPatch(typeof(ProfileDataSender), "Assign_PlayerStats")]
internal static class ProfileDataSender_Assign_PlayerStats
{
private static void Throw(string reason)
{
throw new Exception("Failed to transpile Assign_PlayerStats, please notify the mod developer about it! Reason: " + reason);
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(code, (ILGenerator)null);
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(string), "IsNullOrWhiteSpace", (Type[])null, (Type[])null), (string)null)
});
if (val.IsInvalid)
{
Throw("Failed to find start.");
}
int pos = val.Advance(-1).Pos;
if (!CodeInstructionExtensions.IsLdarg(val.Instruction, (int?)null) && !CodeInstructionExtensions.IsLdloc(val.Instruction, (LocalBuilder)null))
{
Throw("Failed to find load arg/loc for start.");
}
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ins) => ins.opcode == OpCodes.Ldstr && ins.operand != null && ins.operand.GetType() == typeof(string) && string.Equals((string)ins.operand, "Null", StringComparison.InvariantCultureIgnoreCase)), (string)null)
});
if (val.IsInvalid)
{
Throw("Failed to find end.");
}
int pos2 = val.Advance(1).Pos;
if (!CodeInstructionExtensions.IsStarg(val.Instruction, (int?)null) && !CodeInstructionExtensions.IsStloc(val.Instruction, (LocalBuilder)null))
{
Throw("Failed to find store arg/loc for end.");
}
val.RemoveInstructionsInRange(pos, pos2);
return val.InstructionEnumeration();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}