using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("OreoM.VLog")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("3.0.10.0")] [assembly: AssemblyInformationalVersion("3.0.10+0af3e8033c5d2d8f5cd308e21a0050270ba2664c")] [assembly: AssemblyProduct("VLog")] [assembly: AssemblyTitle("OreoM.VLog")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.10.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.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 VLog { internal class CustomLogger : ILogListener, IDisposable, ILogHandler { private StreamWriter logWriter; private DateTime time = DateTime.Now; public CustomLogger(string sessionHash) { string text = Application.persistentDataPath + "\\VLogs"; string destFileName = text + "\\Player_" + time.ToString("yyyy-MM-dd_HH-mm-ss") + "_" + sessionHash + ".log"; Directory.CreateDirectory(text); File.Copy(Application.persistentDataPath + "\\Player.log", destFileName); logWriter = new StreamWriter(text + "\\Player_" + time.ToString("yyyy-MM-dd_HH-mm-ss") + "_" + sessionHash + ".log", append: true) { AutoFlush = true }; } public void LogEvent(object sender, LogEventArgs args) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) logWriter.WriteLine($"[{args.Level}] {args.Source.SourceName}: {args.Data}"); } public void LogUnity(string log, string stackTrace, LogType type) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) logWriter.WriteLine($"{type}: {log}\n{stackTrace}"); } public void LogFormat(LogType logType, Object context, string format, params object[] args) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) logWriter.WriteLine($"{logType}: {string.Format(format, args)}"); } public void LogException(Exception exception, Object context) { logWriter.WriteLine($"Exception: {exception}"); } public void Dispose() { logWriter?.Dispose(); } } [BepInPlugin("OreoM.VLog", "VLog", "3.0.10")] public class VLog : BaseUnityPlugin { public static bool isSessionValid = false; public static string sessionHash = ""; internal static GameObject sessionHashHUDGO = null; internal static TextMeshProUGUI sessionHashHUD = null; internal static int counter = 0; private static CustomLogger vlogger = null; private bool isModded; private HashSet allowedVanillaMods = new HashSet { "chboo1.lethalcompany.hqfixes", "com.adibtw.loadstone", "com.fumiko.CullFactory", "com.github.tinyhoot.ShipLoot", "com.rune580.LethalCompanyInputUtils", "LCBetterSaves", "LightsOut", "mrov.LightsOut", "MrovLib", "mattymatty.TooManyItems", "MoreItems", "OreoM.HQoL.73", "OreoM.HQoL.72", "OreoM.VLog", "OreoM.ShipLootCruiser", "LethalRebinding", "ArlenFreii.40Arachnophobia", "quackandcheese.togglemute", "viviko.NoSellLimit", "Zaggy1024.PathfindingLib", "Zaggy1024.PathfindingLagFix", "SlushyRH.LethalCompany.FreeMoons", "com.github.zehsteam.StreamOverlays", "com.github.zehsteam.SellMyScrap", "com.github.zehsteam.SellMyScrap.v40-v72", "lekakid.lcfontpatcher", ".LCMaxSoundsFix", "MysticDEV.BetterCruiserSync", "LethalSpongeLegacy", "hlb.V73dcfix", "dev.timmywastor.overworkedUI", "OreoM.StatsTracker" }; private HashSet allowedModdedMods = new HashSet { "atomic.terminalapi", "Drinkable.BrutalCompanyMinus", "LethalNetworkAPI", "AudioKnight.StarlancerAIFix", "bauyrsaq.SynthesisAssembly", "evaisa.lethallib", "MaxWasUnavailable.LethalModDataLib", "imabatby.lethallevelloader", "CompanyCruiserFix", "DerelictMoonPlugin", "imabatby.lethaltoolbox", "JacobG5.JLL", "JacobG5.JLLItemModule", "JacobG5.WesleyMoonScripts", "ShowMoonPriceLLL", "Tomatobird.BluranceTerrainFix", "ViewExtension", "Yorimor.CustomStoryLogs", "Chaos.LCCutscene", "com.github.WhiteSpike.MoonDaySpeedMultiplierPatcher", "dev.ladyalice.dungenplus", "dev.ladyalice.dungenplus.loadstonepatch", "JacobG5.ReverbTriggerFix", "JacobG5.WesleyMoons", "LethalPerformance", "MW.MagicWesleyInteriors", "voxx.TerraMesh", "ScienceBird.UniversalRadar", "Tomatobird.BCMHQModule", "Tomatobird.ClassicMoonsHQModule", "Tomatobird.WesleysMoonsHQModule", "Tomatobird.DerelictFix", "Tomatobird.LertzFix", "Tomatobird.TandrausFix", "mrov.WeatherRegistry", "Sniper1_1.WaterAssetRestorer", "stormytuna.EclipseOnly", "JacobG5.DestroyItemInSlotFix", "Sniper1_1.MaterialAssetRestorerCore" }; public static VLog Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); Logger.LogInfo((object)"OreoM.VLog v3.0.10 has loaded!"); } private void OnDestroy() { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown HashSet merged = new HashSet(allowedVanillaMods); isModded = false; bool flag = Chainloader.PluginInfos.Keys.All((string pluginGuid) => allowedVanillaMods.Contains(pluginGuid)); if (!flag) { merged.UnionWith(allowedModdedMods); isModded = Chainloader.PluginInfos.Keys.All((string pluginGuid) => merged.Contains(pluginGuid)); } if (!flag && !isModded) { Logger.LogInfo((object)"Please make sure you're only using allowed mods.\nVLog detected the following mods: "); foreach (PluginInfo value in Chainloader.PluginInfos.Values) { Logger.LogInfo((object)$"{value.Metadata.GUID} - {value.Metadata.Name} {value.Metadata.Version}"); } } if (!flag && !isModded) { return; } try { Logger.LogInfo((object)("Mods verified!\n" + $"Modded: {isModded}")); sessionHash = XXHash.Hash64(Chainloader.PluginInfos.Keys.Aggregate((string a, string n) => a + n)).ToString("x") + "#" + XXHash.Hash64(DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString()).ToString("x"); isSessionValid = true; vlogger = new CustomLogger(sessionHash); Application.logMessageReceived += new LogCallback(vlogger.LogUnity); Application.logMessageReceivedThreaded += new LogCallback(vlogger.LogUnity); Debug.unityLogger.logHandler = (ILogHandler)(object)vlogger; Logger.Listeners.Clear(); Logger.Listeners.Add((ILogListener)(object)vlogger); } catch (Exception ex) { Debug.LogException(ex); } } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("OreoM.VLog"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "OreoM.VLog"; public const string PLUGIN_NAME = "VLog"; public const string PLUGIN_VERSION = "3.0.10"; } } namespace VLog.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(HUDManager __instance) { //IL_0062: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) if (VLog.isSessionValid) { VLog.sessionHashHUDGO = Object.Instantiate(((Component)__instance.debugText).gameObject, __instance.HUDContainer.transform); VLog.sessionHashHUD = VLog.sessionHashHUDGO.GetComponent(); Vector2 val = ((GameNetworkManager.Instance.gameVersionNum >= 81) ? new Vector2(-0.044f, -0.03f) : new Vector2(0.02f, 0.03f)); ((TMP_Text)VLog.sessionHashHUD).transform.localScale = ((GameNetworkManager.Instance.gameVersionNum >= 81) ? new Vector3(1.11f, 1.11f, 1.11f) : new Vector3(1f, 1f, 1f)); ((TMP_Text)VLog.sessionHashHUD).rectTransform.pivot = val; RectTransform rectTransform = ((TMP_Text)VLog.sessionHashHUD).rectTransform; Vector2 anchorMin = (((TMP_Text)VLog.sessionHashHUD).rectTransform.anchorMax = val); rectTransform.anchorMin = anchorMin; ((TMP_Text)VLog.sessionHashHUD).rectTransform.anchoredPosition = Vector2.zero; ((TMP_Text)VLog.sessionHashHUD).alignment = (TextAlignmentOptions)1025; ((TMP_Text)VLog.sessionHashHUD).font = ((TMP_Text)__instance.newProfitQuotaText).font; ((TMP_Text)VLog.sessionHashHUD).fontSize = 10f; ((Graphic)VLog.sessionHashHUD).color = new Color(1f, 1f, 1f, 0.15f); ((TMP_Text)VLog.sessionHashHUD).text = VLog.sessionHash + "#" + ++VLog.counter; ((Behaviour)VLog.sessionHashHUD).enabled = true; } } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatches { private static void DisplayMenuNotificationMixedCall(MenuManager Instance, string notificationText, string buttonText) { Type typeFromHandle = typeof(MenuManager); MethodInfo method = typeFromHandle.GetMethod("DisplayMenuNotification", new Type[3] { typeof(string), typeof(string), typeof(bool) }); if (method != null) { method.Invoke(Instance, new object[3] { notificationText, buttonText, true }); return; } MethodInfo method2 = typeFromHandle.GetMethod("DisplayMenuNotification", new Type[2] { typeof(string), typeof(string) }); if (method2 != null) { method2.Invoke(Instance, new object[2] { notificationText, buttonText }); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void PostStart(MenuManager __instance) { if (VLog.isSessionValid) { ((TMP_Text)__instance.versionNumberText).autoSizeTextContainer = true; TextMeshProUGUI versionNumberText = __instance.versionNumberText; ((TMP_Text)versionNumberText).text = ((TMP_Text)versionNumberText).text + "(" + VLog.sessionHash + ")"; } else { DisplayMenuNotificationMixedCall(__instance, "Mods not on the allowed list detected, runs performed on this session won't be accepted.", "[ Back ]"); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }