using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using NameChangerForRepo;
using Photon.Realtime;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "NameChangerForRepo", "1.0.0", "ThirdOne", null)]
[assembly: MelonGame("semiwork", "REPO")]
[assembly: MelonColor(0, 255, 0, 100)]
[assembly: MelonAuthorColor(123, 175, 255, 255)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NameChangerForRepo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NameChangerForRepo")]
[assembly: AssemblyTitle("NameChangerForRepo")]
[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 NameChangerForRepo
{
public class Core : MelonMod
{
public static StreamReader sr = new StreamReader("Mods\\NickNameDefiner.txt");
public static string NewNickName = sr.ReadLine();
public override void OnInitializeMelon()
{
((MelonBase)this).LoggerInstance.Msg("Initialized.");
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class NickNamePatch
{
[HarmonyPostfix]
public static void Postfix(Player __instance)
{
if (__instance == null)
{
MelonLogger.Msg("Attempted to modify NickName on a null instance!");
return;
}
MelonLogger.Msg("Modifying NickName for player instance.");
string nickName = __instance.NickName;
if (__instance.IsLocal)
{
MelonLogger.Msg("Local player detected. Current NickName: " + nickName);
if (!string.IsNullOrEmpty(nickName) && !nickName.Contains(Core.NewNickName))
{
MelonLogger.Msg("Changing NickName from '" + nickName + "' to '" + Core.NewNickName + "'");
__instance.NickName = Core.NewNickName;
MelonLogger.Msg("New NickName set: " + __instance.NickName);
}
else
{
MelonLogger.Msg("NickName already contains the new value or is empty.");
}
}
else
{
MelonLogger.Msg("Player instance is not local.");
}
}
}
}