using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("2025.1.2")]
[assembly: AssemblyInformationalVersion("2025.1.2")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("2025.1.2.0")]
[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;
}
}
}
internal class ManifestInfo
{
internal const string TSName = "FlashlightSyncFixMaybeHopefully";
internal const string TSDescription = "Should hopefully fix some of the flashlight syncing issues, maybe.";
internal const string TSVersion = "2025.1.2";
internal const string TSAuthor = "AuriRex";
internal const string TSWebsite = "https://github.com/AuriRex/GTFO_FlashlightSyncFixMaybeHopefully";
}
namespace FlashlightSyncFixMaybeHopefully
{
[HarmonyPatch(typeof(PlayerSync), "WantsToSetFlashlightEnabled")]
[HarmonyPriority(0)]
public class PlayerSync__WantsToSetFlashlightEnabled__Patch
{
private static int _frameCount;
public static bool Prefix(PlayerSync __instance, bool enable, bool broadcastOnly)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
int frameCount = Time.frameCount;
if (_frameCount == frameCount)
{
return false;
}
_frameCount = frameCount;
pInventoryStatus val = default(pInventoryStatus);
val.wieldedSlot = __instance.m_agent.Inventory.WieldedSlot;
val.toolEnabled = enable;
pInventoryStatus val2 = val;
__instance.m_inventoryStatusPacket.Send(val2, (SNet_ChannelType)2, (SNet_SendQuality)2, (SNet_Player)null);
if (!broadcastOnly)
{
__instance.SyncInventoryStatus(val2);
}
return false;
}
}
[BepInPlugin("dev.AuriRex.gtfo.FlashlightSyncFixMaybeHopefully", "FlashlightSyncFixMaybeHopefully", "2025.1.2")]
public class Plugin : BasePlugin
{
public const string GUID = "dev.AuriRex.gtfo.FlashlightSyncFixMaybeHopefully";
public const string MOD_NAME = "FlashlightSyncFixMaybeHopefully";
public const string VERSION = "2025.1.2";
internal static ManualLogSource L;
private static readonly Harmony _harmony = new Harmony("dev.AuriRex.gtfo.FlashlightSyncFixMaybeHopefully");
public override void Load()
{
L = ((BasePlugin)this).Log;
_harmony.PatchAll(Assembly.GetExecutingAssembly());
L.LogInfo((object)"Plugin loaded!");
}
}
}