using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
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: AssemblyCompany("EnhancedTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Enhanced tweaks for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EnhancedTweaks")]
[assembly: AssemblyTitle("EnhancedTweaks")]
[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]
[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 EnhancedTweaks
{
internal enum HorizontalPositions
{
Left,
Center,
Right,
CustomRelative,
CustomAbsolute
}
internal enum VerticalPositions
{
Top,
Center,
Bottom,
CustomRelative,
CustomAbsolute
}
[BepInPlugin("EnhancedTweaks", "EnhancedTweaks", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private readonly Harmony _harmony = new Harmony("EnhancedTweaks");
internal static ConfigEntry<int> newQuotaRackupDuration;
internal static ConfigEntry<bool> showSeedNumber;
internal static ConfigEntry<bool> showSeedNumberOnCompanyMoon;
internal static ConfigEntry<float> seedNumberFontSize;
internal static ConfigEntry<int> seedNumberColorRed;
internal static ConfigEntry<int> seedNumberColorGreen;
internal static ConfigEntry<int> seedNumberColorBlue;
internal static ConfigEntry<int> seedNumberColorAlpha;
internal static ConfigEntry<HorizontalPositions> seedNumberHorizontalPosition;
internal static ConfigEntry<VerticalPositions> seedNumberVerticalPosition;
internal static ConfigEntry<float> seedNumberCustomHorizontalPosition;
internal static ConfigEntry<float> seedNumberCustomVerticalPosition;
private void Awake()
{
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Plugin EnhancedTweaks is loaded!");
newQuotaRackupDuration = ((BaseUnityPlugin)this).Config.Bind<int>("Quota", "New quota rack up duration", 5, "Length of time in seconds of how long to rack up new quota. Set to zero for instantly racking up.");
showSeedNumber = ((BaseUnityPlugin)this).Config.Bind<bool>("Seed Number", "Show seed number", true, "If enabled, will show the random map seed number at a position of your choice.");
showSeedNumberOnCompanyMoon = ((BaseUnityPlugin)this).Config.Bind<bool>("Seed Number", "Show seed number on company moon", false, "If \"Show seed number\" is enabled, this option will show the random map seed number on the company moon in addition to the regular moons.");
seedNumberFontSize = ((BaseUnityPlugin)this).Config.Bind<float>("Seed Number", "Seed number font size", 14f, "The point font size for the seed number relative to a 1080p resolution.");
seedNumberColorRed = ((BaseUnityPlugin)this).Config.Bind<int>("Seed Number", "Red color component for seed number (0-255)", 0, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
seedNumberColorGreen = ((BaseUnityPlugin)this).Config.Bind<int>("Seed Number", "Green color component for seed number (0-255)", 0, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
seedNumberColorBlue = ((BaseUnityPlugin)this).Config.Bind<int>("Seed Number", "Blue color component for seed number (0-255)", 0, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
seedNumberColorAlpha = ((BaseUnityPlugin)this).Config.Bind<int>("Seed Number", "Alpha color component for seed number (0-255)", 127, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
seedNumberHorizontalPosition = ((BaseUnityPlugin)this).Config.Bind<HorizontalPositions>("Seed Number", "Horizontal position of seed number", HorizontalPositions.Left, "CustomRelative and CustomAbsolute will use the custom values configured below rather than the presets. CustomRelative means 0.0 will be the center of the screen, 1.0 will be the right edge of the screen, and -1.0 will be left edge of the screen. CustomAbsolute position will be the position in screen pixels with the origin at the center and positive going to the right.");
seedNumberVerticalPosition = ((BaseUnityPlugin)this).Config.Bind<VerticalPositions>("Seed Number", "Vertical position of seed number", VerticalPositions.Bottom, "CustomRelative and CustomAbsolute will use the custom values configured below rather than the presets. CustomRelative means 0.0 will be the center of the screen, 1.0 will be the top edge of the screen, and -1.0 will be the bottom edge of the screen. CustomAbsolute position will be the position in screen pixels with the origin at the center and positive going to the top.");
seedNumberCustomHorizontalPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Seed Number", "Custom horizontal position of seed number", 0f, "This option is only used if \"Horizontal position of seed number\" option is set to CustomRelative or CustomAbsolute. The center of the seed number text container will be used as the pivot point, so if placing on the edge, adjustments may be needed to place the text fully within the viewable area.");
seedNumberCustomVerticalPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Seed Number", "Custom vertical position of seed number", 0f, "This option is only used if \"Vertical position of seed number\" option is set to CustomRelative or CustomAbsolute. The center of the seed number text container will be used as the pivot point, so if placing on the edge, adjustments may be needed to place the text fully within the viewable area.");
_harmony.PatchAll();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "EnhancedTweaks";
public const string PLUGIN_NAME = "EnhancedTweaks";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace EnhancedTweaks.Patches
{
[HarmonyPatch(typeof(HUDManager))]
internal class HUDManagerPatches
{
internal static GameObject _seedScreenCanvas;
internal static GameObject _seedUI;
internal static TextMeshProUGUI _seedUIText;
internal static Vector2 _prevDisplaySize;
public static void CreateSeedUI(HUDManager __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.showSeedNumber.Value)
{
return;
}
if ((Object)(object)_seedScreenCanvas == (Object)null)
{
_seedScreenCanvas = new GameObject("SeedScreenCanvas");
_seedScreenCanvas.transform.SetParent(((Component)((Graphic)__instance.playerScreenTexture).canvas).transform.parent, false);
_seedScreenCanvas.AddComponent<Canvas>().renderMode = (RenderMode)0;
_seedScreenCanvas.AddComponent<CanvasScaler>();
_seedScreenCanvas.AddComponent<GraphicRaycaster>();
}
if ((Object)(object)_seedUI == (Object)null)
{
_seedUI = new GameObject("MySeedUI");
_seedUI.transform.SetParent(_seedScreenCanvas.transform, false);
}
if ((Object)(object)_seedUIText == (Object)null)
{
_prevDisplaySize = ((Graphic)HUDManager.Instance.playerScreenTexture).canvas.renderingDisplaySize;
float num = 1f;
float num2 = 1.7777778f;
num = ((!(_prevDisplaySize.x / _prevDisplaySize.y > num2)) ? (_prevDisplaySize.x / 1920f) : (_prevDisplaySize.y / 1080f));
string text = "Seed: 99999999";
_seedUIText = _seedUI.AddComponent<TextMeshProUGUI>();
((TMP_Text)_seedUIText).enableWordWrapping = false;
((TMP_Text)_seedUIText).autoSizeTextContainer = true;
((TMP_Text)_seedUIText).font = ((TMP_Text)__instance.weightCounter).font;
((TMP_Text)_seedUIText).faceColor = Color32.op_Implicit(new Color((float)Plugin.seedNumberColorRed.Value / 255f, (float)Plugin.seedNumberColorGreen.Value / 255f, (float)Plugin.seedNumberColorBlue.Value / 255f, (float)Plugin.seedNumberColorAlpha.Value / 255f));
((TMP_Text)_seedUIText).fontSize = Plugin.seedNumberFontSize.Value * 1.3333334f * num;
((TMP_Text)_seedUIText).alignment = (TextAlignmentOptions)514;
((TMP_Text)_seedUIText).text = text;
Vector2 preferredValues = ((TMP_Text)_seedUIText).GetPreferredValues(text);
float num3 = 0f;
float num4 = 0f;
float num5 = _prevDisplaySize.x / 2f;
float num6 = _prevDisplaySize.y / 2f;
if (Plugin.seedNumberHorizontalPosition.Value == HorizontalPositions.Right)
{
num3 = num5;
num3 -= preferredValues.x / 2f;
}
else if (Plugin.seedNumberHorizontalPosition.Value == HorizontalPositions.Left)
{
num3 = 0f - num5;
num3 += preferredValues.x / 2f;
}
else if (Plugin.seedNumberHorizontalPosition.Value == HorizontalPositions.CustomRelative)
{
num3 = Plugin.seedNumberCustomHorizontalPosition.Value * num5;
}
else if (Plugin.seedNumberHorizontalPosition.Value == HorizontalPositions.CustomAbsolute)
{
num3 = Plugin.seedNumberCustomHorizontalPosition.Value;
}
if (Plugin.seedNumberVerticalPosition.Value == VerticalPositions.Top)
{
num4 = num6;
num4 -= preferredValues.y / 2f;
}
else if (Plugin.seedNumberVerticalPosition.Value == VerticalPositions.Bottom)
{
num4 = 0f - num6;
num4 += preferredValues.y / 2f;
}
else if (Plugin.seedNumberVerticalPosition.Value == VerticalPositions.CustomRelative)
{
num4 = Plugin.seedNumberCustomVerticalPosition.Value * num6;
}
else if (Plugin.seedNumberVerticalPosition.Value == VerticalPositions.CustomAbsolute)
{
num4 = Plugin.seedNumberCustomVerticalPosition.Value;
}
((TMP_Text)_seedUIText).transform.localPosition = new Vector3(num3, num4, 0f);
if (StartOfRoundPatches._gameHasStarted && (Plugin.showSeedNumberOnCompanyMoon.Value || !StartOfRound.Instance.currentLevel.PlanetName.Equals("71 Gordion", StringComparison.CurrentCultureIgnoreCase)))
{
((TMP_Text)_seedUIText).text = $"Seed: {StartOfRound.Instance.randomMapSeed}";
((Behaviour)_seedUIText).enabled = true;
}
else
{
((Behaviour)_seedUIText).enabled = false;
}
}
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPatch(HUDManager __instance)
{
if (Plugin.showSeedNumber.Value)
{
CreateSeedUI(__instance);
((Behaviour)_seedUIText).enabled = false;
}
}
[HarmonyPatch("OpenMenu_performed")]
[HarmonyPostfix]
private static void OpenMenu_performedPatch()
{
StartOfRoundPatches.UpdateSeedUISize(StartOfRound.Instance);
}
[HarmonyPatch("PingScan_performed")]
[HarmonyPostfix]
private static void PingScan_performedPatch()
{
StartOfRoundPatches.UpdateSeedUISize(StartOfRound.Instance);
}
[HarmonyTranspiler]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static IEnumerable<CodeInstruction> rackUpNewQuotaTextMoveNext(IEnumerable<CodeInstruction> instructions)
{
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Expected O, but got Unknown
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Expected O, but got Unknown
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Expected O, but got Unknown
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Expected O, but got Unknown
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Expected O, but got Unknown
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Expected O, but got Unknown
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Expected O, but got Unknown
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Expected O, but got Unknown
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Expected O, but got Unknown
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Expected O, but got Unknown
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Expected O, but got Unknown
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Expected O, but got Unknown
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Expected O, but got Unknown
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Expected O, but got Unknown
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Expected O, but got Unknown
//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Expected O, but got Unknown
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Expected O, but got Unknown
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Expected O, but got Unknown
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Expected O, but got Unknown
//IL_0454: Unknown result type (might be due to invalid IL or missing references)
//IL_045a: Expected O, but got Unknown
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_0483: Expected O, but got Unknown
//IL_049d: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Expected O, but got Unknown
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04c1: Expected O, but got Unknown
//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Expected O, but got Unknown
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Expected O, but got Unknown
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Expected O, but got Unknown
//IL_052b: Unknown result type (might be due to invalid IL or missing references)
//IL_0531: Expected O, but got Unknown
//IL_0554: Unknown result type (might be due to invalid IL or missing references)
//IL_055a: Expected O, but got Unknown
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0581: Expected O, but got Unknown
//IL_058f: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Expected O, but got Unknown
//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
//IL_05c9: Expected O, but got Unknown
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Expected O, but got Unknown
FieldInfo fieldInfo = null;
foreach (CodeInstruction instruction in instructions)
{
FieldInfo obj = instruction.operand as FieldInfo;
if ((object)obj != null && obj.Name?.Contains("<quotaTextAmount>") == true)
{
FieldInfo obj2 = instruction.operand as FieldInfo;
if ((object)obj2 != null && obj2.ReflectedType?.Name.Contains("<rackUpNewQuotaText>") == true)
{
fieldInfo = instruction.operand as FieldInfo;
break;
}
}
}
if (fieldInfo == null)
{
Plugin.Log.LogWarning((object)"Did vanilla code change? Unable to find field quotaTextAmount in rackUpNewQuotaText enumerator");
return instructions;
}
float num = 2.1474836E+09f;
if (Plugin.newQuotaRackupDuration.Value > 0)
{
num = 100f / (float)Plugin.newQuotaRackupDuration.Value;
}
IEnumerable<CodeInstruction> result = instructions;
try
{
result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)250f, (string)null),
new CodeMatch((OpCode?)OpCodes.Mul, (object)null, (string)null)
}).ThrowIfNotMatch("250f quota inrement amount not found", Array.Empty<CodeMatch>()).SetOperandAndAdvance((object)num)
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Mul, (object)null)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TimeOfDay), "get_Instance", (Type[])null, (Type[])null))
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TimeOfDay), "profitQuota"))
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Conv_R4, (object)null)
})
.Advance(1)
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_R4, (object)1f)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Mathf), "Max", new Type[2]
{
typeof(float),
typeof(float)
}, (Type[])null))
})
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[5]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_3, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Add, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Conv_R4, (object)null, (string)null)
})
.ThrowIfNotMatch("(quotaTextAmount + 3) instructions not found", Array.Empty<CodeMatch>())
.RemoveInstructions(5)
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)10, (string)null),
new CodeMatch((OpCode?)OpCodes.Add, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Conv_R4, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Mathf), "Clamp", new Type[3]
{
typeof(float),
typeof(float),
typeof(float)
}, (Type[])null), (string)null)
})
.ThrowIfNotMatch("Exact Mathf.Clamp instruction not found", Array.Empty<CodeMatch>())
.Advance(3)
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_R4, (object)100f)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Mul, (object)null)
})
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Mathf), "Min", new Type[2]
{
typeof(float),
typeof(float)
}, (Type[])null)))
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldflda, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(int), "ToString", (Type[])null, (Type[])null), (string)null)
})
.ThrowIfNotMatch("Exact quotaTextAmount.ToString() not found", Array.Empty<CodeMatch>())
.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo))
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_I4, (object)100)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Div, (object)null)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Stloc_0, (object)null)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldloca_S, (object)0)
})
.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(TimeOfDay), "get_Instance", (Type[])null, (Type[])null), (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(TimeOfDay), "profitQuota"), (string)null),
new CodeMatch((OpCode?)OpCodes.Blt, (object)null, (string)null)
})
.ThrowIfNotMatch("Exact quotaTextAmount < TimeOfDay.Instance.profitQuota compare not found", Array.Empty<CodeMatch>())
.Advance(3)
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldc_I4, (object)100)
})
.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Mul, (object)null)
})
.InstructionEnumeration();
}
catch (Exception arg)
{
Plugin.Log.LogWarning((object)$"Did vanilla code change? Unable to patch rackUpNewQuotaText enumerator. Exception: {arg}");
}
return result;
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatches
{
internal static bool _gameHasStarted;
internal static void UpdateSeedUISize(StartOfRound __instance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.showSeedNumber.Value)
{
return;
}
_ = HUDManagerPatches._prevDisplaySize;
if (HUDManagerPatches._prevDisplaySize != ((Graphic)HUDManager.Instance.playerScreenTexture).canvas.renderingDisplaySize)
{
if ((Object)(object)HUDManagerPatches._seedScreenCanvas != (Object)null && (Object)(object)HUDManagerPatches._seedUI != (Object)null)
{
HUDManagerPatches._seedScreenCanvas.transform.DetachChildren();
Object.Destroy((Object)(object)HUDManagerPatches._seedUIText);
Object.Destroy((Object)(object)HUDManagerPatches._seedUI);
HUDManagerPatches._seedUI = null;
HUDManagerPatches._seedUIText = null;
}
HUDManagerPatches.CreateSeedUI(HUDManager.Instance);
}
}
[HarmonyPatch("StartGame")]
[HarmonyPostfix]
private static void UpdateSeedUI(StartOfRound __instance)
{
_gameHasStarted = true;
if (Plugin.showSeedNumber.Value)
{
UpdateSeedUISize(__instance);
if ((Object)(object)HUDManagerPatches._seedUIText != (Object)null && (Plugin.showSeedNumberOnCompanyMoon.Value || !StartOfRound.Instance.currentLevel.PlanetName.Equals("71 Gordion", StringComparison.CurrentCultureIgnoreCase)))
{
string text = $"Seed: {__instance.randomMapSeed}";
((TMP_Text)HUDManagerPatches._seedUIText).text = text;
((Behaviour)HUDManagerPatches._seedUIText).enabled = true;
}
}
}
[HarmonyPatch("EndOfGame")]
[HarmonyPostfix]
private static void EndOfGame(StartOfRound __instance)
{
_gameHasStarted = false;
if (Plugin.showSeedNumber.Value && (Object)(object)HUDManagerPatches._seedUIText != (Object)null)
{
((Behaviour)HUDManagerPatches._seedUIText).enabled = false;
}
}
}
}