using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using FrooxEngine;
using HarmonyLib;
using Steamworks;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")]
[assembly: AssemblyCompany("Dante, Gyztor Mizirath")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+58c11ddb97fb5dbcd1e00030732b6f7b59cf1508")]
[assembly: AssemblyProduct("SteamRecentUsers")]
[assembly: AssemblyTitle("SteamRecentUsers")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Gyztor/BepisSteamRecentUsers")]
[assembly: AssemblyVersion("1.0.3.0")]
[module: RefSafetyRules(11)]
namespace SteamRecentUsers;
[ResonitePlugin("es.dant.SteamRecentUsers", "SteamRecentUsers", "1.0.3", "Dante, Gyztor Mizirath", "https://github.com/Gyztor/BepisSteamRecentUsers")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SteamRecentUsers : BasePlugin
{
[HarmonyPatch(typeof(World), "StartRunning")]
private class World_StartRunning_Patch
{
private static void Postfix(World __instance)
{
__instance.UserJoined += OnUserJoined;
}
}
[StructLayout((LayoutKind)3)]
[CompilerGenerated]
private struct <AddUser>d__3 : IAsyncStateMachine
{
public int <>1__state;
public AsyncTaskMethodBuilder <>t__builder;
public User user;
private global::System.DateTime <t>5__2;
private TaskAwaiter <>u__1;
private void MoveNext()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
try
{
if (num != 0)
{
<t>5__2 = global::System.DateTime.UtcNow;
}
try
{
if (num != 0)
{
goto IL_00a1;
}
TaskAwaiter val = <>u__1;
<>u__1 = default(TaskAwaiter);
num = (<>1__state = -1);
goto IL_009a;
IL_009a:
((TaskAwaiter)(ref val)).GetResult();
goto IL_00a1;
IL_00a1:
SyncVar val2 = default(SyncVar);
ulong num2 = default(ulong);
if (!user.IsPresent)
{
if (!(global::System.DateTime.UtcNow - <t>5__2 > TimeSpan.FromSeconds(90L)))
{
val = global::System.Threading.Tasks.Task.Delay(1000).GetAwaiter();
if (!((TaskAwaiter)(ref val)).IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = val;
((AsyncTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <AddUser>d__3>(ref val, ref this);
return;
}
goto IL_009a;
}
}
else if (!user.MediaMetadataOptOut && user.Metadata.TryGetElement("SteamID", ref val2) && val2.TryGetValue<ulong>(ref num2))
{
SteamFriends.SetPlayedWith(new CSteamID(num2));
}
}
catch (global::System.Exception ex)
{
Log.LogWarning((object)("Error adding user: " + ex.Message));
}
}
catch (global::System.Exception exception)
{
<>1__state = -2;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncTaskMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
[StructLayout((LayoutKind)3)]
[CompilerGenerated]
private struct <OnUserJoined>d__2 : IAsyncStateMachine
{
public int <>1__state;
public AsyncVoidMethodBuilder <>t__builder;
public User user;
private TaskAwaiter <>u__1;
private void MoveNext()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
try
{
TaskAwaiter val;
if (num == 0)
{
val = <>u__1;
<>u__1 = default(TaskAwaiter);
num = (<>1__state = -1);
goto IL_006f;
}
if (!user.IsLocalUser)
{
val = AddUser(user).GetAwaiter();
if (!((TaskAwaiter)(ref val)).IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = val;
((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <OnUserJoined>d__2>(ref val, ref this);
return;
}
goto IL_006f;
}
goto end_IL_0007;
IL_006f:
((TaskAwaiter)(ref val)).GetResult();
end_IL_0007:;
}
catch (global::System.Exception exception)
{
<>1__state = -2;
((AsyncVoidMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
((AsyncVoidMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncVoidMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
internal static ManualLogSource Log;
public override void Load()
{
Log = ((BasePlugin)this).Log;
((BasePlugin)this).HarmonyInstance.PatchAll();
}
[AsyncStateMachine(typeof(<OnUserJoined>d__2))]
public static void OnUserJoined(User user)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<OnUserJoined>d__2 <OnUserJoined>d__ = default(<OnUserJoined>d__2);
<OnUserJoined>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
<OnUserJoined>d__.user = user;
<OnUserJoined>d__.<>1__state = -1;
((AsyncVoidMethodBuilder)(ref <OnUserJoined>d__.<>t__builder)).Start<<OnUserJoined>d__2>(ref <OnUserJoined>d__);
}
[AsyncStateMachine(typeof(<AddUser>d__3))]
public static global::System.Threading.Tasks.Task AddUser(User user)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<AddUser>d__3 <AddUser>d__ = default(<AddUser>d__3);
<AddUser>d__.<>t__builder = AsyncTaskMethodBuilder.Create();
<AddUser>d__.user = user;
<AddUser>d__.<>1__state = -1;
((AsyncTaskMethodBuilder)(ref <AddUser>d__.<>t__builder)).Start<<AddUser>d__3>(ref <AddUser>d__);
return ((AsyncTaskMethodBuilder)(ref <AddUser>d__.<>t__builder)).Task;
}
}
public static class PluginMetadata
{
public const string GUID = "es.dant.SteamRecentUsers";
public const string NAME = "SteamRecentUsers";
public const string VERSION = "1.0.3";
public const string AUTHORS = "Dante, Gyztor Mizirath";
public const string REPOSITORY_URL = "https://github.com/Gyztor/BepisSteamRecentUsers";
}