This allows a UI to set a nickname once in the profile and then send
only the character name in the /register action.
It's still supported to set the name in the /register action as well.
app.post('/register', (request, response) => {
const game = request.game;
app.post('/register', (request, response) => {
const game = request.game;
- game.add_player(request.body.name, request.body.character);
+ var name = request.session.nickname;;
+
+ /* If the request includes a name, that overrides the session nickname. */
+ if (request.body.name)
+ name = request.body.name;
+
+ game.add_player(name, request.body.character);