using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("last")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: AssemblyInformationalVersion("4.0.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("last")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.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 App4
{
public class Patch
{
[HarmonyPatch(typeof(SemiFunc))]
public static class Patch1
{
[HarmonyPrefix]
[HarmonyPatch("PlayerGetName")]
public static bool changename(ref string __result, ref PlayerAvatar player)
{
__result = Plugin.StartingName.Value;
return false;
}
}
}
[BepInPlugin("NameChangeREPO", "NameChanger", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ConfigEntry<string> StartingName;
internal static ManualLogSource Logger;
private FileSystemWatcher _configWatcher;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
StartingName = ((BaseUnityPlugin)this).Config.Bind<string>("User", "Name", "User", new ConfigDescription("Changes Only Save In Lobby\nNo ingameMenu but when you update the config it updates in game without restarting\n you can also use html tags with names", (AcceptableValueBase)null, Array.Empty<object>()));
_configWatcher = new FileSystemWatcher(Path.GetDirectoryName(((BaseUnityPlugin)this).Config.ConfigFilePath), Path.GetFileName(((BaseUnityPlugin)this).Config.ConfigFilePath));
_configWatcher.NotifyFilter = NotifyFilters.LastWrite;
_configWatcher.EnableRaisingEvents = true;
_configWatcher.Changed += delegate
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
Thread.Sleep(1000);
((BaseUnityPlugin)this).Config.Reload();
Thread.Sleep(1000);
if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu || (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobby)
{
AddToStatsManager();
PlayerController.instance.PlayerSetName(StartingName.Value, SteamClient.SteamId.Value.ToString());
}
};
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin last is loaded!");
new Harmony("NameChangerPatch").PatchAll();
}
private void AddToStatsManager()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
string text = SemiFunc.PlayerGetName(PlayerAvatar.instance);
string text2 = SteamClient.SteamId.Value.ToString();
if (GameManager.Multiplayer() && GameManager.instance.localTest)
{
int num = 0;
Player[] playerList = PhotonNetwork.PlayerList;
foreach (Player val in playerList)
{
if (val.IsLocal)
{
text = text + " " + num;
text2 += num;
}
num++;
}
}
if (GameManager.Multiplayer())
{
if (PlayerAvatar.instance.photonView.IsMine)
{
PlayerAvatar.instance.photonView.RPC("AddToStatsManagerRPC", (RpcTarget)3, new object[2] { text, text2 });
}
}
else
{
PlayerAvatar.instance.AddToStatsManagerRPC(text, text2);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "last";
public const string PLUGIN_NAME = "My first plugin";
public const string PLUGIN_VERSION = "4.0.0.0";
}
}