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 updates = { 'data.biodata.rolename': role.name }
|
||||||
let newItems = []
|
let newItems = []
|
||||||
await this.deleteAllItemsByType('role')
|
await this.deleteAllItemsByType('role')
|
||||||
newItems.push(role);
|
newItems.push(role)
|
||||||
|
|
||||||
this.getIncreaseStatValue(updates, role.data.statincrease1)
|
this.getIncreaseStatValue(updates, role.data.statincrease1)
|
||||||
this.getIncreaseStatValue(updates, role.data.statincrease2)
|
this.getIncreaseStatValue(updates, role.data.statincrease2)
|
||||||
|
|
||||||
//newItems = newItems.concat(duplicate(role.data.specialisationsplus1))
|
newItems = newItems.concat( duplicate(role.data.specialability) ) // Add new ability
|
||||||
newItems = newItems.concat(duplicate(role.data.specialperk))
|
|
||||||
|
|
||||||
await this.update(updates)
|
await this.update(updates)
|
||||||
await this.createEmbeddedDocuments('Item', newItems)
|
await this.createEmbeddedDocuments('Item', newItems)
|
||||||
|
@ -253,7 +253,6 @@ export class PegasusItemSheet extends ItemSheet {
|
|||||||
async addRolePerk(event, item, dataItem) {
|
async addRolePerk(event, item, dataItem) {
|
||||||
let newItem = duplicate(item.data);
|
let newItem = duplicate(item.data);
|
||||||
newItem._id = randomID(dataItem.id.length);
|
newItem._id = randomID(dataItem.id.length);
|
||||||
console.log("Add spec", event, newItem);
|
|
||||||
if (event.toElement.className == 'drop-perk2') {
|
if (event.toElement.className == 'drop-perk2') {
|
||||||
let perkArray = duplicate(this.object.data.data.perks);
|
let perkArray = duplicate(this.object.data.data.perks);
|
||||||
perkArray.push(newItem);
|
perkArray.push(newItem);
|
||||||
@ -265,6 +264,16 @@ export class PegasusItemSheet extends ItemSheet {
|
|||||||
await this.object.update({ 'data.specialperk': perkArray });
|
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) {
|
async addPower(event, item, dataItem) {
|
||||||
@ -479,20 +488,22 @@ export class PegasusItemSheet extends ItemSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.object.type == 'role') {
|
if (this.object.type == 'role') {
|
||||||
let data = event.dataTransfer.getData('text/plain');
|
let data = event.dataTransfer.getData('text/plain')
|
||||||
if (data) {
|
if (data) {
|
||||||
let dataItem = JSON.parse(data);
|
let dataItem = JSON.parse(data)
|
||||||
let item = await PegasusUtility.searchItem(dataItem);
|
let item = await PegasusUtility.searchItem(dataItem)
|
||||||
if (item.data.type == 'specialisation') {
|
if (item.data.type == 'specialisation') {
|
||||||
return this.addRoleSpecialisation(event, item, dataItem);
|
return this.addRoleSpecialisation(event, item, dataItem)
|
||||||
}
|
}
|
||||||
if (item.data.type == 'perk') {
|
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-power,
|
||||||
.drop-ability-spec,
|
.drop-ability-spec,
|
||||||
.drop-spec-power,
|
.drop-spec-power,
|
||||||
|
.drop-specialability,
|
||||||
.drop-abilities,
|
.drop-abilities,
|
||||||
.drop-optionnal-abilities,
|
.drop-optionnal-abilities,
|
||||||
.drop-specialperk1,
|
.drop-specialperk1,
|
||||||
|
@ -180,9 +180,9 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"styles/simple.css"
|
"styles/simple.css"
|
||||||
],
|
],
|
||||||
"templateVersion": 89,
|
"templateVersion": 90,
|
||||||
"title": "Pegasus RPG",
|
"title": "Pegasus RPG",
|
||||||
"url": "https://www.uberwald.me/data/files/fvtt-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"
|
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@
|
|||||||
"specialisationsplus1": [],
|
"specialisationsplus1": [],
|
||||||
"powers1": [],
|
"powers1": [],
|
||||||
"MR": 0,
|
"MR": 0,
|
||||||
"specialperk": [],
|
"specialability": [],
|
||||||
"specincrease": [],
|
"specincrease": [],
|
||||||
"perks": [],
|
"perks": [],
|
||||||
"description": ""
|
"description": ""
|
||||||
|
@ -52,16 +52,16 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
<li class="flexrow">
|
<li class="flexrow">
|
||||||
<label class="generic-label">Role Perk</label>
|
<label class="generic-label">Role Ability</label>
|
||||||
</li>
|
</li>
|
||||||
<ul class="ul-level1">
|
<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>
|
</li>
|
||||||
{{#each data.specialperk as |perk idx|}}
|
{{#each data.specialability as |ability idx|}}
|
||||||
<li class="flexrow">
|
<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">
|
<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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user