Day 10 [D&D Character Sheets]

approachingapathy

Ephriam Henderson

Posted on March 22, 2020

Day 10 [D&D Character Sheets]

Report

A small update today, I mainly developed my 'characters/new' route.

// routes/characters/index.js
router.post("/new", bodyParser.json(), (req, res) => {
    // Check if the body is formed correctly
    if (
        !req.body || 
        !req.body.data || 
        // I check for longname because it's the only field
        // where I didn't define an alternative assignment.
        !req.body.data.longName
    ) {
        res.statusCode = 400,
        res.json({error: "Bad Request"})
        return false
    }
    let data = req.body.data
    let abilityScoreDefault = 8
    req.context.db.models.Character.create({
        shortName: data.shortName || data.longName,
        longName: data.longName,
        // I changed some of these fields to be nullable for testing purposes
        // race and class will remain nullable while player won't be.
        // I'll have to set up authentication to grab the right user for the player field.
        race: data.raceId || null,
        class: data.classId || null,
        player: data.playerId || null,
        description: data.description || "",
        age: data.age || "",
        urlSlug: data.urlSlug || "",
        stats: {
            abilities: {
                // I should ensure that the 'abilities' key exists.
                strength: data.stats.abilities.strength || abilityScoreDefault,
                dexterity: data.stats.abilities.dexterity || abilityScoreDefault,
                constitution: data.stats.abilities.constitution || abilityScoreDefault,
                intelligence: data.stats.abilities.intelligence || abilityScoreDefault,
                wisdom: data.stats.abilities.wisdom || abilityScoreDefault,
                charisma: data.stats.abilities.charisma || abilityScoreDefault
            }
        }
    })
    .then(result => res.json(result))
});

Project

[100days] The DND Character Sheet App

This is the first project of my 100 days of coding This is an app to keep D&D character sheets.

Stack

I'll be using Node.js and building a full-stack Express app with MongoDB.

Requirements

Minimum Viable

  • Present a D&D Character Sheet
    • The sheet should display all the same info as the first page of the 5e Official sheet.
  • Users should be able to log in and create player-characters.
  • Users should be able to edit character sheets.
  • Users should be able to organize character sheets into groups (parties/tables)
  • Sheets should auto calculate basic stats like ability modifiers
    • Support Proficiency Bonuses

Cake

  • Extend character creation to allow the user to use any of the three common stat gen methods
    • Point Buy
    • Standard Array
    • Roll
  • Extend the character sheet to all the info in the 5e official sheet.
  • Allow for image uploads for character portraits.
  • Allow for…

The First project will be an app to keep D&D character sheets.

Stack

I'll be using Node.js and building a full-stack Express app with MongoDB.

Requirements

Minimum Viable

  • [ ] Investigate automating or finding a source of info for the data in the SRD.
  • [ ] Present a D&D Character Sheet
    • [ ] The sheet should display all the same info as the first page of the 5e Official sheet.
  • [ ] Users should be able to log in and create player-characters.
  • [ ] Users should be able to edit character sheets.
  • [ ] Users should be able to organize character sheets into groups (parties/tables)
  • [ ] Sheets should auto calculate basic stats like ability modifiers.
    • [ ] Support Proficiency Bonuses

Cake

  • [ ] Extend character creation to allow the user to use any of the three common stat gen methods.
    • [ ] Point Buy
    • [ ] Standard Array
    • [ ] Roll
  • [ ] Extend the character sheet to all the info in the 5e official sheet.
  • [ ] Allow for image uploads for character portraits.
  • [ ] Allow for extended descriptions/backstories.
    • [ ] Characters should have nice full page backstories.
    • [ ] Preferably use a markdown editor.
💖 💪 🙅 🚩
approachingapathy
Ephriam Henderson

Posted on March 22, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related