using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LLGUI; using LLScreen; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("com.github.daioutzu.infinitepoints")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("InfinitePoints")] [assembly: AssemblyTitle("com.github.daioutzu.infinitepoints")] [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 InfinitePoints { internal static class GameHudPlayerInfo_Patch { [HarmonyPatch(typeof(GameHudPlayerInfo), "ShowPoints")] [HarmonyTranspiler] private static IEnumerable ChangePoints(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.SearchForward((Func)((CodeInstruction i) => i.opcode == OpCodes.Ldc_I4_S && (sbyte)i.operand == 99)).ThrowIfNotMatch("Did not find Ldc_I4_S 1", (CodeMatch[])(object)new CodeMatch[0]).Set(OpCodes.Ldc_I4, (object)Plugin.maxPointsDisplayed.Value); val.SearchForward((Func)((CodeInstruction i) => i.opcode == OpCodes.Ldc_I4_S && (sbyte)i.operand == 99)).ThrowIfNotMatch("Did not find Ldc_I4_S 2", (CodeMatch[])(object)new CodeMatch[0]).Set(OpCodes.Ldc_I4, (object)Plugin.maxPointsDisplayed.Value); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(LLImageText), "InitNeeded")] [HarmonyPrefix] private static void AddMoreImages(LLImageText __instance) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (__instance == null || ((Object)__instance).name != "ptsCur" || !ScreenPlayersSettings.curGameSettings.LDEAKMILLHE) { return; } Image[] array = (Image[])(object)new Image[Plugin.maxPointsDisplayed.Value.Digits()]; float num = 29 * (-array.Length + 2); for (int i = 0; i < array.Length; i++) { if (i < __instance.images.Length) { array[i] = __instance.images[i]; } else { array[i] = Object.Instantiate(__instance.images[0], ((Component)__instance).transform); ((Object)array[i]).name = $"im{i}"; } ((Graphic)array[i]).rectTransform.anchoredPosition = Vector2.op_Implicit(new Vector3(num, 0f, 0f)); num += 29f; } __instance.images = array; __instance.alignment = (TextAlignment)2; } [HarmonyPatch(typeof(ScreenPlayersSettings), "BtStocksChange")] [HarmonyTranspiler] [HarmonyDebug] private static IEnumerable ModifyMinimumPoints(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.SearchForward((Func)((CodeInstruction iL) => iL.opcode == OpCodes.Callvirt && (iL.operand as MethodBase).Name == "JFNLOKKDCEB")).ThrowIfInvalid("Did NOT find usePoints").Advance(2) .Set(OpCodes.Ldc_I4, (object)Plugin.minimumPoints.Value); return val.InstructionEnumeration(); } public static int Digits(this int n) { if (n >= 0) { if (n < 10) { return 1; } if (n < 100) { return 2; } if (n < 1000) { return 3; } if (n < 10000) { return 4; } if (n < 100000) { return 5; } if (n < 1000000) { return 6; } if (n < 10000000) { return 7; } if (n < 100000000) { return 8; } if (n < 1000000000) { return 9; } return 10; } if (n > -10) { return 2; } if (n > -100) { return 3; } if (n > -1000) { return 4; } if (n > -10000) { return 5; } if (n > -100000) { return 6; } if (n > -1000000) { return 7; } if (n > -10000000) { return 8; } if (n > -100000000) { return 9; } if (n > -1000000000) { return 10; } return 11; } } [BepInPlugin("com.github.daioutzu.infinitepoints", "InfinitePoints", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; internal static ConfigEntry maxPointsDisplayed; internal static ConfigEntry minimumPoints; internal static Harmony Harmony { get; private set; } = new Harmony("com.github.daioutzu.infinitepoints"); private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; ConfigSetup(); Harmony.PatchAll(typeof(GameHudPlayerInfo_Patch)); Logger.LogInfo((object)"Plugin com.github.daioutzu.infinitepoints is loaded!"); } private void ConfigSetup() { maxPointsDisplayed = ((BaseUnityPlugin)this).Config.Bind("General", "MaxPointsDisplayed", 9999, "The maximum amount of points shown during a points match"); if (maxPointsDisplayed.Value <= 0) { Logger.LogFatal((object)"MaxPointsDisplayed MUST be a positive number"); maxPointsDisplayed.Value = (int)((ConfigEntryBase)maxPointsDisplayed).DefaultValue; } else if (maxPointsDisplayed.Value <= 98) { Logger.LogFatal((object)"MaxPointsDisplayed MUST be higher than the games default of 99"); maxPointsDisplayed.Value = 99; } minimumPoints = ((BaseUnityPlugin)this).Config.Bind("General", "MinimumPoints", 8, "The minimum amount of points that can be selected. Can make getting to infinite points quicker"); if (minimumPoints.Value < 1 || minimumPoints.Value > 8) { Logger.LogFatal((object)"MinimumPoints MUST be between 1 and 8"); minimumPoints.Value = (int)((ConfigEntryBase)minimumPoints).DefaultValue; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.daioutzu.infinitepoints"; public const string PLUGIN_NAME = "InfinitePoints"; public const string PLUGIN_VERSION = "1.0.0"; } }