Decompiled source of SteamProfileLogger v1.0.0

SteamProfileLogger.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SteamProfileLogger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("SteamProfileLogger")]
[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 SteamProfileLogger
{
	[BepInPlugin("me.mizzmaster.repo.SteamProfileLogger", "Steam Profile Logger", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "me.mizzmaster.repo.SteamProfileLogger";

		internal static ManualLogSource Logger;

		public static ConfigEntry<bool> configCallSetPlayedWith;

		private void Awake()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			configCallSetPlayedWith = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Call_SetPlayedWith", true, "Make Steam record the profiles of people that you have played with. Available at View > Players.");
			Harmony val = new Harmony("me.mizzmaster.repo.SteamProfileLogger");
			val.PatchAll(Assembly.GetExecutingAssembly());
			Logger.LogInfo((object)"Plugin me.mizzmaster.repo.SteamProfileLogger is loaded!");
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "AddToStatsManagerRPC")]
	public class Patcher_PlayerAvatar_AddToStatsManagerRPC
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				if ((Object)(object)player == (Object)(object)PlayerAvatar.instance)
				{
					continue;
				}
				string text = (string)AccessTools.Field(typeof(PlayerAvatar), "playerName").GetValue(player);
				string text2 = (string)AccessTools.Field(typeof(PlayerAvatar), "steamID").GetValue(player);
				if (!string.IsNullOrWhiteSpace(text) && !string.IsNullOrWhiteSpace(text2) && ulong.TryParse(text2, out var result))
				{
					Plugin.Logger.LogInfo((object)("https://steamcommunity.com/profiles/" + text2 + " " + text));
					if (Plugin.configCallSetPlayedWith.Value)
					{
						SteamFriends.SetPlayedWith(SteamId.op_Implicit(result));
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SteamProfileLogger";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}