Fix various issues
This commit is contained in:
parent
71d61f1387
commit
c1849edaf4
@ -256,7 +256,39 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
await this.object.update( { 'data.specialperk': perkArray} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addPower( event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID( dataItem.id.length );
|
||||
if ( event.toElement.className == 'drop-spec-power') {
|
||||
let powArray = duplicate(this.object.data.data.powers);
|
||||
powArray.push( newItem );
|
||||
await this.object.update( { 'data.powers': powArray} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addAbilityPower( event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID( dataItem.id.length );
|
||||
if ( event.toElement.className == 'drop-ability-power') {
|
||||
let powArray = duplicate(this.object.data.data.powersgained);
|
||||
powArray.push( newItem );
|
||||
await this.object.update( { 'data.powersgained': powArray} );
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addAbilitySpec( event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID( dataItem.id.length );
|
||||
if ( event.toElement.className == 'drop-ability-spec') {
|
||||
let powArray = duplicate(this.object.data.data.specialisations);
|
||||
powArray.push( newItem );
|
||||
await this.object.update( { 'data.specialisations': powArray} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDrop(event) {
|
||||
//console.log(event);
|
||||
@ -270,6 +302,29 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.object.type == 'specialisation' ) {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse( data );
|
||||
let item = await this.searchItem( dataItem);
|
||||
if ( item.data.type == 'power') {
|
||||
return this.addPower( event, item, dataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.object.type == 'ability' ) {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse( data );
|
||||
let item = await this.searchItem( dataItem);
|
||||
if ( item.data.type == 'power') {
|
||||
return this.addAbilityPower( event, item, dataItem);
|
||||
}
|
||||
if ( item.data.type == 'specialisation') {
|
||||
return this.addAbilitySpec( event, item, dataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'perk' || this.object.type == 'ability') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
|
@ -1147,6 +1147,9 @@ ul, li {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
|
||||
.drop-ability-power,
|
||||
.drop-ability-spec,
|
||||
.drop-spec-power,
|
||||
.drop-abilities,
|
||||
.drop-specialperk1,
|
||||
.drop-perk2,
|
||||
|
@ -50,9 +50,9 @@
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"templateVersion": 17,
|
||||
"templateVersion": 18,
|
||||
"title": "Pegasus RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||
"version": "0.0.17",
|
||||
"version": "0.0.18",
|
||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||
}
|
@ -158,8 +158,8 @@
|
||||
"otherdice": 0,
|
||||
"statusaffected": "",
|
||||
"statusmodifier": 0,
|
||||
"powergained": 0,
|
||||
"specialisation": [ {"name": "None"}],
|
||||
"powersgained": [],
|
||||
"specialisations": [],
|
||||
"aoe": "",
|
||||
"description": ""
|
||||
},
|
||||
|
@ -20,21 +20,25 @@
|
||||
<li class="flexrow"><label class="generic-label">Stat modifier</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.statmodifier" value="{{data.statmodifier}}" data-dtype="Number">
|
||||
{{#select data.statmodifier}}
|
||||
<option value="-3">-3</option>
|
||||
<option value="-2">-2</option>
|
||||
<option value="-1">-1</option>
|
||||
<option value="0">0</option>
|
||||
<option value="+1">+1</option>
|
||||
<option value="+2">+2</option>
|
||||
<option value="+3">+3</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Stat level increase</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.statlevelincrease" value="{{data.statlevelincrease}}" data-dtype="Number">
|
||||
{{#select data.statlevelincrease}}
|
||||
<option value="0">0</option>
|
||||
<option value="+1">+1</option>
|
||||
<option value="+2">+2</option>
|
||||
<option value="+3">+3</option>
|
||||
<option value="+4">+4</option>
|
||||
<option value="+5">+5</option>
|
||||
<option value="0">0 DT</option>
|
||||
<option value="+1">+1 DT</option>
|
||||
<option value="+2">+2 DT</option>
|
||||
<option value="+3">+3 DT</option>
|
||||
<option value="+4">+4 DT</option>
|
||||
<option value="+5">+5 DT</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
@ -69,15 +73,36 @@
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Power Gained</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="data.powergained" value="{{data.powergained}}" data-dtype="Number"/>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-ability-power"><label>Drop Powers here !</label></div>
|
||||
</li>
|
||||
{{#each data.powersgained as |power idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.powersgained[{{idx}}].name"><a class="view-subitem" data-type="powersgained" data-index="{{idx}}">{{power.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="powersgained" data-index="{{idx}}" title="Delete Power"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Specialisation Gained</label>
|
||||
{{#each data.specialisation as |spec idx|}}
|
||||
<label name="data.specialisation[{{idx}}].name"><a class="view-spec" data-spec-index="{{idx}}">{{spec.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-spec padd-left" data-spec-index="{{idx}}" title="Delete Spec"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
{{/each}}
|
||||
<li>
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-ability-spec"><label>Drop Specialisations here !</label></div>
|
||||
</li>
|
||||
{{#each data.specialisations as |spec idx|}}
|
||||
<li class="flexrow">
|
||||
<label name="data.specialisations[{{idx}}].name"><a class="view-subitem" data-type="specialisations" data-index="{{idx}}">{{spec.name}}</a></label>
|
||||
<div class="item-controls padd-left">
|
||||
<a class="item-control delete-subitem padd-left" data-type="specialisations" data-index="{{idx}}" title="Delete Specialisation"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">AoE</label>
|
||||
<input type="text" class="padd-right" name="data.aoe" value="{{data.aoe}}" data-dtype="String"/>
|
||||
|
@ -28,11 +28,11 @@
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">Specialisation at +1</label>
|
||||
<label class="generic-label">Starting Specialisation at +1 DT</label>
|
||||
</li>
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">Specific specialisation choose message : </label>
|
||||
<label class="generic-label">Starting Specialisations : </label>
|
||||
</li>
|
||||
<li class="flexrow">
|
||||
<input type="text" class="padd-right" name="data.messagespecplus1" value="{{data.messagespecplus1}}" data-dtype="String"/>
|
||||
@ -49,7 +49,7 @@
|
||||
{{/each}}
|
||||
</ul>
|
||||
<li class="flexrow">
|
||||
<label class="generic-label">Special perk</label>
|
||||
<label class="generic-label">Role Perk</label>
|
||||
</li>
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-specialperk1"><label>Drop Perks here !</label></div>
|
||||
|
@ -37,7 +37,7 @@
|
||||
<li class="flexrow"><label class="generic-label">Available Powers</label>
|
||||
</li>
|
||||
<ul class="ul-level1">
|
||||
<li class="flexrow"><div class="drop-perk2"><label>Drop Powers here !</label></div>
|
||||
<li class="flexrow"><div class="drop-spec-power"><label>Drop Powers here !</label></div>
|
||||
</li>
|
||||
{{#each data.powers as |power idx|}}
|
||||
<li class="flexrow">
|
||||
|
Loading…
Reference in New Issue
Block a user