Add character levels and permanent player titles

This commit is contained in:
dingo
2026-09-07 07:58:34 -04:00
parent 5a48a3c739
commit bc0ffbbbe5
30 changed files with 1594 additions and 62 deletions
+2
View File
@@ -1,4 +1,5 @@
import './portal.css';
import { permanentTitles, progressionSummary } from './progression';
import { $, api, APIError, badge, cell, date, el, gameURL, icons, icon, table, type Command, type RecordCharacter, type World } from './portal-shared';
type Data = { worlds: World[]; characters: RecordCharacter[]; commands: Command[]; provisioningEnabled: boolean; characterLimit: number; auditLimit: number };
@@ -43,6 +44,7 @@ function detail(r: RecordCharacter) {
const list = el('dl', '', 'details'); const v = r.character.view;
const pairs: [string, string][] = [['Character ID', r.id], ['Account ID', r.account], ['World', r.worldId], ['State', r.state], ['Health', `${v.entity.hp} / ${v.entity.maxHp}`], ['Position', `${Math.round(v.entity.position.x)}, ${Math.round(v.entity.position.y)}, ${Math.round(v.entity.position.z)}`], ['Played today', `${Math.floor(r.character.dailySeconds / 60)} min`], ['Born', date(r.character.bornAt)], ['Died', r.character.diedAt ? date(r.character.diedAt) : '-'], ['Cause', r.character.deathReason || '-']];
for (const [key,value] of pairs) list.append(el('dt', key), el('dd', value)); parent.append(list);
parent.append(el('h3', 'Progression'), progressionSummary(v), el('h3', 'Permanent titles'), permanentTitles(v.titles));
for (const [heading, items] of [['Inventory', v.inventory], ['Skills', v.skills]] as const) { parent.append(el('h3', heading)); const section = el('div', '', 'item-list'); for (const [key,value] of Object.entries(items)) { const item = el('span', key.replaceAll('_', ' ')); item.append(el('b', String(value))); section.append(item); } if (!section.children.length) section.append(el('span', 'None', 'muted')); parent.append(section); }
$<HTMLDialogElement>('character-dialog').showModal();
}