118 lines
3.8 KiB
Plaintext
118 lines
3.8 KiB
Plaintext
meta {
|
|
name: POST craft gather refine make spine
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
docs {
|
|
NEO-70 prototype spine: gather scrap from four prototype resource nodes (delta 5 + gamma 3 + beta 2 + alpha 1 = 11 scrap), craft refine_scrap_efficient (10→2 refined_plate_stock), then make_field_stim_mk0. No inventory POST shortcuts.
|
|
}
|
|
|
|
script:pre-request {
|
|
const axios = require("axios");
|
|
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
|
|
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
|
|
const jsonHeaders = { headers: { "Content-Type": "application/json" } };
|
|
|
|
async function moveNear(x, z) {
|
|
await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/move`,
|
|
{ schemaVersion: 1, target: { x, y: 0.9, z } },
|
|
jsonHeaders,
|
|
);
|
|
}
|
|
|
|
async function gather(interactableId) {
|
|
const response = await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/interact`,
|
|
{ schemaVersion: 1, interactableId },
|
|
jsonHeaders,
|
|
);
|
|
if (response.status !== 200 || response.data?.allowed !== true) {
|
|
throw new Error(`gather ${interactableId} failed: ${response.status} ${JSON.stringify(response.data)}`);
|
|
}
|
|
}
|
|
|
|
async function craft(recipeId) {
|
|
const response = await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/craft`,
|
|
{ schemaVersion: 1, recipeId },
|
|
jsonHeaders,
|
|
);
|
|
if (response.status !== 200 || response.data?.success !== true) {
|
|
throw new Error(`craft ${recipeId} failed: ${response.status} ${JSON.stringify(response.data)}`);
|
|
}
|
|
return response.data;
|
|
}
|
|
|
|
await moveNear(16, -2);
|
|
await gather("prototype_urban_bulk_delta");
|
|
await moveNear(10, -2);
|
|
await gather("prototype_bio_mat_gamma");
|
|
await moveNear(16, -6);
|
|
await gather("prototype_subsurface_vein_beta");
|
|
await moveNear(10, -6);
|
|
await gather("prototype_resource_node_alpha");
|
|
|
|
await craft("refine_scrap_efficient");
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/game/players/{{playerId}}/craft
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
headers {
|
|
content-type: application/json
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"schemaVersion": 1,
|
|
"recipeId": "make_field_stim_mk0"
|
|
}
|
|
}
|
|
|
|
script:post-response {
|
|
const axios = require("axios");
|
|
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
|
|
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
|
|
|
|
const inventory = await axios.get(`${baseUrl}/game/players/${playerId}/inventory`);
|
|
const progression = await axios.get(`${baseUrl}/game/players/${playerId}/skill-progression`);
|
|
|
|
bru.setVar("spineInventory", inventory.data);
|
|
bru.setVar("spineProgression", progression.data);
|
|
}
|
|
|
|
tests {
|
|
test("make_field_stim_mk0 succeeds after gather and refine", function () {
|
|
expect(res.getStatus()).to.equal(200);
|
|
const body = res.getBody();
|
|
expect(body.schemaVersion).to.equal(1);
|
|
expect(body.success).to.equal(true);
|
|
expect(body.reasonCode).to.equal(null);
|
|
expect(body.outputsGranted).to.deep.include({ itemId: "field_stim_mk0", quantity: 1 });
|
|
expect(body.xpGrantSummary).to.be.an("object");
|
|
expect(body.xpGrantSummary.skillId).to.equal("refine");
|
|
expect(body.xpGrantSummary.amount).to.equal(10);
|
|
expect(body.xpGrantSummary.sourceKind).to.equal("activity");
|
|
});
|
|
|
|
test("inventory includes field_stim_mk0 after spine", function () {
|
|
const inventory = bru.getVar("spineInventory");
|
|
const total = inventory.bagSlots
|
|
.filter((slot) => slot.itemId === "field_stim_mk0")
|
|
.reduce((sum, slot) => sum + slot.quantity, 0);
|
|
expect(total).to.be.at.least(1);
|
|
});
|
|
|
|
test("refine skill XP increased after spine crafts", function () {
|
|
const progression = bru.getVar("spineProgression");
|
|
const refine = progression.skills.find((row) => row.id === "refine");
|
|
expect(refine).to.be.an("object");
|
|
expect(refine.xp).to.be.at.least(20);
|
|
});
|
|
}
|