Allow maxing double time; Allow setting geology bonus
This commit is contained in:
40
index.js
40
index.js
@@ -40,6 +40,27 @@ function setCraftedResources(data, value) {
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setGeology(data) {
|
||||||
|
// Max bonus depends on White Hole achievement: top = 30 + level * 5
|
||||||
|
const whLevel = data.stats?.achieve?.whitehole?.l ?? 0;
|
||||||
|
const top = 30 + whLevel * 5;
|
||||||
|
const maxBonus = (top - 10) / 100;
|
||||||
|
|
||||||
|
const geology = {
|
||||||
|
Copper: maxBonus,
|
||||||
|
Iron: maxBonus,
|
||||||
|
Aluminium: maxBonus,
|
||||||
|
Titanium: maxBonus,
|
||||||
|
};
|
||||||
|
|
||||||
|
data.city.geology = geology;
|
||||||
|
|
||||||
|
const entries = Object.entries(geology)
|
||||||
|
.map(([k, v]) => ` ${k}: +${(v * 100).toFixed(0)}%`)
|
||||||
|
.join("\n");
|
||||||
|
return `Set 4 geology bonuses (max +${(maxBonus * 100).toFixed(0)}% from White Hole level ${whLevel}):\n${entries}`;
|
||||||
|
}
|
||||||
|
|
||||||
function readFromClipboard() {
|
function readFromClipboard() {
|
||||||
try {
|
try {
|
||||||
return execSync("pbpaste", { encoding: "utf-8" }).trim();
|
return execSync("pbpaste", { encoding: "utf-8" }).trim();
|
||||||
@@ -82,7 +103,7 @@ function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasAction = flags.has("--max-resources") || craftedValue !== null;
|
const hasAction = flags.has("--max-resources") || flags.has("--max-time") || flags.has("--max-geology") || craftedValue !== null;
|
||||||
|
|
||||||
if (flags.has("--help") || !hasAction) {
|
if (flags.has("--help") || !hasAction) {
|
||||||
console.log(`Usage: node index.js [options] [save-string]
|
console.log(`Usage: node index.js [options] [save-string]
|
||||||
@@ -90,6 +111,8 @@ function main() {
|
|||||||
Options:
|
Options:
|
||||||
--max-resources Set all capped resources to their max
|
--max-resources Set all capped resources to their max
|
||||||
--set-crafted=N Set all unlimited (crafted) resources to N
|
--set-crafted=N Set all unlimited (crafted) resources to N
|
||||||
|
--max-geology Set 4 geology resource bonuses at max values
|
||||||
|
--max-time Set accelerated time (AT) to 8 hours
|
||||||
--no-copy Print result instead of copying to clipboard
|
--no-copy Print result instead of copying to clipboard
|
||||||
--help Show this help
|
--help Show this help
|
||||||
|
|
||||||
@@ -131,6 +154,21 @@ Save string can be passed as argument, piped via stdin, or read from clipboard.`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags.has("--max-geology")) {
|
||||||
|
console.log(setGeology(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags.has("--max-time")) {
|
||||||
|
const MAX_AT = 11520; // game adjusts down to 8 hours on load
|
||||||
|
const old = data.settings?.at ?? 0;
|
||||||
|
if (old < MAX_AT) {
|
||||||
|
data.settings.at = MAX_AT;
|
||||||
|
console.log(`Accelerated time: ${old} -> ${MAX_AT} (adjusts to 8 hours on load)`);
|
||||||
|
} else {
|
||||||
|
console.log(`Accelerated time already at ${old} (>= max).`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (craftedValue !== null) {
|
if (craftedValue !== null) {
|
||||||
const changed = setCraftedResources(data, craftedValue);
|
const changed = setCraftedResources(data, craftedValue);
|
||||||
if (changed.length > 0) {
|
if (changed.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user