68 lines
2.1 KiB
Plaintext
68 lines
2.1 KiB
Plaintext
meta {
|
|
name: Get npc runtime snapshot
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
script:pre-request {
|
|
const { resetPrototypeCombatTargets } = require("../scripts/combat-targets-reset-helper.js");
|
|
await resetPrototypeCombatTargets(bru);
|
|
}
|
|
|
|
get {
|
|
url: {{baseUrl}}/game/world/npc-runtime-snapshot
|
|
body: none
|
|
auth: none
|
|
}
|
|
|
|
tests {
|
|
test("returns 200 JSON with schema v1 and npcInstances array", function () {
|
|
expect(res.getStatus()).to.equal(200);
|
|
expect(res.getHeader("content-type")).to.contain("application/json");
|
|
const body = res.getBody();
|
|
expect(body.schemaVersion).to.equal(1);
|
|
expect(body.serverTimeUtc).to.be.a("string");
|
|
expect(body.npcInstances).to.be.an("array");
|
|
expect(body.npcInstances.length).to.equal(3);
|
|
});
|
|
|
|
test("npcInstances are ascending by npcInstanceId (ordinal)", function () {
|
|
const body = res.getBody();
|
|
const ids = body.npcInstances.map((x) => x.npcInstanceId);
|
|
const sorted = [...ids].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
expect(ids).to.eql(sorted);
|
|
});
|
|
|
|
test("prototype NPC registry instances match id order", function () {
|
|
const body = res.getBody();
|
|
const ids = body.npcInstances.map((x) => x.npcInstanceId);
|
|
expect(ids).to.eql([
|
|
"prototype_npc_elite",
|
|
"prototype_npc_melee",
|
|
"prototype_npc_ranged",
|
|
]);
|
|
});
|
|
|
|
test("all instances start idle with null holder and telegraph on fresh server", function () {
|
|
const body = res.getBody();
|
|
for (const row of body.npcInstances) {
|
|
expect(row.state).to.equal("idle");
|
|
expect(row.aggroHolderPlayerId).to.equal(null);
|
|
expect(row.activeTelegraph).to.equal(null);
|
|
expect(row.behaviorDefId).to.be.a("string");
|
|
}
|
|
const byId = Object.fromEntries(
|
|
body.npcInstances.map((x) => [x.npcInstanceId, x]),
|
|
);
|
|
expect(byId.prototype_npc_melee.behaviorDefId).to.equal(
|
|
"prototype_melee_pressure",
|
|
);
|
|
expect(byId.prototype_npc_ranged.behaviorDefId).to.equal(
|
|
"prototype_ranged_control",
|
|
);
|
|
expect(byId.prototype_npc_elite.behaviorDefId).to.equal(
|
|
"prototype_elite_mini_boss",
|
|
);
|
|
});
|
|
}
|