Artifact
// Bring a persisted character up to the current systems. migratePlayer(pl) { if (!pl.attrs || typeof pl.attrs !== 'object') { pl.attrs = E.freshAttrs(); pl.attrPoints = E.pointsForLevel(pl.level); } for (const a of E.ATTRS) { if (typeof pl.attrs[a] !== 'number') pl.attrs[a] = E.BASE_ATTR; } if (typeof pl.attrPoints !== 'number') pl.attrPoints = 0; if (!pl.appearance || typeof pl.appearance !== 'object') pl.appearance = {}; // ...defaults for every new field added since v0. }
4df36073-afba-4aa6-9228-5341f80fb7fc
// Bring a persisted character up to the current systems. migratePlayer(pl) { if (!pl.attrs || typeof pl.attrs !== 'object') { pl.attrs = E.freshAttrs(); pl.attrPoints = E.pointsForLevel(pl.level); } for (const a of E.ATTRS) { if (typeof pl.attrs[a] !== 'number') pl.attrs[a] = E.BASE_ATTR; } if (typeof pl.attrPoints !== 'number') pl.attrPoints = 0;
if (!pl.appearance || typeof pl.appearance !== 'object') pl.appearance = {}; // ...defaults for every new field added since v0. }