added bonds tab and base logic
This commit is contained in:
@@ -142,7 +142,6 @@ export class DeltaGreenActorSheet extends ActorSheet {
|
||||
event.preventDefault();
|
||||
|
||||
let targetskill = event.target.getAttribute("data-typeskill");
|
||||
//let updatedData = duplicate(this.actor.data.data);
|
||||
|
||||
this._showNewTypeSkillDialog(targetskill);
|
||||
});
|
||||
@@ -165,6 +164,19 @@ export class DeltaGreenActorSheet extends ActorSheet {
|
||||
|
||||
this.actor.update({"data": updatedData});
|
||||
});
|
||||
|
||||
html.find('.btn-add-bond').click(event => {
|
||||
event.preventDefault();
|
||||
this._addNewBond();
|
||||
});
|
||||
|
||||
html.find('.btn-remove-bond').click(event => {
|
||||
event.preventDefault();
|
||||
let skillindex = event.target.getAttribute("data-index");
|
||||
|
||||
this._removeBond(skillindex);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
_showNewTypeSkillDialog(targetskill){
|
||||
@@ -204,6 +216,40 @@ export class DeltaGreenActorSheet extends ActorSheet {
|
||||
this.actor.update({"data": updatedData});
|
||||
}
|
||||
|
||||
_addNewBond(){
|
||||
let updatedData = duplicate(this.actor.data.data);
|
||||
let updatedBonds = [];
|
||||
let x;
|
||||
|
||||
for(x in updatedData.bonds){
|
||||
if(Number.isNumeric(x)){
|
||||
updatedBonds.push(updatedData.bonds[x]);
|
||||
}
|
||||
}
|
||||
|
||||
updatedBonds.push({"description": "New", "score": updatedData.statistics.cha.value});
|
||||
|
||||
updatedData.bonds = updatedBonds;
|
||||
|
||||
this.actor.update({"data": updatedData});
|
||||
}
|
||||
|
||||
_removeBond(pos){
|
||||
let updatedData = duplicate(this.actor.data.data);
|
||||
let updatedBonds = [];
|
||||
let x;
|
||||
|
||||
for(x in updatedData.bonds){
|
||||
if(Number.isNumeric(x) && x != pos){
|
||||
updatedBonds.push(updatedData.bonds[x]);
|
||||
}
|
||||
}
|
||||
|
||||
updatedData.bonds = updatedBonds;
|
||||
|
||||
this.actor.update({"data": updatedData});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle creating a new Owned Item for the actor using initial data defined in the HTML dataset
|
||||
* @param {Event} event The originating click event
|
||||
|
||||
Reference in New Issue
Block a user