tools/client/create_starter.mjs (3113B)
1 import assert from 'node:assert/strict'; 2 3 export async function startStarter(game) { 4 // Options launches the original creator in a new client instance. 5 await game.page.keyboard.press('Control+Alt+M'); 6 await Promise.all([game.page.waitForEvent('load'), game.page.locator('#create-button').click()]); 7 await game.page.waitForFunction(() => typeof Module._browser_test_request === 'function', null, {timeout: 180000}); 8 await game.wait('native breed selection', state => state.creation?.scene === 1001 && state.creation.ready, 60000); 9 await game.click(880, 350); 10 await game.wait('selected Atrox enables Next', state => state.regions.some( 11 ([left, top, right, bottom]) => left === 888 && top === 710 && right === 1006 && bottom === 749)); 12 await game.click(946, 730); 13 14 // Exercise original head, height and build controls, then select Enforcer. 15 await game.wait('native appearance selection', state => state.creation?.scene === 1002 && state.creation.ready, 60000); 16 await game.click(404, 130); 17 await game.click(919, 214); 18 await game.click(920, 444); 19 await game.click(946, 730); 20 await game.wait('native profession selection', state => state.creation?.scene === 1003 && state.creation.ready, 60000); 21 await game.click(850, 514); 22 await game.wait('selected Enforcer enables Next', state => state.regions.some( 23 ([left, top, right, bottom]) => left === 888 && top === 710 && right === 1006 && bottom === 749)); 24 } 25 26 export async function finishStarter(game, name, password) { 27 // The native naming step opens the browser's keyboard-capable credential fields. 28 await game.click(946, 730); 29 await game.page.locator('#creation-credentials').waitFor({state: 'visible'}); 30 await game.page.locator('#creation-player-name').fill(name); 31 await game.page.locator('#creation-password').fill(password); 32 await game.page.locator('#creation-password-confirm').fill(password); 33 await game.page.locator('#creation-submit').click(); 34 await game.ready(); 35 assert.equal(game.local().playfield, 4604); 36 assert.equal(game.local().stats[4], 4); 37 assert.equal(game.local().stats[60], 9); 38 } 39 40 export async function enterOmniTraining(game) { 41 // Walk through the Hall's central barrier opening to the Omni desk. 42 if (!game.state.camera.firstPerson) await game.key('F8'); 43 for (const [x, z] of [[186, 181], [186, 172], [178.5, 170], [178.5, 167.5]]) await game.walk(x, z); 44 const representative = game.state.actors.find(actor => actor.type === 50000 && 45 Math.abs(actor.position[0] - 176.11554) < 0.2 && Math.abs(actor.position[2] - 163.19379) < 0.2); 46 assert(representative); 47 const sequence = game.sequence; 48 await game.click(...await game.pick(50000, representative.id), 'right'); 49 await game.wait('Omni representative menu', () => game.events.some(event => event.sequence > sequence && 50 event.direction === 'framereceived' && event.opcode === '55704d31')); 51 await game.click(170, 373); 52 await game.wait('Omni training destination', state => game.local(state)?.playfield === 950, 60000); 53 await game.ready(); 54 await game.click(538, 108); 55 assert.equal(game.local().stats[33], 2); 56 }