diff --git a/Projects/SupermarketTogether/SupermarketTogether/AutoPricer.cs b/Projects/SupermarketTogether/SupermarketTogether/AutoPricer.cs new file mode 100644 index 0000000..06de78f --- /dev/null +++ b/Projects/SupermarketTogether/SupermarketTogether/AutoPricer.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using HarmonyLib; + +namespace DavesPhatStore { + [HarmonyPatch] + public class AutoPricer { + [HarmonyTranspiler] + [HarmonyPatch(typeof(PlayerNetwork), "Update")] + static IEnumerable Transpiler(IEnumerable instructions) { + var codes = new List(instructions); + + for (int i = 0; i < codes.Count; i++) { + var codeInstruction = codes[i]; + if (codeInstruction.operand != null) { + Console.WriteLine( + $"'{codeInstruction.opcode}': '{codeInstruction.operand}'/'{codeInstruction.operand.GetType()}'"); + } + } + + return codes.AsEnumerable(); + } + } +} \ No newline at end of file diff --git a/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj b/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj index 20d2158..0a5ee07 100644 --- a/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj +++ b/Projects/SupermarketTogether/SupermarketTogether/SupermarketTogether.csproj @@ -35,6 +35,7 @@ 4 +