1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 04:53:30 +08:00

minor fix

This commit is contained in:
2022-12-02 03:25:03 +08:00
parent 5d9363cd74
commit 374b5648c7

View File

@@ -176,7 +176,7 @@ public class CheatEnabler : BaseUnityPlugin
} }
foreach (var currentTech in TechToUnlock) foreach (var currentTech in TechToUnlock)
{ {
UnlockTechRecursive(history, currentTech, 5000); UnlockTechRecursive(history, currentTech);
} }
var techQueue = history.techQueue; var techQueue = history.techQueue;
if (techQueue == null || techQueue.Length == 0) if (techQueue == null || techQueue.Length == 0)
@@ -190,7 +190,7 @@ public class CheatEnabler : BaseUnityPlugin
} }
} }
private static void UnlockTechRecursive(GameHistoryData history, int currentTech, int maxLevel = 10000) private static void UnlockTechRecursive(GameHistoryData history, int currentTech, int maxLevel = 10001)
{ {
var techStates = history.techStates; var techStates = history.techStates;
if (techStates == null || !techStates.ContainsKey(currentTech)) if (techStates == null || !techStates.ContainsKey(currentTech))
@@ -203,7 +203,7 @@ public class CheatEnabler : BaseUnityPlugin
return; return;
} }
var value = techStates[currentTech]; var value = techStates[currentTech];
var maxLvl = Math.Min(maxLevel, value.maxLevel); var maxLvl = Math.Min(maxLevel, value.maxLevel) + 1;
if (value.unlocked && value.curLevel >= maxLvl && value.hashUploaded >= value.hashNeeded) if (value.unlocked && value.curLevel >= maxLvl && value.hashUploaded >= value.hashNeeded)
{ {
return; return;
@@ -225,7 +225,7 @@ public class CheatEnabler : BaseUnityPlugin
} }
} }
while (value.curLevel <= maxLvl) while (value.curLevel < maxLvl)
{ {
for (var j = 0; j < techProto.UnlockFunctions.Length; j++) for (var j = 0; j < techProto.UnlockFunctions.Length; j++)
{ {
@@ -233,8 +233,8 @@ public class CheatEnabler : BaseUnityPlugin
} }
value.curLevel++; value.curLevel++;
} }
value.curLevel = maxLvl; value.curLevel = maxLvl - 1;
value.unlocked = maxLvl >= value.maxLevel; value.unlocked = maxLvl > value.maxLevel;
value.hashNeeded = techProto.GetHashNeeded(value.curLevel); value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
value.hashUploaded = maxLvl >= value.maxLevel ? value.hashNeeded : 0; value.hashUploaded = maxLvl >= value.maxLevel ? value.hashNeeded : 0;
techStates[currentTech] = value; techStates[currentTech] = value;