From cb3975ae1a5452aaa79ced746b059b74527da581 Mon Sep 17 00:00:00 2001 From: Soar Qin Date: Tue, 3 Jun 2025 18:55:38 +0800 Subject: [PATCH] use original game's consts --- CheatEnabler/Functions/DysonSphereFunctions.cs | 18 +++++++++--------- CheatEnabler/Patches/DysonSpherePatch.cs | 16 ++++++++-------- UXAssist/Patches/DysonSpherePatch.cs | 8 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CheatEnabler/Functions/DysonSphereFunctions.cs b/CheatEnabler/Functions/DysonSphereFunctions.cs index 784d5b6..ba682e1 100644 --- a/CheatEnabler/Functions/DysonSphereFunctions.cs +++ b/CheatEnabler/Functions/DysonSphereFunctions.cs @@ -76,7 +76,7 @@ public static class DysonSphereFunctions dysonNode.spOrdered = 0; dysonNode._spReq = 0; totalNodeSp += dysonNode.spMax; - var diff = dysonNode.spMax - dysonNode.sp; + var diff = dysonNode.spMax - dysonNode.sp; if (diff > 0) { rocketCount += diff; @@ -115,21 +115,21 @@ public static class DysonSphereFunctions var count = rocketCount; while (count > 0x40000000L) { - productRegister[11902] += 0x40000000; + productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += 0x40000000; count -= 0x40000000; } - if (count > 0L) productRegister[11902] += (int)count; + if (count > 0L) productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += (int)count; count = solarSailCount; while (count > 0x40000000L) { - productRegister[11901] += 0x40000000; - productRegister[11903] += 0x40000000; + productRegister[ProductionStatistics.SOLAR_SAIL_ID] += 0x40000000; + productRegister[ProductionStatistics.DYSON_CELL_ID] += 0x40000000; count -= 0x40000000; } if (count > 0L) { - productRegister[11901] += (int)count; - productRegister[11903] += (int)count; + productRegister[ProductionStatistics.SOLAR_SAIL_ID] += (int)count; + productRegister[ProductionStatistics.DYSON_CELL_ID] += (int)count; } } } @@ -141,10 +141,10 @@ public static class DysonSphereFunctions var count = solarSailCount; while (count > 0x40000000L) { - consumeRegister[11901] += 0x40000000; + consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += 0x40000000; count -= 0x40000000; } - if (count > 0L) consumeRegister[11901] += (int)count; + if (count > 0L) consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += (int)count; } } }); diff --git a/CheatEnabler/Patches/DysonSpherePatch.cs b/CheatEnabler/Patches/DysonSpherePatch.cs index f300a27..6a5c928 100644 --- a/CheatEnabler/Patches/DysonSpherePatch.cs +++ b/CheatEnabler/Patches/DysonSpherePatch.cs @@ -326,9 +326,9 @@ public class DysonSpherePatch : PatchImpl if (node.ConstructCp() == null) break; if (idx == 0) { - sphereProductRegister[11901] += len; - sphereConsumeRegister[11901] += len; - sphereProductRegister[11903] += len; + sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += len; + sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += len; + sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += len; return; } idx--; @@ -339,9 +339,9 @@ public class DysonSpherePatch : PatchImpl var absorbCnt = len - 1 - idx; if (absorbCnt > 0) { - sphereProductRegister[11901] += absorbCnt; - sphereConsumeRegister[11901] += absorbCnt; - sphereProductRegister[11903] += absorbCnt; + sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt; + sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt; + sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += absorbCnt; } } for (; idx >= 0; idx--) @@ -374,7 +374,7 @@ public class DysonSpherePatch : PatchImpl ).Advance(1).RemoveInstructions(matcher.Length - matcher.Pos).Insert( // if (node.ConstructCp() != null) // { - // this.dysonSphere.productRegister[11903]++; + // this.dysonSphere.productRegister[ProductionStatistics.DYSON_CELL_ID]++; // } new CodeInstruction(OpCodes.Ldarg_1), new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(DysonNode), nameof(DysonNode.ConstructCp))), @@ -382,7 +382,7 @@ public class DysonSpherePatch : PatchImpl new CodeInstruction(OpCodes.Ldarg_0), new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.dysonSphere))), new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(DysonSphere), nameof(DysonSphere.productRegister))), - new CodeInstruction(OpCodes.Ldc_I4, 11903), + new CodeInstruction(OpCodes.Ldc_I4, ProductionStatistics.DYSON_CELL_ID), new CodeInstruction(OpCodes.Ldelema, typeof(int)), new CodeInstruction(OpCodes.Dup), new CodeInstruction(OpCodes.Ldind_I4), diff --git a/UXAssist/Patches/DysonSpherePatch.cs b/UXAssist/Patches/DysonSpherePatch.cs index b254828..181364e 100644 --- a/UXAssist/Patches/DysonSpherePatch.cs +++ b/UXAssist/Patches/DysonSpherePatch.cs @@ -173,7 +173,7 @@ public class DysonSpherePatch: PatchImpl { lock (productRegister) { - productRegister[11902] += todoCount - count; + productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += todoCount - count; } } } @@ -213,8 +213,8 @@ public class DysonSpherePatch: PatchImpl { lock (productRegister) { - productRegister[11901] += solarSailCount; - productRegister[11903] += solarSailCount; + productRegister[ProductionStatistics.SOLAR_SAIL_ID] += solarSailCount; + productRegister[ProductionStatistics.DYSON_CELL_ID] += solarSailCount; } } var consumeRegister = __instance.consumeRegister; @@ -222,7 +222,7 @@ public class DysonSpherePatch: PatchImpl { lock (consumeRegister) { - consumeRegister[11901] += solarSailCount; + consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += solarSailCount; } } }