Char creation
This commit is contained in:
@ -223,6 +223,17 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addRacePerk(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID( dataItem.id.length );
|
||||
if ( event.toElement.className == 'drop-race-perk') {
|
||||
let perkArray = duplicate(this.object.data.data.perks);
|
||||
perkArray.push( newItem);
|
||||
await this.object.update( { 'data.perks': perkArray} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addSpecialisation(item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
@ -286,6 +297,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
await this.object.update( { 'data.powersgained': powArray} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addAbilitySpec( event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
@ -296,6 +308,22 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
await this.object.update( { 'data.specialisations': powArray} );
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addAbilityWeaponArmor( event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID( dataItem.id.length );
|
||||
if ( event.toElement.className == 'drop-ability-weapon') {
|
||||
let weaponArray = duplicate(this.object.data.data.attackgained);
|
||||
weaponArray.push( newItem );
|
||||
await this.object.update( { 'data.attackgained': weaponArray} );
|
||||
}
|
||||
if ( event.toElement.className == 'drop-ability-armor') {
|
||||
let armorArray = duplicate(this.object.data.data.armorgained);
|
||||
armorArray.push( newItem );
|
||||
await this.object.update( { 'data.armorgained': armorArray} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addPerkSpecialisation( event, item, dataItem) {
|
||||
@ -322,6 +350,9 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
if ( item.data.type == 'ability') {
|
||||
return this.addAbility( event, item, dataItem);
|
||||
}
|
||||
if ( item.data.type == 'perk') {
|
||||
return this.addRacePerk( event, item, dataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,6 +388,9 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
if ( item.data.type == 'specialisation') {
|
||||
return this.addAbilitySpec( event, item, dataItem);
|
||||
}
|
||||
if ( item.data.type == 'weapon' || item.data.type == 'armor') {
|
||||
return this.addAbilityWeaponArmor( event, item, dataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user