Decompiled source of StraftatNameOverride v1.0.0

plugins/CustomNameMod/StrafTatNameMod.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using ComputerysModdingUtilities;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: StraftatMod(true)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("StrafTatNameMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StrafTatNameMod")]
[assembly: AssemblyTitle("StrafTatNameMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StrafTatMods;

[BepInPlugin("com.yourname.straftat.nameoverride", "STRAFTAT Name Override", "1.0.0")]
public class StrafNameMod : BaseUnityPlugin
{
	public static string CustomName;

	private void Awake()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		CustomName = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "PlayerName", "YourCustomName", "Overrides your Steam display name in-game.").Value;
		new Harmony("com.yourname.straftat.nameoverride").PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)("STRAFTAT Name Override loaded. Using name: " + CustomName));
	}
}
[HarmonyPatch]
public static class Patch_SteamName
{
	private static MethodBase TargetMethod()
	{
		return AccessTools.Method("Steamworks.SteamFriends:GetPersonaName", (Type[])null, (Type[])null);
	}

	private static bool Prefix(ref string __result)
	{
		__result = StrafNameMod.CustomName;
		return false;
	}
}