Decompiled source of SixSeven v0.0.67

SixSeven.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using SixSeven.Interop;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SixSeven")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SixSeven")]
[assembly: AssemblyTitle("SixSeven")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace SixSeven
{
	[RegisterIl2Cpp]
	public class Behaviour67 : MonoBehaviour
	{
		private const float SixSevenIntervalMin = 20f;

		private const float SixSevenIntervalMax = 90f;

		private float _nextSixSevenTime;

		public void Update()
		{
			if (Time.time > _nextSixSevenTime)
			{
				_nextSixSevenTime = Time.time + Random.Range(20f, 90f);
				if (SNet.IsInLobby)
				{
					int num = Random.Range(0, PlayerManager.AlivePlayerAgentsInLevel);
					PlayerAgent val2 = default(PlayerAgent);
					PlayerAgent val = (PlayerManager.TryGetPlayerAgent(ref num, ref val2) ? val2 : null);
					PlayerChatManager.WantToSentTextMessage(PlayerManager.GetLocalPlayerAgent(), "67", (val == null || ((Agent)val).IsLocallyOwned) ? null : val);
				}
			}
		}
	}
	internal static class Logger
	{
		private static ManualLogSource _mLogSource;

		public static bool Ready => _mLogSource != null;

		public static void Setup()
		{
			_mLogSource = Logger.CreateLogSource("com.67.67");
		}

		public static void SetupFromInit(ManualLogSource logSource)
		{
			_mLogSource = logSource;
		}

		private static string Format(object data)
		{
			return data.ToString();
		}

		public static void Debug(object msg)
		{
			_mLogSource.LogDebug((object)Format(msg));
		}

		public static void Debug(string fmt, params object[] args)
		{
			_mLogSource.LogDebug((object)Format(string.Format(fmt, args)));
		}

		public static void Info(object msg)
		{
			_mLogSource.LogInfo((object)Format(msg));
		}

		public static void Info(string fmt, params object[] args)
		{
			_mLogSource.LogInfo((object)Format(string.Format(fmt, args)));
		}

		public static void Warn(object msg)
		{
			_mLogSource.LogWarning((object)Format(msg));
		}

		public static void Warn(string fmt, params object[] args)
		{
			_mLogSource.LogWarning((object)Format(string.Format(fmt, args)));
		}

		public static void Error(object msg)
		{
			_mLogSource.LogError((object)Format(msg));
		}

		public static void Error(string fmt, params object[] args)
		{
			_mLogSource.LogError((object)Format(string.Format(fmt, args)));
		}

		public static void Fatal(object msg)
		{
			_mLogSource.LogFatal((object)Format(msg));
		}

		public static void Fatal(string fmt, params object[] args)
		{
			_mLogSource.LogFatal((object)Format(string.Format(fmt, args)));
		}
	}
	[BepInPlugin("com.67.67", "67", "0.0.67")]
	public class Plugin : BasePlugin
	{
		public const string NAME = "67";

		public const string GUID = "com.67.67";

		public const string VERSION = "0.0.67";

		public static GameObject? PluginObject;

		public event Action? OnManagersSetup;

		public override void Load()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			Logger.Setup();
			Logger.Info("67 [com.67.67 @ 0.0.67]");
			Harmony val = new Harmony("com.67.67");
			RegisterIl2CppTypes();
			OnManagersSetup += Initialize;
			Global.OnAllManagersSetup += Action.op_Implicit(this.OnManagersSetup);
			ApplyPatches(val);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void ApplyPatches(Harmony h)
		{
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void ApplyPatchIfLoaded<T>(Harmony h, string guid)
		{
			if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey(guid))
			{
				ApplyPatch<T>(h);
				Logger.Info("Applied compat patches for plugin with GUID " + guid + ".");
			}
			else
			{
				Logger.Info("Plugin with GUID " + guid + " not found, skipping compat patches for it.");
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void ApplyPatch<T>(Harmony h)
		{
			h.PatchAll(typeof(T));
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void RegisterIl2CppTypes()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			foreach (Type type in types)
			{
				if (type.GetCustomAttribute<RegisterIl2CppAttribute>() != null)
				{
					ClassInjector.RegisterTypeInIl2Cpp(type);
				}
			}
		}

		private void Initialize()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			Logger.Debug("Initializing...");
			PluginObject = new GameObject("com.67.67");
			Object.DontDestroyOnLoad((Object)(object)PluginObject);
			PluginObject.AddComponent<Behaviour67>();
		}
	}
}
namespace SixSeven.Interop
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false)]
	public class RegisterIl2CppAttribute : Attribute
	{
	}
}