Add ability to role
This commit is contained in:
parent
e59a815eaf
commit
0d34b30467
@ -1036,13 +1036,12 @@ export class PegasusActor extends Actor {
|
||||
let updates = { 'data.biodata.rolename': role.name }
|
||||
let newItems = []
|
||||
await this.deleteAllItemsByType('role')
|
||||
newItems.push(role);
|
||||
newItems.push(role)
|
||||
|
||||
this.getIncreaseStatValue(updates, role.data.statincrease1)
|
||||
this.getIncreaseStatValue(updates, role.data.statincrease2)
|
||||
|
||||
//newItems = newItems.concat(duplicate(role.data.specialisationsplus1))
|
||||
newItems = newItems.concat(duplicate(role.data.specialperk))
|
||||
newItems = newItems.concat( duplicate(role.data.specialability) ) // Add new ability
|
||||
|
||||
await this.update(updates)
|
||||
await this.createEmbeddedDocuments('Item', newItems)
|
||||
|
@ -253,7 +253,6 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
async addRolePerk(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
console.log("Add spec", event, newItem);
|
||||
if (event.toElement.className == 'drop-perk2') {
|
||||
let perkArray = duplicate(this.object.data.data.perks);
|
||||
perkArray.push(newItem);
|
||||
@ -265,6 +264,16 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
await this.object.update({ 'data.specialperk': perkArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addRoleAbility(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data)
|
||||
newItem._id = randomID(dataItem.id.length)
|
||||
if (event.toElement.className == 'drop-specialability') {
|
||||
let abiArray = duplicate(this.object.data.data.specialability)
|
||||
abiArray.push(newItem)
|
||||
await this.object.update({ 'data.specialability': abiArray })
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addPower(event, item, dataItem) {
|
||||
@ -479,20 +488,22 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
}
|
||||
|
||||
if (this.object.type == 'role') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
let data = event.dataTransfer.getData('text/plain')
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
let dataItem = JSON.parse(data)
|
||||
let item = await PegasusUtility.searchItem(dataItem)
|
||||
if (item.data.type == 'specialisation') {
|
||||
return this.addRoleSpecialisation(event, item, dataItem);
|
||||
return this.addRoleSpecialisation(event, item, dataItem)
|
||||
}
|
||||
if (item.data.type == 'perk') {
|
||||
return this.addRolePerk(event, item, dataItem);
|
||||
return this.addRolePerk(event, item, dataItem)
|
||||
}
|
||||
if (item.data.type == 'ability') {
|
||||
return this.addRoleAbility(event, item, dataItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui.notifications.warn("This item can not be dropped over another item");
|
||||
ui.notifications.warn("This item can not be dropped over another item")
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -1211,6 +1211,7 @@ ul, li {
|
||||
.drop-ability-power,
|
||||
.drop-ability-spec,
|
||||
.drop-spec-power,
|
||||
.drop-specialability,
|
||||
.drop-abilities,
|
||||
.drop-optionnal-abilities,
|
||||
.drop-specialperk1,
|
||||
|
@ -180,9 +180,9 @@
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"templateVersion": 89,
|
||||
"templateVersion": 90,
|
||||
"title": "Pegasus RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||
"version": "0.5.10",
|
||||
"version": "0.5.11",
|
||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||
}
|
||||
|
@ -239,7 +239,7 @@
|
||||
"specialisationsplus1": [],
|
||||
"powers1": [],
|
||||
"MR": 0,
|
||||
"specialperk": [],
|
||||
"specialability": [],
|
||||
"specincrease": [],
|
||||
"perks": [],
|
||||
"description": ""
|
||||
|
@ -52,16 +52,16 @@
|
||||
{{/each}}
|
||||
</ul>
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">Role Perk</label>
|
||||
<label class="generic-label">Role Ability</label>
|
||||
</li>
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-specialperk1"><label>Drop Perks here !</label></div>
|
||||
<li class="flexrow"><div class="drop-specialability"><label>Drop Abilities here !</label></div>
|
||||
</li>
|
||||
{{#each data.specialperk as |perk idx|}}
|
||||
{{#each data.specialability as |ability idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.specialperk[{{idx}}].name"><a class="view-subitem" data-type="specialperk" data-index="{{idx}}">{{perk.name}}</a></label>
|
||||
<label name="data.specialability[{{idx}}].name"><a class="view-subitem" data-type="specialability" data-index="{{idx}}">{{ability.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="specialperk" data-index="{{idx}}" title="Delete Perk"><i class="fas fa-trash"></i></a>
|
||||
<a class="item-control delete-subitem padd-left" data-type="specialability" data-index="{{idx}}" title="Delete Ability"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user