commit 42840980e83ec46d3943451fd2223a92039fe32c
parent 8cd35f96e98aa6c1412ac11b571d95847ad9f976
Author: anon <anon@example.com>
Date: Sat, 24 Oct 2026 21:12:36 +0000
Add atomic browser character creation and correct faction replication
Diffstat:
16 files changed, 954 insertions(+), 107 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -427,24 +427,37 @@ checks are recorded in [treatment kits](docs/treatment-kit.md).
The original 255-head catalog, seven breed/sex templates, body materials and
persisted gameplay height are recorded in [player appearance](docs/character-appearance.md).
-The selection flow and complete original creation sequence remain open below.
+Browser selection and atomic creation are implemented. The complete original
+introduction and starting-item gameplay remain open below.
-- [ ] Choose a breed at creation. Check: the choice persists and the native
+- [x] Choose a breed at creation. Check: the choice persists and the native
appearance and derived resource coefficients agree with it.
-- [ ] Choose a profession at creation. Check: profession-dependent starting
+- [x] Choose a profession at creation. Check: profession-dependent starting
values and progression use the selected data rather than always Soldier.
-- [ ] Choose a faction at creation. Check: the faction persists and is correctly
+- [x] Choose a faction at creation. Check: the faction persists and is correctly
represented to other clients.
-- [ ] Choose appearance at creation. Check: supported appearance choices survive
+- [x] Choose appearance at creation. Check: supported appearance choices survive
reconnect and are rendered consistently to another player.
- [ ] Grant one profession's starter loadout. Check: a new character receives
the expected items once; reconnecting does not grant another set.
+ Browser creation now allocates all twelve professions' startup crystals,
+ weapons/actions, the faction map and sided gifts atomically. Engineer gets
+ one QL1 robot shell. This does not complete their gameplay support. Audit
+ equip/use/unequip, requirements, charge consumption, deaths/reclaim and cold
+ recovery for every issued item. Most solar weapons, startup crystals,
+ startup healing kits, maps, shell, boards and shirt remain unsupported by
+ the current use/equipment handlers. Prefer shared catalog-driven rules.
+ Corroborate the four provisional pistol allocations, MA Oak Bo allocation,
+ and observed laboratory/first-aid issue counts 25/3; see
+ [starting-state evidence](docs/character-creation.md).
- [ ] Reconstruct the original Arrival Hall and training-ground introduction.
Check all three factions' entry/exit flow, authored tutorial NPC identities,
dialogues, starter instructions and camera state. Replace training NPC
placeholder names using period evidence. Original door transforms and usable
entry checks are in [character creation](docs/character-creation.md) and
[player appearance](docs/character-appearance.md).
+ Audit first death, reclaim and resurrection in every faction's training
+ ground, including characters that have never used an insurance scanner.
- [x] Populate a new player's action bar with the default actions. Check: a
fresh character's native action bar contains the appropriate starter actions
on first login; reconnecting preserves the layout and existing player edits.
@@ -997,12 +1010,17 @@ and unresolved indoor lifecycle are explicit in [flight](docs/vehicles.md#yalmah
Automated transaction/session tests and hardware WASM checks are recorded
in [browser accounts](docs/browser-accounts.md), including a normal-shutdown
callback fix found during session replacement.
-- [ ] Add Create character to Options. Guide players through the original
+- [x] Add Create character to Options. Guide players through the original
character-creation choices, including breed, profession and side, then start
the new character in the appropriate training grounds. Research the 14.9.1
creation sequence and starting state; test every supported choice and failed
or interrupted creation without changing an existing character.
-- [ ] Make the Options account flows explicit: Create character from scratch,
+ Browser creation enters the chosen training ground directly; the original
+ intermediate Arrival Hall, initial camera and full starter-item gameplay
+ remain open above. All 255 heads, twelve professions and nine faction/skin
+ combinations have automated and hardware WASM checks; see
+ [creation verification](docs/character-creation.md#verification).
+- [x] Make the Options account flows explicit: Create character from scratch,
Adopt this visitor and choose its name, or Log in to an existing character.
Show username/password fields only after selecting the relevant flow, with
clear labels and a way back. Check visitor/named players, mobile layout,
diff --git a/client/browser/index.html b/client/browser/index.html
@@ -48,7 +48,10 @@
dialog label { display: block; margin: 12px 0; }
#menu-error { color: #ffb0a0; }
#menu-error:empty { display: none; }
- #account-form { margin-top: 20px; border-top: 1px solid #777; }
+ #account-panel { margin-top: 20px; border-top: 1px solid #777; }
+ #account-panel fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
+ #account-choices button { display: block; width: 100%; margin: 8px 0; }
+ #account-choices button[hidden] { display: none; }
#account-form input { box-sizing: border-box; display: block; width: 100%; margin-top: 6px; padding: 8px; }
#account-error { color: #ffb0a0; }
#account-error:empty { display: none; }
@@ -97,14 +100,50 @@
<label><input id="touch-enabled" type="checkbox"> Touch controls</label>
<p>Left pad: move. Swipe: steer. Two fingers: orbit and pinch to zoom. Hold: right click.</p>
</div>
- <form id="account-form" hidden>
+ <section id="account-panel" hidden>
<p id="account-current"></p>
- <label>Player name <input id="account-name" name="name" autocomplete="username" maxlength="254" pattern="[A-Za-z][A-Za-z0-9]*" required></label>
- <label>Password <input id="account-password" name="password" type="password" autocomplete="current-password" maxlength="1024" required></label>
- <button id="claim-button" name="action" value="claim">Choose name</button>
- <button id="login-button" name="action" value="login">Log in</button>
+ <fieldset id="account-choices" disabled>
+ <button id="create-button" type="button">Create character from scratch</button>
+ <button id="claim-button" type="button" hidden>Adopt this visitor</button>
+ <button id="login-button" type="button">Log in to an existing character</button>
+ </fieldset>
+ <form id="account-form" hidden>
+ <h2 id="account-title"></h2>
+ <p id="account-description"></p>
+ <fieldset id="account-fields">
+ <fieldset id="creation-fields" hidden disabled>
+ <label>Breed <select id="creation-breed">
+ <option value="1">Solitus</option><option value="2">Opifex</option>
+ <option value="3">Nanomage</option><option value="4">Atrox</option>
+ </select></label>
+ <label>Sex <select id="creation-sex"></select></label>
+ <label>Head <select id="creation-head"></select></label>
+ <label>Build <select id="creation-build">
+ <option value="0">Slim</option><option value="1" selected>Normal</option><option value="2">Heavy</option>
+ </select></label>
+ <label>Height <select id="creation-height">
+ <option value="90">Short</option><option value="100" selected>Normal</option><option value="110">Tall</option>
+ </select></label>
+ <label>Profession <select id="creation-profession" required>
+ <option value="">Choose a profession</option>
+ <option value="1">Soldier</option><option value="2">Martial Artist</option><option value="3">Engineer</option>
+ <option value="4">Fixer</option><option value="5">Agent</option><option value="6">Adventurer</option>
+ <option value="7">Trader</option><option value="8">Bureaucrat</option><option value="9">Enforcer</option>
+ <option value="10">Doctor</option><option value="11">Nano-Technician</option><option value="12">Meta-Physicist</option>
+ </select></label>
+ <label>Side <select id="creation-side" required>
+ <option value="">Choose a side</option><option value="0">Neutral</option><option value="1">Clan</option><option value="2">Omni-Tek</option>
+ </select></label>
+ </fieldset>
+ <label>Player name <input id="account-name" name="name" autocomplete="username" maxlength="254" required></label>
+ <p>4-12 letters or digits; at least four initial letters, digits only at the end. Other characters are removed and capitalization is adjusted.</p>
+ <label>Password <input id="account-password" name="password" type="password" autocomplete="current-password" maxlength="1024" required></label>
+ <button id="account-back" type="button">Back</button>
+ <button id="account-submit" type="submit"></button>
+ </fieldset>
+ </form>
<p id="account-error" role="status"></p>
- </form>
+ </section>
</dialog>
<script>
const status = document.querySelector('#loading');
@@ -918,45 +957,100 @@ show();
<script id="account-controls">
const accountForm = document.querySelector('#account-form');
const accountError = document.querySelector('#account-error');
+ const accountChoices = document.querySelector('#account-choices');
+ const accountFields = document.querySelector('#account-fields');
+ const creationFields = document.querySelector('#creation-fields');
const claimButton = document.querySelector('#claim-button');
- const loginButton = document.querySelector('#login-button');
+ const creationBreed = document.querySelector('#creation-breed');
+ const creationSex = document.querySelector('#creation-sex');
+ const creationHead = document.querySelector('#creation-head');
+ let accountAction = '', creationHeads = [];
+
+ // Breed and sex restrict the head list; its mesh also selects the matching skin.
+ function updateCreationHeads() {
+ const heads = creationHeads.filter(head => head.breed === Number(creationBreed.value) && head.sex === Number(creationSex.value));
+ creationHead.replaceChildren(...heads.map((head, index) => new Option('Head ' + (index + 1), head.mesh)));
+ }
+ creationBreed.onchange = () => {
+ creationSex.replaceChildren(...(creationBreed.value === '4' ? [new Option('Androgynous', '1')] :
+ [new Option('Male', '2'), new Option('Female', '3')]));
+ updateCreationHeads();
+ };
+ creationSex.onchange = updateCreationHeads;
+
+ // Keep the three account flows separate and clear abandoned credentials on Back.
+ for (const [action, title, description] of [
+ ['create', 'Create character', 'Start a new level-1 character in your side\'s training grounds. Named characters remain available through Log in.'],
+ ['claim', 'Adopt this visitor', 'Keep this character, including its equipment and progress, with a name and password.'],
+ ['login', 'Log in', 'Switch to an existing character using its name and password.']
+ ]) {
+ document.querySelector('#' + action + '-button').onclick = () => {
+ accountAction = action;
+ accountChoices.hidden = true;
+ accountForm.hidden = false;
+ creationFields.hidden = creationFields.disabled = action !== 'create';
+ document.querySelector('#account-title').textContent = title;
+ document.querySelector('#account-description').textContent = description +
+ (action === 'create' && !claimButton.hidden ? ' Adopt this visitor first if you want to return to it later.' : '');
+ document.querySelector('#account-submit').textContent = title;
+ document.querySelector('#account-password').autocomplete = action === 'login' ? 'current-password' : 'new-password';
+ document.querySelector(action === 'create' ? '#creation-breed' : '#account-name').focus();
+ };
+ }
+ document.querySelector('#account-back').onclick = () => {
+ accountForm.hidden = true;
+ accountChoices.hidden = false;
+ accountError.textContent = '';
+ document.querySelector('#account-name').value = document.querySelector('#account-password').value = '';
+ document.querySelector('#' + accountAction + '-button').focus();
+ accountAction = '';
+ };
Module.onOptionsOpen = async () => {
- accountForm.hidden = false;
+ if (accountRequest) return;
+ document.querySelector('#account-panel').hidden = false;
+ accountForm.hidden = true;
+ accountChoices.hidden = false;
+ accountChoices.disabled = true;
+ accountAction = '';
+ document.querySelector('#account-name').value = document.querySelector('#account-password').value = '';
accountError.textContent = '';
- claimButton.hidden = claimButton.disabled = true;
- loginButton.disabled = true;
+ claimButton.hidden = true;
try {
const response = await fetch('browser-account');
if (!response.ok) { accountError.textContent = await response.text(); return; }
const player = await response.json();
- document.querySelector('#account-current').textContent = player.visitor ?
- `Playing as ${player.name}. Choose a name and password to keep this player, or log in to an existing player.` : `Playing as ${player.name}.`;
+ document.querySelector('#account-current').textContent = `Playing as ${player.name}.`;
+ creationHeads = player.heads;
+ creationBreed.value = '1';
+ creationBreed.onchange();
claimButton.hidden = !player.visitor;
- claimButton.disabled = !player.visitor;
- loginButton.disabled = false;
+ accountChoices.disabled = false;
} catch (error) {
- accountForm.hidden = false;
accountError.textContent = 'Could not load player details. Open Options again to retry.';
}
};
accountForm.onsubmit = async event => {
event.preventDefault();
- if (accountRequest) return;
+ if (accountRequest || !accountAction) return;
accountRequest = true;
- claimButton.disabled = loginButton.disabled = true;
+ accountFields.disabled = true;
accountError.textContent = '';
+ const values = new URLSearchParams({name: document.querySelector('#account-name').value,
+ password: document.querySelector('#account-password').value});
+ if (accountAction === 'create') {
+ for (const [name, selector] of [['head_mesh', 'head'], ['profession', 'profession'], ['side', 'side'], ['build', 'build'], ['height', 'height']]) {
+ values.set(name, document.querySelector('#creation-' + selector).value);
+ }
+ }
try {
- const response = await fetch('browser-account/' + event.submitter.value, {method: 'POST',
- body: new URLSearchParams({name: document.querySelector('#account-name').value,
- password: document.querySelector('#account-password').value})});
+ const response = await fetch('browser-account/' + accountAction, {method: 'POST', body: values});
if (response.ok) { location.reload(); return; }
accountError.textContent = await response.text();
} catch (error) {
accountError.textContent = 'Could not contact the server. Please try again.';
}
accountRequest = false;
- claimButton.disabled = claimButton.hidden;
- loginButton.disabled = false;
+ accountFields.disabled = false;
if (accountClosed !== null) {
const replaced = accountClosed;
accountClosed = null;
diff --git a/client/tests/browser_accounts.mjs b/client/tests/browser_accounts.mjs
@@ -13,6 +13,8 @@ function accountPage() {
style = {};
dataset = {};
close() { this.open = false; }
+ focus() { this.focused = true; }
+ replaceChildren(...children) { this.children = children; this.value = String(children[0]?.value ?? ''); }
}
const document = new EventTarget();
document.querySelector = selector => {
@@ -22,6 +24,7 @@ function accountPage() {
const window = new EventTarget();
const context = vm.createContext({
document, window, navigator: {userAgent: 'Desktop'}, console, URLSearchParams,
+ Option: class { constructor(text, value) { this.text = text; this.value = String(value); } },
localStorage: {getItem() { return null; }},
location: {reload: () => reloads.push(true)},
setTimeout: callback => timers.push(callback),
@@ -38,61 +41,71 @@ function accountPage() {
vm.runInContext(html.match(/<script id="account-controls">([\s\S]*?)<\/script>/)[1], context);
return {context, requests, replies, reloads, timers, element: document.querySelector,
open: () => context.Module.onOptionsOpen(),
- submit: action => document.querySelector('#account-form').onsubmit({preventDefault() {}, submitter: {value: action}})};
+ choose: action => document.querySelector('#' + action + '-button').onclick(),
+ submit: () => document.querySelector('#account-form').onsubmit({preventDefault() {}})};
}
function response(status, body) {
return {ok: status >= 200 && status < 300, json: async () => body, text: async () => body};
}
-test('Options offers a visitor a name and password without exposing credentials', async () => {
+const heads = [{mesh: 40681, breed: 1, sex: 2, race: 1}, {mesh: 40629, breed: 1, sex: 3, race: 1},
+ {mesh: 40111, breed: 4, sex: 1, race: 1}];
+
+test('Options offers three explicit flows with credentials hidden until a choice', async () => {
const page = accountPage();
- page.replies.push(response(200, {name: 'Visitor1', visitor: true}));
+ page.replies.push(response(200, {name: 'Visitor1', visitor: true, heads}));
await page.open();
assert.equal(page.element('#claim-button').hidden, false);
- assert.equal(page.element('#claim-button').disabled, false);
- assert.equal(page.element('#login-button').disabled, false);
- assert.equal(page.element('#account-form').hidden, false);
+ assert.equal(page.element('#account-choices').disabled, false);
+ assert.equal(page.element('#account-form').hidden, true);
assert.match(page.element('#account-current').textContent, /Playing as Visitor1/);
assert.equal(page.element('#account-password').value, '');
assert.equal(page.requests[0].url, 'browser-account');
});
-test('a named player can log in but cannot claim the character again', async () => {
+test('a named player can create or log in with adoption hidden', async () => {
const page = accountPage();
- page.replies.push(response(200, {name: 'Alice', visitor: false}));
+ page.replies.push(response(200, {name: 'Alice', visitor: false, heads}));
await page.open();
assert.equal(page.element('#claim-button').hidden, true);
- assert.equal(page.element('#claim-button').disabled, true);
- assert.equal(page.element('#login-button').disabled, false);
+ assert.equal(page.element('#account-choices').disabled, false);
assert.equal(page.element('#account-current').textContent, 'Playing as Alice.');
});
-for (const action of ['claim', 'login']) {
+for (const action of ['create', 'claim', 'login']) {
test(`${action} posts exact credentials and reloads after success despite a session replacement notification`, async () => {
const page = accountPage();
+ page.choose(action);
page.element('#account-name').value = 'Alice';
page.element('#account-password').value = ' spaced password ';
+ for (const [name, value] of [['head', '40111'], ['profession', '12'], ['side', '0'], ['build', '2'], ['height', '110']]) {
+ page.element('#creation-' + name).value = value;
+ }
let finish;
page.replies.push(new Promise(resolve => { finish = resolve; }));
- const pending = page.submit(action);
+ const pending = page.submit();
page.context.Module.onGameClosed(true);
assert.equal(page.element('#player-menu').open, true);
- assert.equal(page.element('#claim-button').disabled, true);
- assert.equal(page.element('#login-button').disabled, true);
+ assert.equal(page.element('#account-fields').disabled, true);
assert.deepEqual(page.reloads, []);
assert.equal(page.requests[0].url, 'browser-account/' + action);
assert.equal(page.requests[0].options.method, 'POST');
assert.equal(page.requests[0].options.body.get('name'), 'Alice');
assert.equal(page.requests[0].options.body.get('password'), ' spaced password ');
+ assert.equal(page.requests[0].options.body.get('head_mesh'), action === 'create' ? '40111' : null);
+ assert.equal(page.requests[0].options.body.get('profession'), action === 'create' ? '12' : null);
+ assert.equal(page.requests[0].options.body.get('side'), action === 'create' ? '0' : null);
+ assert.equal(page.requests[0].options.body.get('build'), action === 'create' ? '2' : null);
+ assert.equal(page.requests[0].options.body.get('height'), action === 'create' ? '110' : null);
- await page.submit(action);
+ await page.submit();
finish(response(204, ''));
await pending;
@@ -104,23 +117,24 @@ for (const action of ['claim', 'login']) {
test('failed login keeps the current game and form available without reloading', async () => {
const page = accountPage();
+ page.choose('login');
page.replies.push(response(401, 'Incorrect player name or password.'));
- await page.submit('login');
+ await page.submit();
assert.deepEqual(page.reloads, []);
assert.equal(page.element('#account-error').textContent, 'Incorrect player name or password.');
assert.equal(page.element('#player-menu').open, true);
- assert.equal(page.element('#claim-button').disabled, false);
- assert.equal(page.element('#login-button').disabled, false);
+ assert.equal(page.element('#account-fields').disabled, false);
});
test('network failure reports a retryable error and preserves a pending takeover', async () => {
const page = accountPage();
+ page.choose('login');
let fail;
page.replies.push(new Promise((_, reject) => { fail = reject; }));
- const pending = page.submit('login');
+ const pending = page.submit();
page.context.Module.onGameClosed(true);
fail(new Error('Connection lost'));
await pending;
@@ -140,10 +154,58 @@ for (const reply of [response(401, 'Reconnect to continue.'), new Error('Offline
await page.open();
- assert.equal(page.element('#account-form').hidden, false);
- assert.equal(page.element('#claim-button').disabled, true);
- assert.equal(page.element('#login-button').disabled, true);
+ assert.equal(page.element('#account-panel').hidden, false);
+ assert.equal(page.element('#account-form').hidden, true);
+ assert.equal(page.element('#account-choices').disabled, true);
assert(page.element('#account-error').textContent.length > 0);
assert.deepEqual(page.reloads, []);
});
}
+
+test('breed and sex filter original heads, including the androgynous Atrox template', async () => {
+ const page = accountPage();
+ page.replies.push(response(200, {name: 'Visitor1', visitor: true, heads}));
+ await page.open();
+ page.choose('create');
+
+ assert.equal(page.element('#creation-head').value, '40681');
+ assert.equal(page.element('#creation-head').children.length, 1);
+ assert.equal(page.element('#creation-fields').disabled, false);
+ assert.equal(page.element('#account-password').autocomplete, 'new-password');
+ assert.match(page.element('#account-description').textContent, /Adopt this visitor first/);
+
+ page.element('#creation-sex').value = '3';
+ page.element('#creation-sex').onchange();
+
+ assert.equal(page.element('#creation-head').value, '40629');
+
+ page.element('#creation-breed').value = '4';
+ page.element('#creation-breed').onchange();
+
+ assert.equal(page.element('#creation-sex').value, '1');
+ assert.equal(page.element('#creation-sex').children.length, 1);
+ assert.equal(page.element('#creation-head').value, '40111');
+});
+
+test('Back clears credentials and disables creation-only validation in the other flows', async () => {
+ const page = accountPage();
+ page.choose('create');
+ page.element('#account-name').value = 'Alice';
+ page.element('#account-password').value = 'secret';
+
+ page.element('#account-back').onclick();
+ await page.submit();
+
+ assert.equal(page.element('#account-form').hidden, true);
+ assert.equal(page.element('#account-choices').hidden, false);
+ assert.equal(page.element('#account-name').value, '');
+ assert.equal(page.element('#account-password').value, '');
+ assert.equal(page.element('#create-button').focused, true);
+ assert.equal(page.requests.length, 0);
+
+ page.choose('login');
+
+ assert.equal(page.element('#creation-fields').disabled, true);
+ assert.equal(page.element('#creation-fields').hidden, true);
+ assert.equal(page.element('#account-password').autocomplete, 'current-password');
+});
diff --git a/docs/browser-accounts.md b/docs/browser-accounts.md
@@ -12,8 +12,12 @@ small screens.
A Visitor can choose a player name and password in Options without creating a
replacement character. The player ID, items, XP, skills, resources, location,
team and native per-character preferences remain attached to that character.
-The login button accepts an existing player name and password. A successful
-login loads that character; a failed login leaves the current player usable.
+Options first offers Create character from scratch, Adopt this visitor, and
+Log in to an existing character. Adoption is hidden for named characters.
+Credentials appear only after choosing a flow; Back clears them. Creation
+also offers the original breed/sex/head, build, height, profession and side
+choices. A successful login loads that character; a failed submission leaves
+the current player usable.
## Account state and transactions
@@ -27,11 +31,13 @@ requires Go 1.26, which is now the declared build/test minimum. Password hashing
runs outside the simulation/database locks; a separate mutex bounds its memory
use without serializing the simulation with expensive password work.
-The browser name form accepts ASCII letters and digits with a leading letter,
-up to the existing native 254-byte name capacity. Visitor-prefixed names are
-reserved. Names are unique without ASCII case distinctions. These are browser
-prototype constraints; the original character creator's exact naming rules
-remain a separate research task. Passwords are nonempty and limited to 1024
+Names follow the original creator: remove characters other than ASCII letters
+and digits, capitalize the first letter and lowercase the rest, then require
+4-12 characters with four initial letters and optional trailing digits.
+Letters cannot follow digits. NUL-containing input is rejected. Visitor-prefixed
+names are reserved, and names are unique without ASCII case distinctions.
+Original server profanity/reservation lists remain unknown. Login applies the
+same normalization. Passwords are nonempty and limited to 1024
bytes, without trimming, case folding or composition rules.
Claiming a name commits its name, salt, hash and replacement browser credential
@@ -42,6 +48,18 @@ leaving its old cookie authorized. Related changes commit before the response
sets a cookie or reports success; ignored writes and failed COMMITs roll back.
Ordinary character/profile/checkpoint saves leave password columns untouched.
+Creation builds a detached level-1 character, then atomically inserts the
+character, password, player row, starter item identities and locations,
+identity counters and abandoned browser credential. No shared character/item
+cache or counter changes before COMMIT. Every insert must affect one row;
+ignored inserts fail the transaction. The existing character and its password
+remain available for later login. The new character can be recovered by name
+and password if its success response is lost; the old cookie cannot replay
+creation after commit. An abandoned visitor has no password for later login;
+the creation form tells visitors to adopt it first if they want to return.
+See [creation choices and starting state](character-creation.md)
+for the historical evidence and remaining gameplay gaps.
+
The authenticated cookie is HttpOnly, SameSite=Lax and Secure over HTTPS, using
the configured URL prefix. Account responses are not cached. Mutating account
requests use Go's same-origin request protection. World/chat connections carry
@@ -73,6 +91,20 @@ visible lookup failures. Control regressions cover desktop placement, the
150-pixel boundary, retained modal access and return to canvas focus, alongside
the existing mobile/input cases.
+Creation regressions cover all 255 heads and all 252 combinations of seven
+body templates, twelve professions and three sides. They check original
+appearance choices, initial stats, every issued item and ordinary inventory
+placement. Invalid/missing choices, duplicate names, missing/revoked cookies,
+concurrent/replayed creation, failed/ignored inserts, failed counter or old
+credential updates, and deferred COMMIT failure leave the current character
+and shared caches/counters unchanged. Failed transactions can retry. A named
+player's equipped item and credits survive creation, login and cold loading.
+The account/catalog response contains only name, visitor status and public
+head choices. The browser's eleven account tests cover separate flows, filtered
+heads, hidden credentials, Back, pending requests and field validation state.
+Both issued charged kits also pass repeated split, rejoin and cold-loading
+checks without losing quantities or reusing an item identity.
+
The original `Clientr.exe!sub_28005684` CRT startup calls MSVCRT `exit` after
WinMain cleanup. The browser keeps that cleanup and the maintained
`linux_imports.c:crt_exit` adapter's termination callbacks, stdio flushing and
diff --git a/docs/character-creation.md b/docs/character-creation.md
@@ -24,11 +24,12 @@ lists the original resource's Opifex and Nanomage starting values. Its level-220
tables are expansion-era corroboration, rather than an exact 14.9.1 server
capture.
-The browser currently creates Solitus Soldiers. Its visitors use the complete
-original Solitus head catalog and matching skin race. The server supports all
-seven original breed/sex appearance templates, explicit head identities and
-gameplay height; see [player appearance](character-appearance.md). The browser
-creation flow for selecting breed, profession and appearance remains open.
+Anonymous browser visitors use Solitus Soldiers with the complete original
+Solitus head catalog and matching skin race. Options also offers explicit new
+character creation: four breeds, seven breed/sex templates, all 255 original
+heads, three builds, gameplay heights 90/100/110, twelve professions and three
+sides. The server derives breed, sex and skin from the selected head, rejecting
+unknown meshes and unsupported choices. See [player appearance](character-appearance.md).
Profiles with explicitly supplied stats retain those values.
All raw skills start at 5 and unspent IP at 1500. Those remain reconstruction
@@ -55,8 +56,8 @@ catalog are documented in [player appearance](character-appearance.md).
with the helper at `0x10038c10`: length 4-12, at least four initial ASCII
letters, and optional trailing digits. Letters cannot follow digits. The
normalizer at `0x10038d00` removes other characters and uses first-uppercase,
-remaining-lowercase spelling. The browser's current prototype naming limits
-still need to be aligned with that original creation behavior. Original server
+remaining-lowercase spelling. Browser creation, adoption and login apply these
+rules. Original server
profanity and reserved-name policy remains unknown.
The selected version includes Arrival Hall playfield 4604 and
@@ -76,6 +77,13 @@ backyard-instance allocation remain unproven. Raw door bytes, hashes and
terrain measurements are retained in
`local/browser-creation-research/training-door-locations.json`.
+Browser creation currently bypasses the intermediate Arrival Hall and enters
+the chosen side's training ground directly. It moves 2.5 meters forward from
+the authored entrance door, retains its facing and uses terrain height +0.75m,
+matching the existing zoning clearance policy. This is a usable reconstruction
+policy, not a recovered original-server spawn offset. Original Arrival Hall
+NPCs, final faction-choice sequence and initial camera state remain open.
+
The shipped startup crystal tips instruct manual upload from inventory. They
identify the following original QL1 crystal items and resulting nanos:
@@ -101,19 +109,75 @@ automatically learning nanos or granting extra trained skills.
Original descriptions/tutorials identify startup Soldier assault rifle 121569,
Agent rifle 121568, Fixer SMG 121571, Trader shotgun 121570, Enforcer bat 121564,
MP shield 121566 and MA attack Jab of the Snake 117610. Solar pistol 121567 is
-a starter weapon, but its exact profession allocation still needs corroboration.
+a starter weapon. An older local Engineer Guide explicitly lists it for an
+Engineer starting on Rubi-Ka; that guide's 2012 touched date does not prove
+exact 14.9.1 allocation. Creation currently assigns one pistol to Engineer,
+Adventurer, Bureaucrat, Doctor and Nano-Technician. The latter four assignments
+are provisional reconstruction choices and need period corroboration.
Tutorials instruct manually equipping the weapons. The mere existence of MA
Oak Bo 121565 does not establish a creation grant.
The original startup laboratory 116628 has capacity 200 and restores 15 health
and 15 nano; first-aid kit 116629 has capacity 300 and restores 5-7 of each.
Capacity metadata does not prove the original server's issued charge counts.
-Startup maps are 116693 Omni, 116696 Clan and 116697 Neutral. Clan board 96358,
-Omni board 99719 and Omni shirt 29426 have original startup references. Exact
-allocation, counts, credits and complete starting loadouts remain open.
+The [February 2002 first-hand walkthrough](https://game.watch.impress.co.jp/docs/20020213/yuki14_2.htm)
+and its [arrival inventory screenshot](https://game.watch.impress.co.jp/docs/20020213/b12.jpg)
+show laboratory/first-aid counters reading 25/03; original extracted icons
+match. Creation issues 25/3, using that observation as a provisional policy:
+prior use cannot be excluded. Stackability comes from the catalog's Can stat
+30, bit 9, rather than an item whitelist.
+
+Startup maps are 116693 Omni, 116696 Clan and 116697 Neutral. The same period
+walkthrough supports a map, one Engineer robot shell (original QL1 identity
+43328), Clan board 96358 or Omni board 99719, and Omni shirt 29426. Creation
+grants these, the profession's crystals above and its weapon/action in ordinary
+inventory. Nothing is pre-equipped or prelearned. Original resources and the
+bounded source search are retained in
+`local/browser-creation-flow-research/loadout-ledger.md`.
+
+Allocation/persistence does not complete the starter items' gameplay support.
+Most solar weapons, startup crystals, the two startup healing items, maps,
+Engineer shell, boards and shirt still need their equipment/use/effect audits.
+Existing raw-skill seeds do not automatically satisfy every crystal's original
+requirements. Do not bypass those requirements to make the loadout usable.
+These gaps, exact pistol/MA allocation and original credits/resource seeds
+remain tracked in TODO.md.
## Verification
+`server/browser_creation_test.go` exercises public HTTP creation for all 255
+heads, then checks cold loading. A separate matrix checks complete issued
+inventories for every profession/side/body template combination. SQL failure
+injection checks each insert table, identity counters, old credential and
+deferred COMMIT; none can publish partial state, and retry succeeds. Concurrent
+creation with one old cookie commits once. Existing named characters retain
+their password, equipped item and credits when creating another character.
+
+Hardware Chromium/WASM checks created all twelve professions, covering all
+seven body templates, all builds/heights and the three training grounds.
+Native memory snapshots agree with SQLite on each item instance, template,
+slot and count. Each training-ground entry allowed movement away from the
+door. Cancellation retained the visitor; invalid naming and wrong passwords
+retained the active session. Desktop keyboard Tab advanced between account
+inputs, and mobile creation/adoption/login worked at 390x844 and 390x500.
+A rejected starter shotgun equip retained its native inventory row and item
+identity. Captures and assertions are in `local/browser-creation-flow-smoke/`.
+
+The two-client checks exposed an independent compact-appearance packing bug:
+nearby clients interpreted skin race as faction. The corrected 14.9.1 layout
+keeps Side at bits 0-2 and skin Race at 10-11; see
+[the native field trace](protocol.md#combat-in-1491).
+After the correction, all nine faction/skin combinations matched Side33 and
+Race89 in the local and observing WASM clients, with the exact selected meshes
+in the observer's captured packets. Cold password login restored the adopted
+visitor's 200 XP and the earlier Soldier; all twelve professions' item rows
+matched the pre-restart database exactly. No browser/worker errors occurred.
+The final full Go suite and focused creation race repetitions passed, alongside
+85 browser control/account cases and the two issued-kit split/rejoin/restart
+regressions. Cleanup removed only the owned fifteen characters and 88 items;
+every unrelated stopped-world row retained its hash, with SQLite foreign-key
+and integrity checks passing.
+
`server/character_initialization_test.go` checks all four breed baselines and
every raw ability/skill against its native level-1 cap. Browser-launch tests
exercise durable creation, accepted training, rejected increases beyond the
diff --git a/docs/inventory-stacks.md b/docs/inventory-stacks.md
@@ -8,6 +8,11 @@ instructs Ctrl-clicking to separate a charge. It has no action/effect sections.
New fixture grants use its three-charge catalog quantity. Production drops
and tradeskill use remain separate features.
+Stackability now follows the original Can stat 30, bit 9, for ordinary type
+51005 items. This also permits creation's charged startup kits to persist and
+use the existing stack operations. It does not implement their use effects or
+establish every item's merge cap, deletion effects or creation quantity.
+
[Auno's historical 12.8 record](https://auno.org/ao/db.php?id=152030&patch=12080000)
already includes the splitting instruction. Its
[current record and dated comments](https://auno.org/ao/db.php?id=152030)
diff --git a/docs/protocol-13.2.md b/docs/protocol-13.2.md
@@ -59,6 +59,10 @@ Widening the old value without repacking changes the character's appearance.
The tested human `0x315` becomes `0x629`; the generic creature candidate
`0xe5` becomes `0x1c9`.
+The selected 14.9.1 target uses Side in the low three bits and skin Race in
+bits 10-11. Do not reuse the Race/Side names in this older table for the current
+target; see the [14.9.1 field trace](protocol.md#combat-in-1491).
+
The compact absolute coordinate scales are unchanged: unsigned X/Z in eighths,
signed Y in sixteenths. In 13.2 the reader multiplies X/Z by `0.125` at
`0x1015070c`, and Y by `0.0625` at `0x10150710`. Nearby constants and vtable
diff --git a/docs/protocol.md b/docs/protocol.md
@@ -671,13 +671,26 @@ skips candidates whose InPlay stat is zero (`0x100264c5` through
`client/game/kkr.dll/lifted-0015.c`, function `sub_36026320`.
The same function compares stat 33 (`Side`): ordinary enemy targeting excludes
the player's own side, while its friendly-targeting mode requires that side.
-Appearance's low two bits become the side field in the 14.9.1 packed value;
+Appearance's low three bits become the side field in the 14.9.1 packed value;
NPC side 0 and player side 2 satisfy the enemy-targeting comparison.
The local PvE implementation assigns side 3 to creature NPCs when converting
SCFU for 14.9.1, preserving their remaining appearance fields and human NPC
factions. This enables normal enemy Tab selection against the default player;
it is an explicit local combat policy, not a recovered historical faction.
+For the selected 14.9.1 target, compact appearance places **Side at bits 0-2**
+and **skin Race at bits 10-11**. Build is at 3-4, breed at 5-7, sex at 8-9
+and face hint at 12-16. The server repacks its internal uint16 fields into
+this layout. These two field names must not be copied from the older layout
+table: doing so makes a skin-race-1 Omni player appear Clan to nearby clients.
+The translated original reader in `client/game/kkr.dll/lifted-0038.c`,
+`sub_36082DA0` at labels `36083014` through `36083058`, stores the low three
+bits at message offset 0x113 and bits 10-11 at 0x111. Activation
+`sub_360821D0`, labels `3608245A` through `36082470`, writes the latter to
+Race89. Initialization `sub_36082AD0` writes the former to Side33 at
+`36082D2A` through `36082D35`. Hardware two-client snapshots independently
+reproduced the wrong Side33 before the corrected repacking.
+
Core packet evidence:
`ev_8687fd6e603c302e4ab3fee7b405ea3e5c9a615e0f56bff18dd20ff949da8d4c`.
Stat and stop-controller evidence:
diff --git a/server/browser_account.go b/server/browser_account.go
@@ -1,6 +1,7 @@
package main
import (
+ "ao/server/gamedata"
"crypto/rand"
"crypto/sha256"
"crypto/subtle"
@@ -21,24 +22,28 @@ func (server *server) setBrowserCookie(w http.ResponseWriter, r *http.Request, t
func (server *server) browserAccountInfo(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-store")
server.mutex.Lock()
- defer server.mutex.Unlock()
player := server.browserCharacter_locked(r)
if player == nil {
+ server.mutex.Unlock()
http.Error(w, "Your browser session has ended. Reconnect to continue.", http.StatusUnauthorized)
return
}
db, err := server.database()
if err != nil {
+ server.mutex.Unlock()
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
var claimed bool
if err := db.QueryRow("SELECT length(password_hash)>0 FROM characters WHERE id=?", player.id).Scan(&claimed); err != nil {
+ server.mutex.Unlock()
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
+ name, visitor := player.name, !claimed && player.name == fmt.Sprintf("Visitor%d", player.id)
+ server.mutex.Unlock()
w.Header().Set("Content-Type", "application/json")
- json.NewEncoder(w).Encode(map[string]any{"name": player.name, "visitor": !claimed && player.name == fmt.Sprintf("Visitor%d", player.id)})
+ json.NewEncoder(w).Encode(map[string]any{"name": name, "visitor": visitor, "heads": gamedata.PlayerAppearances.Heads})
}
func (server *server) browserPassword(password string, salt []byte) []byte {
@@ -51,7 +56,7 @@ func (server *server) browserPassword(password string, salt []byte) []byte {
func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-store")
action := r.PathValue("action")
- if action != "claim" && action != "login" {
+ if action != "claim" && action != "login" && action != "create" {
http.NotFound(w, r)
return
}
@@ -60,17 +65,21 @@ func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Invalid account form.", http.StatusBadRequest)
return
}
- name, password := r.PostForm.Get("name"), r.PostForm.Get("password")
- validName := len(name) > 0 && len(name) <= 254
- for index, letter := range name {
- if (letter < 'A' || letter > 'Z') && (letter < 'a' || letter > 'z') && (index == 0 || letter < '0' || letter > '9') {
- validName = false
- }
- }
+ name, validName := browserPlayerName(r.PostForm.Get("name"))
+ password := r.PostForm.Get("password")
if !validName || len(password) == 0 || len(password) > 1024 {
- http.Error(w, "Use a name starting with a letter, followed by letters or digits, and a nonempty password (up to 1024 bytes).", http.StatusBadRequest)
+ http.Error(w, "Use a name of 4-12 letters or digits, with at least four initial letters and digits only at the end, and a nonempty password (up to 1024 bytes).", http.StatusBadRequest)
return
}
+ var created *character
+ if action == "create" {
+ var err error
+ created, err = server.browserCreation(r)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusBadRequest)
+ return
+ }
+ }
server.mutex.Lock()
current := server.browserCharacter_locked(r)
if current == nil {
@@ -89,7 +98,7 @@ func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
}
id := currentID
salt, expected := make([]byte, 16), make([]byte, 32)
- if action == "claim" {
+ if action != "login" {
rand.Read(salt)
} else {
err = db.QueryRow("SELECT id, password_salt, password_hash FROM characters WHERE name=? COLLATE NOCASE AND length(password_hash)>0", name).Scan(&id, &salt, &expected)
@@ -117,8 +126,8 @@ func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
return
}
player := server.characters[id]
- if action == "claim" {
- if current.name != fmt.Sprintf("Visitor%d", currentID) {
+ if action != "login" {
+ if action == "claim" && current.name != fmt.Sprintf("Visitor%d", currentID) {
http.Error(w, "This player already has a name.", http.StatusConflict)
return
}
@@ -132,14 +141,28 @@ func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
return
}
}
- var existing []byte
- if err := db.QueryRow("SELECT password_hash FROM characters WHERE id=?", id).Scan(&existing); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- if len(existing) != 0 {
- http.Error(w, "This player already has a password.", http.StatusConflict)
- return
+ if action == "claim" {
+ var existing []byte
+ if err := db.QueryRow("SELECT password_hash FROM characters WHERE id=?", id).Scan(&existing); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ if len(existing) != 0 {
+ http.Error(w, "This player already has a password.", http.StatusConflict)
+ return
+ }
+ } else {
+ if server.nextCharacter >= 999999 {
+ http.Error(w, "Player identities exhausted.", http.StatusInternalServerError)
+ return
+ }
+ id = server.nextCharacter + 1
+ player = created
+ player.id, player.name = id, name
+ if err := server.browserStartingItems_locked(player); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
}
} else if player == nil || !strings.EqualFold(player.name, name) {
http.Error(w, "Incorrect player name or password.", http.StatusUnauthorized)
@@ -156,7 +179,10 @@ func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
return
}
defer tx.Rollback()
- if action == "claim" {
+ if action == "create" {
+ player.browserTokenHash = credential
+ err = server.insertBrowserPlayer_locked(tx, player, salt, hash)
+ } else if action == "claim" {
err = updateRecord(tx, "characters", id, "name, password_salt, password_hash, browser_token_hash", []any{name, salt, hash, credential})
} else {
err = updateRecord(tx, "characters", id, "browser_token_hash", []any{credential})
@@ -173,6 +199,8 @@ func (server *server) browserAccount(w http.ResponseWriter, r *http.Request) {
}
if action == "claim" {
player.name, player.savedProfile.Name = name, name
+ } else if action == "create" {
+ server.publishBrowserPlayer_locked(player)
}
player.browserTokenHash, player.savedProfile.BrowserTokenHash = credential, credential
if currentID != id {
diff --git a/server/browser_account_test.go b/server/browser_account_test.go
@@ -120,7 +120,7 @@ func TestBrowserAccountLoginSwitchesOnlyAfterCorrectPassword(t *testing.T) {
func TestBrowserAccountRejectsInvalidClaimsWithoutChangingVisitor(t *testing.T) {
for _, scenario := range []struct{ name, password string }{
- {"", "password"}, {"123Alice", "password"}, {"Alice Bob", "password"}, {"Al\x00ice", "password"}, {"Al\u00e9ce", "password"},
+ {"", "password"}, {"123Alice", "password"}, {"Abc", "password"}, {"Al\x00ice", "password"}, {"Ali1ce", "password"},
{strings.Repeat("a", 255), "password"}, {"Visitor42", "password"}, {"vIsItOrAlice", "password"}, {"Alice", ""}, {"Alice", strings.Repeat("a", 1025)},
} {
t.Run(fmt.Sprintf("name=%q/length=%d", scenario.name, len(scenario.password)), func(t *testing.T) {
@@ -147,7 +147,7 @@ func TestBrowserAccountDuplicateNamesAndRepeatedClaim(t *testing.T) {
second := accountVisitor(t, world)
duplicate := accountRequest(world, second, "claim", "ALICE", "other password")
- repeated := accountRequest(world, firstClaim.Result().Cookies()[0], "claim", "Bob", "replacement password")
+ repeated := accountRequest(world, firstClaim.Result().Cookies()[0], "claim", "Bobby", "replacement password")
login := accountRequest(world, second, "login", "Alice", "password")
if duplicate.Code != 409 || repeated.Code != 409 || login.Code != 204 || world.characters[1].name != "Alice" || world.characters[2].name != "Visitor2" {
diff --git a/server/browser_creation.go b/server/browser_creation.go
@@ -0,0 +1,161 @@
+package main
+
+import (
+ "ao/server/gamedata"
+ "database/sql"
+ "fmt"
+ "net/http"
+ "strconv"
+ "strings"
+ "time"
+)
+
+func browserPlayerName(name string) (string, bool) {
+ // Match the original creator's cleanup, capitalization and trailing-digit rule.
+ if strings.ContainsRune(name, 0) {
+ return "", false
+ }
+ var letters []byte
+ for _, letter := range []byte(name) {
+ if letter >= 'A' && letter <= 'Z' || letter >= 'a' && letter <= 'z' || letter >= '0' && letter <= '9' {
+ letters = append(letters, letter)
+ }
+ }
+ name = strings.ToLower(string(letters))
+ if len(name) < 4 || len(name) > 12 {
+ return "", false
+ }
+ digits := false
+ for index, letter := range name {
+ if letter >= '0' && letter <= '9' {
+ if index < 4 {
+ return "", false
+ }
+ digits = true
+ } else if digits {
+ return "", false
+ }
+ }
+ return strings.ToUpper(name[:1]) + name[1:], true
+}
+
+func (server *server) browserCreation(r *http.Request) (*character, error) {
+ // The selected head determines breed, sex and skin together.
+ mesh, err := strconv.ParseUint(r.PostForm.Get("head_mesh"), 10, 32)
+ if err != nil {
+ return nil, fmt.Errorf("choose an original player head")
+ }
+ var selected gamedata.PlayerHead
+ for _, head := range gamedata.PlayerAppearances.Heads {
+ if head.Mesh == uint32(mesh) {
+ selected = head
+ break
+ }
+ }
+ if selected.Mesh == 0 {
+ return nil, fmt.Errorf("choose an original player head")
+ }
+ profession, professionErr := strconv.ParseUint(r.PostForm.Get("profession"), 10, 16)
+ side, sideErr := strconv.ParseUint(r.PostForm.Get("side"), 10, 16)
+ build, buildErr := strconv.ParseUint(r.PostForm.Get("build"), 10, 16)
+ height, heightErr := strconv.ParseUint(r.PostForm.Get("height"), 10, 16)
+ if professionErr != nil || profession < 1 || profession > 12 || sideErr != nil || side > 2 ||
+ buildErr != nil || build > 2 || heightErr != nil || height != 90 && height != 100 && height != 110 {
+ return nil, fmt.Errorf("choose a profession, side, build and height")
+ }
+ appearance := appearanceFields{Race: selected.Race, Breed: selected.Breed, Sex: selected.Sex, Fatness: uint16(build), Side: uint16(side)}
+ data := userData{Appearance: appearance.packed(), HeadMesh: selected.Mesh, Height: uint16(height),
+ Profession: uint16(profession), Level: 1, Running: true, Playfield: []uint32{954, 952, 950}[side]}
+
+ // Enter just beyond the authored backyard door, using the normal zone clearance.
+ door := server.zoneLinks["target"][data.Playfield].Doors[0]
+ data.Position, data.Rotation = door.Position, door.Rotation
+ x, y, z, w := door.Rotation[0], door.Rotation[1], door.Rotation[2], door.Rotation[3]
+ data.Position[0] += 2.5 * (2*x*z + 2*y*w)
+ data.Position[2] += 2.5 * (1 - 2*x*x - 2*y*y)
+ ground, _ := server.terrain[data.Playfield].elevation(data.Position[0], data.Position[2])
+ data.Position[1] = ground + 0.75
+ return data.character(), nil
+}
+
+func insertRow(tx *sql.Tx, table, columns string, fields []any) error {
+ result, err := tx.Exec("INSERT INTO "+table+" ("+columns+") VALUES (?"+strings.Repeat(", ?", len(fields)-1)+")", fields...)
+ if err != nil {
+ return err
+ }
+ changed, err := result.RowsAffected()
+ if err != nil {
+ return err
+ }
+ if changed != 1 {
+ return fmt.Errorf("%s insert affected %d rows", table, changed)
+ }
+ return nil
+}
+
+func (server *server) browserStartingItems_locked(player *character) error {
+ // Original startup weapons/crystals and sided gifts; provenance is in character-creation.md.
+ professions := [][]uint32{
+ {121569, 29092}, {117610, 43382}, {121567, 43329, 29194, 43328}, {121571, 43380},
+ {121568, 43383, 29191}, {121567, 28742}, {121570, 43378, 78417}, {121567, 43381, 29625},
+ {121564, 43379}, {121567, 28778, 43384}, {121567, 28815, 42111}, {121566, 43330, 29193},
+ }
+ side := unpackAppearance(player.appearance).Side
+ templates := []uint32{116628, 116629, []uint32{116697, 116696, 116693}[side]}
+ templates = append(templates, professions[player.profession-1]...)
+ if side == 1 {
+ templates = append(templates, 96358)
+ } else if side == 2 {
+ templates = append(templates, 99719, 29426)
+ }
+ if uint64(server.nextItem)+uint64(len(templates)) > uint64(^uint32(0)) {
+ return fmt.Errorf("item identities exhausted")
+ }
+ player.inventory.LastID = server.nextItem
+ for index, template := range templates {
+ definition := gamedata.ItemTemplates[template]
+ player.inventory.LastID++
+ item := ownedItem{ID: player.inventory.LastID, Type: definition.HeaderWords[0], Template: template,
+ Quality: *definition.Quality, Slot: 64 + uint32(index), Count: 1}
+ // Period arrival inventory shows 25 laboratory and 3 first-aid charges.
+ if template == 116628 {
+ item.Count = 25
+ } else if template == 116629 {
+ item.Count = 3
+ }
+ player.inventory.Items = append(player.inventory.Items, item)
+ }
+ return nil
+}
+
+func (server *server) insertBrowserPlayer_locked(tx *sql.Tx, player *character, salt, hash []byte) error {
+ record := player.record()
+ fields := append([]any{player.id}, record.fields()...)
+ if err := insertRow(tx, "characters", "id, "+characterColumns+", password_salt, password_hash", append(fields, salt, hash)); err != nil {
+ return err
+ }
+ if err := insertRow(tx, "players", "id", []any{player.id}); err != nil {
+ return err
+ }
+ for _, item := range player.inventory.Items {
+ if err := insertRow(tx, "items", "id, type, template, quality, count, ammo", []any{item.ID, item.Type, item.Template, item.Quality, item.Count, item.Ammo}); err != nil {
+ return err
+ }
+ if err := insertRow(tx, "item_locations", "item_id, player_id, slot", []any{item.ID, player.id, item.Slot}); err != nil {
+ return err
+ }
+ }
+ return updateRecord(tx, "world", 1, "last_character_id, last_item_id", []any{player.id, player.inventory.LastID})
+}
+
+func (server *server) publishBrowserPlayer_locked(player *character) {
+ server.characters[player.id] = player
+ server.nextCharacter, server.nextItem = player.id, player.inventory.LastID
+ record := player.record()
+ player.savedProfile, player.savedPosition, player.savedVitals = record.Profile, record.Position.editor(), record.Vitals
+ player.nextPositionSave = time.Now().Add(20 * time.Second)
+ for _, item := range player.inventory.Items {
+ server.items[item.ID] = recordItem(item, nil)
+ server.itemPlacements[item.ID] = itemPlacement{Player: player.id, Slot: item.Slot}
+ }
+}
diff --git a/server/browser_creation_test.go b/server/browser_creation_test.go
@@ -0,0 +1,349 @@
+package main
+
+import (
+ "ao/server/gamedata"
+ "encoding/json"
+ "fmt"
+ "maps"
+ "math"
+ "net/http"
+ "net/http/httptest"
+ "net/url"
+ "reflect"
+ "slices"
+ "strings"
+ "sync"
+ "testing"
+)
+
+func creationRequest(world *server, cookie *http.Cookie, fields url.Values) *httptest.ResponseRecorder {
+ request := httptest.NewRequest("POST", "https://example.test"+world.baseURL+"browser-account/create", strings.NewReader(fields.Encode()))
+ request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ if cookie != nil {
+ request.AddCookie(cookie)
+ }
+ response := httptest.NewRecorder()
+ world.httpHandler().ServeHTTP(response, request)
+ return response
+}
+
+func creationForm() url.Values {
+ return url.Values{"name": {"Alice"}, "password": {"test password"}, "head_mesh": {"40681"},
+ "profession": {"1"}, "side": {"2"}, "build": {"1"}, "height": {"100"}}
+}
+
+func TestBrowserCreationEveryHeadAndChoiceSurvivesRestart(t *testing.T) {
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ original := *world.characters[1]
+ weapons := []uint32{121569, 117610, 121567, 121571, 121568, 121567, 121570, 121567, 121564, 121567, 121567, 121566}
+ positions := [][3]float32{{239.886292, 6.161984, 72.431137}, {42.737694, 14.75, 70.091897}, {52.597332, 14.75, 57.636177}}
+
+ for index, head := range gamedata.PlayerAppearances.Heads {
+ fields := creationForm()
+ fields.Set("name", fmt.Sprintf("Head%d", index))
+ fields.Set("head_mesh", fmt.Sprint(head.Mesh))
+ fields.Set("profession", fmt.Sprint(index%12+1))
+ fields.Set("side", fmt.Sprint(index%3))
+ fields.Set("build", fmt.Sprint(index%3))
+ fields.Set("height", fmt.Sprint(90+10*(index%3)))
+ response := creationRequest(world, cookie, fields)
+ if response.Code != 204 {
+ t.Fatalf("head %d: %d %s", head.Mesh, response.Code, response.Body.String())
+ }
+ cookie = response.Result().Cookies()[0]
+ }
+ restored := newTestInventoryServer(t)
+
+ if len(gamedata.PlayerAppearances.Heads) != 255 || !reflect.DeepEqual(original.inventory.Items, restored.characters[1].inventory.Items) ||
+ original.name != restored.characters[1].name || original.position != restored.characters[1].position {
+ t.Fatal("creation changed the original visitor")
+ }
+ for index, head := range gamedata.PlayerAppearances.Heads {
+ player := restored.characters[uint32(index+2)]
+ appearance := unpackAppearance(player.appearance)
+ if player.name != fmt.Sprintf("Head%d", index) || player.headMesh != head.Mesh || appearance.Breed != head.Breed ||
+ appearance.Sex != head.Sex || appearance.Race != head.Race || appearance.Fatness != uint16(index%3) || appearance.Side != uint16(index%3) ||
+ player.height != uint16(90+10*(index%3)) || player.profession != uint16(index%12+1) || player.playfield != []uint32{954, 952, 950}[index%3] ||
+ player.level != 1 || player.experience != 0 || player.insuredExperience != 0 || !player.running || player.health != player.maximumHealth() || player.nano != 0 ||
+ player.stats != defaultCharacterStats(head.Breed) || player.inventory.Credits != 0 || len(player.inventory.LearnedNanos) != 0 {
+ t.Fatalf("head %d did not retain its initial state: %+v", head.Mesh, player.profile())
+ }
+ for coordinate, expected := range positions[index%3] {
+ if math.Abs(float64(player.position[coordinate]-expected)) > 0.0001 {
+ t.Fatalf("side %d position %v", index%3, player.position)
+ }
+ }
+ if player.profile() != world.characters[player.id].profile() || !reflect.DeepEqual(player.inventory.Items, world.characters[player.id].inventory.Items) {
+ t.Fatal("restart changed the created character")
+ }
+ if player.inventory.Items[0].Template != 116628 || player.inventory.Items[0].Count != 25 ||
+ player.inventory.Items[1].Template != 116629 || player.inventory.Items[1].Count != 3 ||
+ player.inventory.Items[2].Template != []uint32{116697, 116696, 116693}[index%3] || player.inventory.Items[3].Template != weapons[index%12] {
+ t.Fatal("incorrect starting equipment")
+ }
+ for slot, item := range player.inventory.Items {
+ if item.Slot != uint32(64+slot) || item.Quality != 1 || world.itemPlacements[item.ID] != (itemPlacement{Player: player.id, Slot: item.Slot}) {
+ t.Fatal("starter item was lost, equipped or assigned to another player")
+ }
+ }
+ }
+}
+
+func TestBrowserCreationStarterInventoryForEveryProfessionSideAndBody(t *testing.T) {
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ professions := [][]uint32{
+ {121569, 29092}, {117610, 43382}, {121567, 43329, 29194, 43328}, {121571, 43380},
+ {121568, 43383, 29191}, {121567, 28742}, {121570, 43378, 78417}, {121567, 43381, 29625},
+ {121564, 43379}, {121567, 28778, 43384}, {121567, 28815, 42111}, {121566, 43330, 29193},
+ }
+ for _, head := range []uint32{40680, 40628, 40284, 40246, 40206, 40169, 40132} {
+ for profession, items := range professions {
+ for side := range 3 {
+ fields := creationForm()
+ fields.Set("name", fmt.Sprintf("Player%d", world.nextCharacter+1))
+ fields.Set("head_mesh", fmt.Sprint(head))
+ fields.Set("profession", fmt.Sprint(profession+1))
+ fields.Set("side", fmt.Sprint(side))
+
+ response := creationRequest(world, cookie, fields)
+
+ if response.Code != 204 {
+ t.Fatalf("creation: %d %s", response.Code, response.Body.String())
+ }
+ cookie = response.Result().Cookies()[0]
+ player := world.characters[world.nextCharacter]
+ expected := append([]uint32{116628, 116629, []uint32{116697, 116696, 116693}[side]}, items...)
+ if side == 1 {
+ expected = append(expected, 96358)
+ } else if side == 2 {
+ expected = append(expected, 99719, 29426)
+ }
+ var actual []uint32
+ for _, item := range player.inventory.Items {
+ actual = append(actual, item.Template)
+ }
+ if !reflect.DeepEqual(actual, expected) {
+ t.Fatalf("profession %d side %d head %d inventory %v, want %v", profession+1, side, head, actual, expected)
+ }
+ }
+ }
+ }
+}
+
+func TestBrowserCreationCatalogRequiresCookieAndExcludesCredentials(t *testing.T) {
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ request := httptest.NewRequest("GET", "https://example.test/browser-account", nil)
+ request.AddCookie(cookie)
+ response := httptest.NewRecorder()
+ unauthorized := httptest.NewRecorder()
+
+ world.httpHandler().ServeHTTP(response, request)
+ world.httpHandler().ServeHTTP(unauthorized, httptest.NewRequest("GET", "https://example.test/browser-account", nil))
+ var result struct {
+ Name string `json:"name"`
+ Visitor bool `json:"visitor"`
+ Heads []gamedata.PlayerHead `json:"heads"`
+ }
+ decoder := json.NewDecoder(response.Body)
+ decoder.DisallowUnknownFields()
+ err := decoder.Decode(&result)
+
+ if err != nil || response.Code != 200 || response.Header().Get("Cache-Control") != "no-store" || result.Name != "Visitor1" || !result.Visitor ||
+ !reflect.DeepEqual(result.Heads, gamedata.PlayerAppearances.Heads) || unauthorized.Code != 401 {
+ t.Fatalf("creation catalog: %d %v", response.Code, err)
+ }
+}
+
+func TestBrowserCreationChargedKitsSplitRejoinAndSurviveRestart(t *testing.T) {
+ for _, scenario := range []struct{ slot, retained, remainder uint32 }{{64, 20, 5}, {65, 2, 1}} {
+ t.Run(fmt.Sprint(scenario.slot), func(t *testing.T) {
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ if response := creationRequest(world, cookie, creationForm()); response.Code != 204 {
+ t.Fatal(response.Body.String())
+ }
+ player := world.characters[2]
+ before := slices.Clone(player.inventory.Items)
+ client := &worldClient{id: 2, ready: true, conn: &combatInterestConn{}}
+ world.clients[2] = client
+ request := stackActionPacket(2, 52, scenario.slot, scenario.retained)[20:]
+
+ if err := world.handleInventory(client, request); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.handleInventory(client, request); err != nil {
+ t.Fatal(err)
+ }
+ restored := newTestInventoryServer(t)
+
+ if len(player.inventory.Items) != 8 || world.nextItem != 8 || player.inventory.Items[scenario.slot-64].Count != uint16(scenario.retained) ||
+ player.inventory.Items[7].ID != 8 || player.inventory.Items[7].Slot != 71 || player.inventory.Items[7].Count != uint16(scenario.remainder) ||
+ !reflect.DeepEqual(restored.characters[2].inventory.Items, player.inventory.Items) {
+ t.Fatal("starter kit split lost charges, duplicated an identity or failed cold loading")
+ }
+
+ if err := world.handleInventory(client, stackActionPacket(2, 53, scenario.slot, 71)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ restored = newTestInventoryServer(t)
+
+ if !reflect.DeepEqual(player.inventory.Items, before) || !reflect.DeepEqual(restored.characters[2].inventory.Items, before) || restored.nextItem != 8 {
+ t.Fatal("starter kit rejoin changed the issued items or reused the retired identity")
+ }
+ })
+ }
+}
+
+func TestBrowserCreationRejectsInvalidChoicesWithoutChangingCurrentPlayer(t *testing.T) {
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ before := *world.characters[1]
+ for _, scenario := range []struct{ field, value string }{
+ {"head_mesh", ""}, {"head_mesh", "1"}, {"head_mesh", "4294967296"}, {"profession", "0"}, {"profession", "13"}, {"profession", "-1"},
+ {"side", ""}, {"side", "3"}, {"side", "-1"}, {"build", "3"}, {"build", "normal"}, {"height", "0"}, {"height", "95"}, {"height", "65536"},
+ {"name", "Abc"}, {"name", "Abc1"}, {"name", "Alice1a"}, {"name", "Thirteenchars"}, {"name", "Visitor42"}, {"password", ""}, {"password", strings.Repeat("a", 1025)},
+ } {
+ t.Run(scenario.field+"="+scenario.value, func(t *testing.T) {
+ fields := creationForm()
+ fields.Set(scenario.field, scenario.value)
+
+ response := creationRequest(world, cookie, fields)
+
+ if response.Code != 400 || len(response.Result().Cookies()) != 0 || !reflect.DeepEqual(*world.characters[1], before) || world.nextCharacter != 1 || world.nextItem != 0 {
+ t.Fatalf("invalid creation changed state: %d %s", response.Code, response.Body.String())
+ }
+ })
+ }
+}
+
+func TestBrowserCreationFailureRollsBackAndCanRetry(t *testing.T) {
+ for _, table := range []string{"characters", "players", "items", "item_locations"} {
+ for _, failure := range []string{"ABORT", "IGNORE"} {
+ t.Run(table+"/"+failure, func(t *testing.T) {
+ expression := "IGNORE"
+ if failure == "ABORT" {
+ expression = "ABORT, 'creation'"
+ }
+ checkBrowserCreationFailure(t, "CREATE TRIGGER reject_creation BEFORE INSERT ON "+table+" BEGIN SELECT RAISE("+expression+"); END")
+ })
+ }
+ }
+ for _, scenario := range []struct{ name, statement string }{
+ {"world counter", "CREATE TRIGGER reject_creation BEFORE UPDATE ON world BEGIN SELECT RAISE(IGNORE); END"},
+ {"abandoned credential", "CREATE TRIGGER reject_creation BEFORE UPDATE OF browser_token_hash ON characters BEGIN SELECT RAISE(ABORT, 'credential'); END"},
+ {"commit", "CREATE TABLE pending_creation (id INTEGER REFERENCES players(id) DEFERRABLE INITIALLY DEFERRED); CREATE TRIGGER reject_creation AFTER INSERT ON players BEGIN INSERT INTO pending_creation VALUES (999999); END"},
+ } {
+ t.Run(scenario.name, func(t *testing.T) { checkBrowserCreationFailure(t, scenario.statement) })
+ }
+}
+
+func checkBrowserCreationFailure(t *testing.T, statement string) {
+ t.Helper()
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ before := *world.characters[1]
+ items, placements := maps.Clone(world.items), maps.Clone(world.itemPlacements)
+ if _, err := world.db.Exec(statement); err != nil {
+ t.Fatal(err)
+ }
+
+ response := creationRequest(world, cookie, creationForm())
+ restored := newTestInventoryServer(t)
+
+ if response.Code != 500 || len(response.Result().Cookies()) != 0 || world.nextCharacter != 1 || world.nextItem != 0 ||
+ !reflect.DeepEqual(*world.characters[1], before) || !reflect.DeepEqual(items, world.items) || !reflect.DeepEqual(placements, world.itemPlacements) ||
+ len(restored.users_locked()) != 1 || restored.nextCharacter != 1 || restored.nextItem != 0 ||
+ restored.characters[1].browserTokenHash != before.browserTokenHash || len(restored.items) != 0 {
+ t.Fatalf("failed creation published partial state: %d %s", response.Code, response.Body.String())
+ }
+ if _, err := world.db.Exec("DROP TRIGGER reject_creation"); err != nil {
+ t.Fatal(err)
+ }
+
+ retry := creationRequest(world, cookie, creationForm())
+
+ if retry.Code != 204 || world.nextCharacter != 2 || world.characters[2].name != "Alice" || len(world.characters[2].inventory.Items) != 7 {
+ t.Fatalf("creation could not retry: %d %s", retry.Code, retry.Body.String())
+ }
+}
+
+func TestBrowserCreationConcurrentReplayCommitsOnceAndOldPlayerCanLogIn(t *testing.T) {
+ world := newTestServer(t)
+ visitor := accountVisitor(t, world)
+ inventory := playerInventory{LastID: 1, Credits: 123, Items: []ownedItem{{ID: 1, Type: 51022, Template: 85686, Quality: 1, Slot: 21, Count: 1}}}
+ if err := world.saveInventory_locked(world.characters[1], inventory); err != nil {
+ t.Fatal(err)
+ }
+ claim := accountRequest(world, visitor, "claim", " oLD-player42!", "old password")
+ if claim.Code != 204 {
+ t.Fatal(claim.Body.String())
+ }
+ cookie := claim.Result().Cookies()[0]
+ before := *world.characters[1]
+ var requests sync.WaitGroup
+ responses := make([]*httptest.ResponseRecorder, 4)
+ world.clients[1] = &worldClient{id: 1, ready: true, conn: &combatInterestConn{}}
+
+ for index := range responses {
+ requests.Add(1)
+ go func() {
+ defer requests.Done()
+ responses[index] = creationRequest(world, cookie, creationForm())
+ }()
+ }
+ requests.Wait()
+
+ var created *http.Cookie
+ for _, response := range responses {
+ if response.Code == 204 {
+ if created != nil {
+ t.Fatal("replayed creation committed twice")
+ }
+ created = response.Result().Cookies()[0]
+ } else if response.Code != 401 {
+ t.Fatalf("unexpected replay status %d", response.Code)
+ }
+ }
+ if created == nil || world.nextCharacter != 2 || world.characters[1].name != "Oldplayer42" || world.clients[1].ready ||
+ world.characters[1].position != before.position || !reflect.DeepEqual(world.characters[1].inventory, before.inventory) {
+ t.Fatal("creation changed or lost the existing character")
+ }
+
+ stale := creationRequest(world, cookie, creationForm())
+ login := accountRequest(world, created, "login", "oldplayer42", "old password")
+
+ if stale.Code != 401 || login.Code != 204 || world.nextCharacter != 2 || world.characters[1].browserTokenHash == before.browserTokenHash {
+ t.Fatalf("old character login or stale creation failed: %d %d", stale.Code, login.Code)
+ }
+ restored := newTestInventoryServer(t)
+ if !reflect.DeepEqual(restored.characters[1].inventory.Items, before.inventory.Items) || restored.characters[1].inventory.Credits != 123 || restored.itemPlacements[1] != (itemPlacement{Player: 1, Slot: 21}) {
+ t.Fatal("creation or login lost the original equipped item")
+ }
+}
+
+func TestBrowserCreationRequiresCurrentCookieAndUniqueName(t *testing.T) {
+ world := newTestServer(t)
+ cookie := accountVisitor(t, world)
+ claim := accountRequest(world, cookie, "claim", "Alice", "password")
+ if claim.Code != 204 {
+ t.Fatal(claim.Body.String())
+ }
+ other := accountVisitor(t, world)
+ before := *world.characters[2]
+ fields := creationForm()
+ fields.Set("name", "aLICE")
+
+ missing := creationRequest(world, nil, fields)
+ stale := creationRequest(world, cookie, fields)
+ duplicate := creationRequest(world, other, fields)
+ fields.Del("head_mesh")
+ missingHead := creationRequest(world, other, fields)
+
+ if missing.Code != 401 || stale.Code != 401 || duplicate.Code != 409 || missingHead.Code != 400 ||
+ !reflect.DeepEqual(*world.characters[2], before) || world.nextCharacter != 2 || world.nextItem != 0 {
+ t.Fatalf("creation authorization/uniqueness failed: %d %d %d %d", missing.Code, stale.Code, duplicate.Code, missingHead.Code)
+ }
+}
diff --git a/server/gamedata/player_appearances.go b/server/gamedata/player_appearances.go
@@ -1,10 +1,10 @@
package gamedata
type PlayerHead struct {
- Mesh uint32 `yaml:"mesh"`
- Breed uint16 `yaml:"breed"`
- Sex uint16 `yaml:"sex"`
- Race uint16 `yaml:"race"`
+ Mesh uint32 `yaml:"mesh" json:"mesh"`
+ Breed uint16 `yaml:"breed" json:"breed"`
+ Sex uint16 `yaml:"sex" json:"sex"`
+ Race uint16 `yaml:"race" json:"race"`
}
type PlayerBody struct {
diff --git a/server/stacks.go b/server/stacks.go
@@ -1,6 +1,7 @@
package main
import (
+ "ao/server/gamedata"
"encoding/binary"
"fmt"
"maps"
@@ -8,7 +9,8 @@ import (
)
func (item ownedItem) isStackable() bool {
- return item.Type == 51005 && (item.Template == 152030 && item.Quality == 42 || (item.Template == 85366 || item.Template == 25812 || item.Template == 21605) && item.Quality == 1)
+ definition := gamedata.ItemTemplates[item.Template]
+ return item.Type == 51005 && definition != nil && itemStat(definition, 30)&(1<<9) != 0
}
func (server *server) changeStack_locked(client *worldClient, index int, body []byte) error {
diff --git a/server/target_protocol.go b/server/target_protocol.go
@@ -21,10 +21,10 @@ func targetPacket(packet []byte) []byte {
case 0x271b3a6b:
packet[36] = '0'
flags := binary.BigEndian.Uint32(packet[37:41])
- // Appearance has a wider race field and shifts every subsequent field.
+ // 14.9.1 packs Side in bits 0-2 and skin Race in bits 10-11.
appearance := uint32(binary.BigEndian.Uint16(packet[67:69]))
- packed := appearance&3 | (appearance>>2&3)<<3 | (appearance>>4&7)<<5
- packed |= (appearance>>7&3)<<8 | (appearance>>9&3)<<10 | (appearance>>11&31)<<12
+ packed := appearance>>9&3 | (appearance>>2&3)<<3 | (appearance>>4&7)<<5
+ packed |= (appearance>>7&3)<<8 | (appearance&3)<<10 | (appearance>>11&31)<<12
if flags&1 != 0 && appearance>>4&7 == 6 {
// Local PvE creatures use the monster side for enemy targeting.
packed = packed&^7 | 3
diff --git a/server/target_protocol_test.go b/server/target_protocol_test.go
@@ -10,6 +10,21 @@ import (
"time"
)
+func TestTargetAppearanceKeepsFactionAndSkinSeparate(t *testing.T) {
+ for side := uint16(0); side < 3; side++ {
+ for race := uint16(1); race < 4; race++ {
+ actor := &character{id: 1, name: "Player", appearance: (appearanceFields{Race: race, Fatness: 1, Breed: 1, Sex: 2, Side: side}).packed(), level: 1}
+
+ packet := targetPacket(characterPacket(actor))
+ appearance := binary.BigEndian.Uint32(packet[60:64])
+
+ if appearance&7 != uint32(side) || appearance>>10&3 != uint32(race) {
+ t.Fatalf("side %d race %d packed as %x", side, race, appearance)
+ }
+ }
+ }
+}
+
func TestTargetCharactersIncludeUnarmedWeapon(t *testing.T) {
for _, actor := range []*character{
{id: 1, name: "Player", appearance: 0x629, health: 100},
@@ -29,10 +44,10 @@ func TestTargetCharactersIncludeUnarmedWeapon(t *testing.T) {
t.Fatal("NPC is not in play for Tab targeting")
}
if actor.name == "Leet" {
- if binary.BigEndian.Uint32(packet[60:64]) != 0x1cb {
+ if binary.BigEndian.Uint32(packet[60:64]) != 0x5cb {
t.Fatal("creature appearance did not retain its model fields with monster side")
}
- } else if binary.BigEndian.Uint32(packet[60:64])&7 != 1 {
+ } else if binary.BigEndian.Uint32(packet[60:64])&7 != uint32(actor.appearance>>9&3) {
t.Fatal("player or human NPC faction changed")
}
if got := hex.EncodeToString(packet[len(packet)-20:]); got != "000007e20000aac00000aac10000006400000001" {
@@ -95,7 +110,7 @@ initialized:
if len(playfield) != 86 || player[29] != '0' || hex.EncodeToString(player[60:65]) != "0000062911" || string(player[65:82]) != "Local Explorer 1\x00" {
t.Fatalf("target playfield or player: %x %x", playfield, player)
}
- if hex.EncodeToString(npc[60:89]) != "000001cb0b456469746564204e50430000000000000000000000000007" {
+ if hex.EncodeToString(npc[60:89]) != "000005cb0b456469746564204e50430000000000000000000000000007" {
t.Fatalf("target NPC appearance, name and new stats: %x", npc[60:89])
}
if hex.EncodeToString(full[57:105]) != "000003f100017a600000003600000001000000340000000000000039000000000000015e000005aa000000ec00000000" {