clawcity 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/move.js +2 -3
- package/dist/commands/stats.js +2 -2
- package/dist/lib/api.js +4 -1
- package/package.json +1 -1
package/dist/commands/move.js
CHANGED
|
@@ -21,10 +21,9 @@ export function registerMoveCommands(program) {
|
|
|
21
21
|
const d = res.data;
|
|
22
22
|
const pos = d.position;
|
|
23
23
|
const steps = d.steps_taken ?? d.steps ?? '?';
|
|
24
|
-
const terrain =
|
|
24
|
+
const terrain = d.terrain ?? target;
|
|
25
25
|
const x = pos?.x ?? '?';
|
|
26
26
|
const y = pos?.y ?? '?';
|
|
27
|
-
|
|
28
|
-
console.log(`Moved to (${x},${y}) ${terrain} in ${steps} steps. Food: ${food}`);
|
|
27
|
+
console.log(`Moved to (${x},${y}) ${terrain} in ${steps} steps`);
|
|
29
28
|
});
|
|
30
29
|
}
|
package/dist/commands/stats.js
CHANGED
|
@@ -9,8 +9,8 @@ export function registerStatsCommands(program) {
|
|
|
9
9
|
handleError(res);
|
|
10
10
|
const d = res.data;
|
|
11
11
|
const pos = d.position;
|
|
12
|
-
const inv = d.
|
|
13
|
-
console.log(`${d.name} | (${pos.x},${pos.y}) ${
|
|
12
|
+
const inv = { gold: d.gold ?? 0, wood: d.wood ?? 0, food: d.food ?? 0, stone: d.stone ?? 0 };
|
|
13
|
+
console.log(`${d.name} | (${pos.x},${pos.y}) ${d.terrain} | ${fmtResources(inv)} | wealth:${d.wealth} | ${d.territories} terr`);
|
|
14
14
|
});
|
|
15
15
|
program
|
|
16
16
|
.command('summary')
|
package/dist/lib/api.js
CHANGED
|
@@ -23,7 +23,10 @@ export async function api(path, opts = {}) {
|
|
|
23
23
|
headers,
|
|
24
24
|
body: body ? JSON.stringify(body) : undefined,
|
|
25
25
|
});
|
|
26
|
-
const
|
|
26
|
+
const json = await res.json();
|
|
27
|
+
const data = (res.ok && json.data && typeof json.data === 'object')
|
|
28
|
+
? json.data
|
|
29
|
+
: json;
|
|
27
30
|
return { ok: res.ok, status: res.status, data };
|
|
28
31
|
}
|
|
29
32
|
catch (err) {
|