Methods
(async) abilityScores()
Prompts the user to choose between the default ability scores or rolling random scores using regular D&D rules.
Also calls the assign function with the correct array of scores.
(async) assign(scores)
Ties ability score values to the newly created character object.
Parameters:
Name | Type | Description |
---|---|---|
scores |
* | These are the aggregate scores determined through a series of prompts given to the user. |
(async) charGet(user) → {charList}
Gets all the previously created characters for a given user.
Parameters:
Name | Type | Description |
---|---|---|
user |
* | user object for the logged-in user |
- Source:
Returns:
- returns a formatted list of character objects
- Type
- charList
(async) createCharacter(user)
Builds a new character for the given user.
Parameters:
Name | Type | Description |
---|---|---|
user |
* | logged-in user object |
- Source:
(async) deity()
Lets user choose deity to assign to newly created character object.
- Source:
(async) deleteCharacter(character)
Deletes a character from a user's account + the database entirely.
Parameters:
Name | Type | Description |
---|---|---|
character |
* | this is the selected character object for the logged-in user. |
- Source:
(async) equipment()
Lets user choose armor(1), weapons(2), and pack(1) for newly created character object.
- Source:
invalid(input, arr) → {boolean}
Tests to see if a given input exists in a given array.
Parameters:
Name | Type | Description |
---|---|---|
input |
* | input data |
arr |
* | array that may or may not hold input data |
- Source:
Returns:
- returns true if the input is not found in the array
- Type
- boolean
(async) login(mute)
This logs in an already-existing user.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
mute |
* | 1 | This parameter is used as a hacky workaround. We needed an iterative parameter to mute the character display as the user inputs their password. The way the function is structured, we called the function recursively and any iteration past the first would cause issues with displaying the password due to the boolean 'rl[mute]' losing its place. So this parameter gives you a new boolean for each time the function is called. |
- Source:
(async) menu(user)
Generates the first menu. It asks users if they want to look at their full character list OR make a new character OR close the application.
Parameters:
Name | Type | Description |
---|---|---|
user |
* | user object for the logged-in user |
printChar(selection)
Outputs the selected character object in a nicely formatted way.
Parameters:
Name | Type | Description |
---|---|---|
selection |
* | this param is the selected character |
- Source:
roll4d6()
Rolls 4 'd6' and returns the sum of the highest 3 rolls. This is the typical process used for creating ability scores in D&D.
(async) selectMenu(user, character)
Generates the second menu. It asks users if they want to delete a character OR return to the main menu OR exit the application.
Parameters:
Name | Type | Description |
---|---|---|
user |
* | user object for the logged in user |
character |
* | character object for the individually selected character |
(async) signup(mute)
Signs up a new user and creates a user object to hold all that user's data. Prompts the user for username/password to create new account.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
mute |
* | 1 | This parameter is used as a hacky workaround. We needed an iterative parameter to mute the character display as the user inputs their password. The way the function is structured, we called the function recursively and any iteration past the first would cause issues with displaying the password due to the boolean 'rl[mute]' losing its place. So this parameter gives you a new boolean for each time the function is called. |
- Source:
(async) skillOne()
Adds the first skill to a newly created character object
- Source:
(async) skills()
Adds 2 skills to a newly created character object
- Source:
(async) skillTwo()
Adds the second skill to a newly created character object
- Source:
start()
This function starts our application in the terminal