Skip to content

INQCharacter.js

kyleady edited this page Jun 26, 2017 · 4 revisions

Purpose

The INQ Character was made to organize all of the details of a character into an accessible object, such as skills, weapons, psychic powers, talents, and traits.

Usage

new INQCharacter(characterObj)

When creating a new character, you will often want to parse a Roll20 character. INQCharacter will hand off the parsing job to INQCharacterParser.js, resulting in a complete INQCharacter.

Example

var character = getObj("character", characterid);
var inqcharacter = new INQCharacter(character);

INQCharacter.prototype.has(item, list)

Used to check if the INQCharacter has a specific Skill, Weapon, Psychic Power, Talent, or Trait.

If the item is not found in the specified list, it will return undefined.

If the item is found and it has no subgroups (see INQLink.js), it will return an object with the bonus of the item.
{Bonus: itemBonus}

If the item is found and it does have subgroups, it will return an array of objects, each listing their individual Bonus and Name.
[{Name: itemName, Bonus: itemBonus}, ... ]

Examples

//suppose that inqcharacter has the Skills "Scholastic Lore(Philosophy, Legend)"
//and "Scholastic Lore(Astronomy)+10" along with the Talent "Ambidextrous".

inqcharacter.has("Scholastic Lore", "Skills");
/*
returns [
          {Name: Philosophy, Bonus: 0},
          {Name: Legend, Bonus: 0},
          {Name: Astronomy, Bonus: 10}
        ];
*/

inqcharacter.has("Ambidextrous", "Talents");
//returns {Bonus: 0}

inqcharacter.has("Ambidextrous", "Skills")
//returns undefined

INQCharacter.prototype.bonus(characteristic)

Returns the total Characteristic bonus for the specified stat in the form of an integer.

Bonus = Floor(Characteristic/10) + Unnatural Characteristic

INQCharacter.prototype.toCharacterObj(isPlayer, characterid)

Uses the details of the INQCharacter to make a new Roll20 character.

If isPlayer is true, the notes will be written in the bio. If false, they will be written in the gmnotes. By default isPlayer is false.

If characterid points to a valid Roll20 character object, then the details of the character will be written on that character object, overwriting the old character.

Requirements

Clone this wiki locally