using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using ILMSN;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Utilities;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("no more ruining steam OR oculus names!")]
[assembly: AssemblyDescription("no more ruining steam OR oculus names!")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("iLikeMyAccountName")]
[assembly: AssemblyCopyright("Created by elmish")]
[assembly: AssemblyTrademark(null)]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: MelonInfo(typeof(ILMSNClass), "iLikeMyAccountName", "1.0.0", "elmish", null)]
[assembly: MelonColor]
[assembly: MelonGame(null, null)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ILMSN;
public static class BuildInfo
{
public const string Name = "iLikeMyAccountName";
public const string Description = "no more ruining steam OR oculus names!";
public const string Author = "elmish";
public const string Company = null;
public const string Version = "1.0.0";
public const string DownloadLink = null;
}
public class ILMSNClass : MelonMod
{
private static string username = "";
private MelonPreferences_Category SteamNameCategory;
private MelonPreferences_Entry<string> UserNameEntry;
private static bool initialized;
public override void OnInitializeMelon()
{
((MelonBase)this).OnInitializeMelon();
SteamNameCategory = MelonPreferences.CreateCategory("Display Name");
UserNameEntry = SteamNameCategory.CreateEntry<string>("name", "", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
SteamNameCategory.SetFilePath("UserData/customName.cfg");
SteamNameCategory.SaveToFile(true);
username = UserNameEntry.Value;
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
if (sceneName == "Gym" && !initialized)
{
MelonCoroutines.Start(changeName(username.Length <= 48 && username.Length > 1));
initialized = true;
}
}
private static IEnumerator changeName(bool changeName)
{
if (!changeName)
{
yield break;
}
while (true)
{
PlayerManager instance = Singleton<PlayerManager>.Instance;
object obj;
if (instance == null)
{
obj = null;
}
else
{
Player localPlayer = instance.localPlayer;
if (localPlayer == null)
{
obj = null;
}
else
{
PlayerData data = localPlayer.Data;
if (data == null)
{
obj = null;
}
else
{
GeneralData generalData = data.GeneralData;
obj = ((generalData != null) ? generalData.PublicUsername : null);
}
}
}
if (obj != null)
{
break;
}
yield return (object)new WaitForFixedUpdate();
}
Singleton<PlayerManager>.Instance.localPlayer.Data.GeneralData.PublicUsername = username;
}
}