using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CullingSystem; using GTFO.API; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using LG.EXT.Comps; using Microsoft.CodeAnalysis; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LG.EXT")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LG.EXT")] [assembly: AssemblyTitle("LG.EXT")] [assembly: TargetPlatform("Windows7.0")] [assembly: SupportedOSPlatform("Windows7.0")] [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] internal sealed class IsUnmanagedAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } [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 LG.EXT { [BepInPlugin("LG.EXT.GUID", "LG.EXT", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class EntryPoint : BasePlugin { private Harmony _Harmony; public override void Load() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); _Harmony = new Harmony("LG.EXT.Harmony"); _Harmony.PatchAll(); } public override bool Unload() { _Harmony.UnpatchSelf(); return ((BasePlugin)this).Unload(); } } internal static class Logger { private static readonly ManualLogSource _Logger; static Logger() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _Logger = new ManualLogSource("LG.EXT"); Logger.Sources.Add((ILogSource)(object)_Logger); } private static string Format(object msg) { return msg.ToString(); } public static void Info(BepInExInfoLogInterpolatedStringHandler handler) { _Logger.LogInfo(handler); } public static void Info(string str) { _Logger.LogMessage((object)str); } public static void Info(object data) { _Logger.LogMessage((object)Format(data)); } public static void Debug(BepInExDebugLogInterpolatedStringHandler handler) { _Logger.LogDebug(handler); } public static void Debug(string str) { _Logger.LogDebug((object)str); } public static void Debug(object data) { _Logger.LogDebug((object)Format(data)); } public static void Error(BepInExErrorLogInterpolatedStringHandler handler) { _Logger.LogError(handler); } public static void Error(string str) { _Logger.LogError((object)str); } public static void Error(object data) { _Logger.LogError((object)Format(data)); } public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler) { _Logger.LogFatal(handler); } public static void Fatal(string str) { _Logger.LogFatal((object)str); } public static void Fatal(object data) { _Logger.LogFatal((object)Format(data)); } public static void Warn(BepInExWarningLogInterpolatedStringHandler handler) { _Logger.LogWarning(handler); } public static void Warn(string str) { _Logger.LogWarning((object)str); } public static void Warn(object data) { _Logger.LogWarning((object)Format(data)); } [Conditional("DEBUG")] public static void DebugOnly(object data) { } } [GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")] [CompilerGenerated] internal static class VersionInfo { public const string RootNamespace = "LG.EXT"; public const string Version = "1.0.0"; public const string VersionPrerelease = null; public const string VersionMetadata = null; public const string SemVer = "1.0.0"; public const string GitRevShort = null; public const string GitRevLong = null; public const string GitBranch = null; public const string GitTag = null; public const int GitCommitsSinceTag = 0; public const bool GitIsDirty = false; } } namespace LG.EXT.Patches { [HarmonyPatch(typeof(C_Light), "Setup")] internal static class Patch_C_Light { private static void Prefix(Light light, C_Light __instance, ref bool isStatic) { if (isStatic) { LG_DynamicLight component = ((Component)light).GetComponent(); if ((Object)(object)component != (Object)null) { component.CullLight = __instance; isStatic = false; } } } } } namespace LG.EXT.Net { public abstract class NetVar { } public abstract class NetVar : NetVar where T : unmanaged { public static readonly int PayloadCapacity = Marshal.SizeOf(); internal T _Value; public abstract NetVarLifeTime LifeTime { get; } public abstract bool CanClientRequestChange { get; } public T Value { get { return _Value; } set { if (!SNet.IsMaster && CanClientRequestChange) { _Value = value; NetworkAPI.InvokeFreeSizedEvent("NLiNV", Array.Empty(), (SNet_ChannelType)2); } else { if (!SNet.IsMaster) { return; } _Value = value; using MemoryStream memoryStream = new MemoryStream(PayloadCapacity + 1); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write((byte)2); WriteValue(binaryWriter, _Value); NetworkAPI.InvokeFreeSizedEvent("NLiNV", memoryStream.GetBuffer(), (SNet_ChannelType)2); } } } public NetVar(T initialValue) { _Value = initialValue; } protected virtual void OnChanged(T oldState, T newState, bool isRecall) { } private unsafe T ReadValue(BinaryReader reader) { Span buffer = stackalloc byte[PayloadCapacity]; reader.Read(buffer); fixed (byte* ptr = buffer) { return Marshal.PtrToStructure((IntPtr)ptr); } } private unsafe void WriteValue(BinaryWriter stream, T value) { Span span = stackalloc byte[PayloadCapacity]; fixed (byte* ptr = span) { Marshal.StructureToPtr(value, (IntPtr)ptr, fDeleteOld: false); stream.Write(span); } } } public record NetVarChangedEventArg { public bool IsRecall { get; init; } } public enum NetVarLifeTime { PerLobby, PerLevel } internal enum NetVarEventType : byte { ToMaster_Created, ToMaster_RequestChange, ToClient_Sync, ToClient_Sync_Recall } internal static class NetVarRegistry { public const string EVENTNAME = "NLiNV"; public const int EventTypeMaxValue = 8; public const int TypeIdMaxValue = 8192; private static readonly Dictionary _InLobbyReg = new Dictionary(); private static readonly Dictionary _InLevelReg = new Dictionary(); public static void Init() { NetworkAPI.RegisterFreeSizedEvent("NLiNV", (Action)OnReceiveEvent); } private static void OnReceiveEvent(ulong sender, byte[] bytes) { using MemoryStream input = new MemoryStream(bytes); using BinaryReader binaryReader = new BinaryReader(input); binaryReader.ReadByte(); } internal static void WriteEventHeader(BinaryWriter writer, NetVarEventType eventType, ushort typeID, ushort instanceID) { if ((int)eventType > 8) { throw new ArgumentOutOfRangeException("eventType", $"Argument is greater than acceptable range (> {8})"); } if (typeID > 8192) { throw new ArgumentOutOfRangeException("typeID", $"Argument is greater than acceptable range (> {8192})"); } ushort num = (ushort)(typeID << 3); num = (ushort)((uint)num | (uint)eventType); writer.Write(num); writer.Write(instanceID); } internal static void ReadEventHeader(BinaryReader reader, out NetVarEventType eventType, out ushort typeID, out ushort instanceID) { ushort num = reader.ReadUInt16(); eventType = (NetVarEventType)(num & 7u); typeID = (ushort)(num >> 3); instanceID = reader.ReadUInt16(); } internal static void SendEvent(byte[] bytes) { NetworkAPI.InvokeFreeSizedEvent("NLiNV", bytes, (SNet_ChannelType)2); } } } namespace LG.EXT.Comps { public sealed class LG_DynamicLight : MonoBehaviour { internal C_Light CullLight; private void Update() { if (((Component)this).transform.hasChanged && CullLight != null) { CullLight.UpdateDynamicLight_FrustumNodeIntersect(); ((Component)this).transform.hasChanged = false; } } } }