Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Terminal Fixes v1.0.2
plugins/ShowMoonPriceFormattingFix.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using BepInEx; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace LocalMoonListFix; [BepInPlugin("local.showmoonprice.formattingfix", "ShowMoonPrice Formatting Fix", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown Type type = AccessTools.TypeByName("ShowMoonPriceLLL.Terminal_Patch_Override"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "getFormattedLine", (Type[])null, (Type[])null)); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"ShowMoonPriceLLL formatter was not found; no patch applied."); return; } new Harmony("local.showmoonprice.formattingfix").Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "Transpile", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applied safe risk-label and spacing handling to ShowMoonPriceLLL."); } public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions) { MethodInfo pad = typeof(string).GetMethod("PadLeft", new Type[1] { typeof(int) }); foreach (CodeInstruction instruction in instructions) { FieldInfo field = instruction.operand as FieldInfo; if (CodeInstructionExtensions.Calls(instruction, pad)) { instruction.opcode = OpCodes.Call; instruction.operand = AccessTools.Method(typeof(Formatting), "SafePadLeft", (Type[])null, (Type[])null); } yield return instruction; if (instruction.opcode == OpCodes.Ldfld && field != null && field.Name == "riskLevel" && field.FieldType == typeof(string)) { yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Formatting), "CompactRisk", (Type[])null, (Type[])null)); } } } } public static class Formatting { public static string CompactRisk(string risk) { if (risk == null) { return null; } string input = Regex.Replace(risk, "<[^>]*>", ""); input = Regex.Replace(input, "\\s+", " ").Trim(); return (input.Length <= 8) ? input : (input.Substring(0, 7) + "~"); } public static string SafePadLeft(string value, int width) { return value.PadLeft(Math.Max(value.Length + 1, width)); } }
plugins/StoreClientSyncFix.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using HarmonyLib; using StoreRotationConfig.Networking; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace LocalStoreClientSyncFix; [BepInDependency("pacoito.StoreRotationConfig", "3.0.0")] [BepInPlugin("local.storeclient.syncfix", "Store Client Sync Fix", "1.0.1")] public sealed class Plugin : BaseUnityPlugin { private static ManualLogSource log; private static string lastUnresolved; private static string lastError; private static StoreRotationNetworker lastNetworker; private static FieldInfo rotationField; private static IndexedListReader<StoreRotationEntry> rotationReader; private void Awake() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown log = ((BaseUnityPlugin)this).Logger; Version version = typeof(StoreRotationNetworker).Assembly.GetName().Version; if (version != new Version(3, 0, 0, 0)) { log.LogWarning((object)"Store Client Sync Fix was built for StoreRotationConfig 3.0.0; this version is not patched."); return; } Harmony val = new Harmony("local.storeclient.syncfix"); try { MethodInfo methodInfo = AccessTools.Method(typeof(Plugin), "RefreshClientStore", (Type[])null, (Type[])null); rotationField = AccessTools.Field(typeof(StoreRotationNetworker), "<StoreRotation>k__BackingField"); MethodInfo methodInfo2 = AccessTools.Method(typeof(Terminal), "BeginUsingTerminal", Type.EmptyTypes, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(Terminal), "TextPostProcess", new Type[2] { typeof(string), typeof(TerminalNode) }, (Type[])null); if (methodInfo2 == null) { throw new MissingMethodException("Terminal.BeginUsingTerminal()"); } if (methodInfo3 == null) { throw new MissingMethodException("Terminal.TextPostProcess(string, TerminalNode)"); } if (methodInfo == null) { throw new MissingMethodException("Plugin.RefreshClientStore(Terminal)"); } if (rotationField == null) { throw new MissingFieldException("StoreRotationNetworker.StoreRotation backing field"); } rotationReader = new IndexedListReader<StoreRotationEntry>(rotationField.FieldType); val.Patch((MethodBase)methodInfo2, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); log.LogInfo((object)"Client store repair active: resolves host rotation before terminal use/text processing; retries unresolved items on every refresh."); } catch (Exception ex) { val.UnpatchSelf(); log.LogError((object)("Could not enable client store repair: " + ex)); } } private static void RefreshClientStore(Terminal __instance) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) try { StoreRotationNetworker instance = StoreRotationNetworker.Instance; if ((Object)(object)__instance == (Object)null || (Object)(object)instance == (Object)null || !((NetworkBehaviour)instance).IsSpawned || !((NetworkBehaviour)instance).IsClient || ((NetworkBehaviour)instance).IsHost) { return; } if (!object.ReferenceEquals(instance, lastNetworker)) { lastNetworker = instance; lastUnresolved = null; lastError = null; } StartOfRound instance2 = StartOfRound.Instance; if ((Object)(object)instance2 == (Object)null || (Object)(object)instance2.unlockablesList == (Object)null || instance2.unlockablesList.unlockables == null) { return; } List<UnlockableItem> unlockables = instance2.unlockablesList.unlockables; object value = rotationField.GetValue(instance); if (value == null) { return; } List<int> list = new List<int>(); foreach (StoreRotationEntry item in rotationReader.Read(value)) { StoreRotationEntry current = item; list.Add(((StoreRotationEntry)(ref current)).UnlockableID); } List<int> unresolved; List<TerminalNode> list2 = StoreSnapshot.Resolve(list, unlockables.Count, (int id) => unlockables[id]?.shopSelectionNode, (TerminalNode node) => (Object)(object)node != (Object)null, out unresolved); if (!StoreSnapshot.Matches(__instance.ShipDecorSelection, list2)) { if (__instance.ShipDecorSelection == null) { __instance.ShipDecorSelection = new List<TerminalNode>(); } __instance.ShipDecorSelection.Clear(); __instance.ShipDecorSelection.AddRange(list2); log.LogInfo((object)$"Rebuilt client store: {list2.Count}/{list.Count} host rotation entries resolved; {unlockables.Count} local unlockables. Prices and host stock choices retained."); } string text = string.Join(",", unresolved.ConvertAll((int id) => id.ToString()).ToArray()); if (text != lastUnresolved) { if (text.Length != 0) { log.LogWarning((object)("Unresolved host store IDs: " + text + ". Excluded from this display only; will retry next terminal refresh. Persistent IDs require matching content/configs.")); } else if (!string.IsNullOrEmpty(lastUnresolved)) { log.LogInfo((object)"All previously unresolved host store entries are now available."); } lastUnresolved = text; } lastError = null; } catch (Exception ex) { string text2 = ex.ToString(); if (text2 != lastError) { log.LogError((object)("Client store refresh failed: " + text2)); lastError = text2; } } } } internal static class StoreSnapshot { internal static List<T> Resolve<T>(IList<int> ids, int localCount, Func<int, T> lookup, Predicate<T> available, out List<int> unresolved) { List<T> list = new List<T>(ids.Count); unresolved = new List<int>(); foreach (int id in ids) { if (id < 0 || id >= localCount) { unresolved.Add(id); continue; } T val = lookup(id); if (!available(val)) { unresolved.Add(id); } else { list.Add(val); } } return list; } internal static bool Matches<T>(IList<T> current, IList<T> desired) where T : class { if (current == null || current.Count != desired.Count) { return false; } for (int i = 0; i < desired.Count; i++) { if (!object.ReferenceEquals(current[i], desired[i])) { return false; } } return true; } } internal sealed class IndexedListReader<T> { private readonly PropertyInfo count; private readonly PropertyInfo item; internal IndexedListReader(Type listType) { if (listType == null) { throw new ArgumentNullException("listType"); } count = listType.GetProperty("Count", BindingFlags.Instance | BindingFlags.Public); item = listType.GetProperty("Item", BindingFlags.Instance | BindingFlags.Public, null, typeof(T), new Type[1] { typeof(int) }, null); if (count == null || count.PropertyType != typeof(int) || count.GetGetMethod() == null) { throw new MissingMemberException(listType.FullName, "public int Count getter"); } if (item == null || item.GetGetMethod() == null) { throw new MissingMemberException(listType.FullName, "public " + typeof(T).FullName + " this[int] getter"); } } internal List<T> Read(object list) { if (list == null) { throw new ArgumentNullException("list"); } int num = (int)count.GetValue(list, null); List<T> list2 = new List<T>(num); for (int i = 0; i < num; i++) { list2.Add((T)item.GetValue(list, new object[1] { i })); } return list2; } }
plugins/StoreScrollActivationFix.dll
Decompiled 3 weeks agousing System; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace LocalStoreScrollFix; [BepInPlugin("local.storescroll.activationfix", "Store Scroll Activation Fix", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private void Awake() { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("StoreRotationConfig.Patches.TerminalScrollMousePatch"); Type type2 = AccessTools.TypeByName("GameNetcodeStuff.PlayerControllerB"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "ScrollMousePerformed_Transpiler", (Type[])null, (Type[])null)); MethodInfo methodInfo2 = ((type2 == null) ? null : AccessTools.Method(type2, "ScrollMouse_performed", (Type[])null, (Type[])null)); if (methodInfo == null || methodInfo2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Expected StoreRotationConfig scroll patch was not found; no changes applied."); return; } Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo2); if (patchInfo != null) { foreach (Patch transpiler in patchInfo.Transpilers) { if (transpiler.PatchMethod == methodInfo) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"StoreRotationConfig scrolling is already registered; no duplicate added."); return; } } } new Harmony("local.storescroll.activationfix").Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Activated StoreRotationConfig's missing scroll patch. Uses its relativeScroll and linesToScroll settings."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Unable to activate StoreRotationConfig scrolling: " + ex)); } } }