Sync
This commit is contained in:
parent
3384157580
commit
adcb4a49c9
@ -54,6 +54,7 @@ export class PegasusActorSheet extends ActorSheet {
|
||||
subActors: duplicate(this.actor.getSubActors()),
|
||||
race: duplicate(this.actor.getRace()),
|
||||
role: duplicate(this.actor.getRole()),
|
||||
effects: duplicate(this.actor.getEffects()),
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
editScore: this.options.editScore,
|
||||
@ -86,6 +87,12 @@ export class PegasusActorSheet extends ActorSheet {
|
||||
PegasusUtility.confirmDelete(this, li);
|
||||
});
|
||||
|
||||
html.find('.park-round-count').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let itemId = li.data("item-id");
|
||||
this.actor.updatePerkRounds( itemId, Number(event.currentTarget.value))
|
||||
});
|
||||
|
||||
html.find('.subactor-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let actorId = li.data("actor-id");
|
||||
|
@ -100,6 +100,11 @@ export class PegasusActor extends Actor {
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getEffects() {
|
||||
let comp = this.data.items.filter( item => item.type == 'effect');
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getPowers() {
|
||||
let comp = this.data.items.filter( item => item.type == 'power');
|
||||
return comp;
|
||||
@ -409,7 +414,12 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getStat( statKey) {
|
||||
let stat = duplicate(this.data.data.statistics[statKey]);
|
||||
let stat
|
||||
if (statKey == 'mr') {
|
||||
stat = duplicate(this.data.data.mr);
|
||||
} else {
|
||||
stat = duplicate(this.data.data.statistics[statKey]);
|
||||
}
|
||||
stat.dice = PegasusUtility.getDiceFromLevel(stat.value);
|
||||
return stat;
|
||||
}
|
||||
@ -424,6 +434,14 @@ export class PegasusActor extends Actor {
|
||||
return spec;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
updatePerkRounds( itemId, roundValue) {
|
||||
let item = this.items.get( itemId)
|
||||
if (item) {
|
||||
this.updateEmbeddedDocuments( 'Item', [ { _id: item.id, 'data.roundcount': roundValue }] );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMR() {
|
||||
let mr = duplicate( this.data.data.mr) ;
|
||||
|
@ -16,6 +16,8 @@ export class PegasusActorCreate {
|
||||
this.races = racesPack.map(i => i.toObject());
|
||||
const rolesPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.role");
|
||||
this.roles = rolesPack.map(i => i.toObject());
|
||||
const perksPack = await PegasusUtility.loadCompendium("fvtt-pegasus-rpg.perk");
|
||||
this.perks = perksPack.map(i => i.toObject());
|
||||
|
||||
this.showRaces()
|
||||
}
|
||||
@ -55,7 +57,7 @@ export class PegasusActorCreate {
|
||||
if ( race.data.selectablestats ) {
|
||||
this.manageSelectableStats(race);
|
||||
} else if ( race.data.perksgained) {
|
||||
this.showRacePerks(race);
|
||||
this.manageRacePerks(race);
|
||||
} else {
|
||||
this.showRoles()
|
||||
}
|
||||
@ -83,24 +85,19 @@ export class PegasusActorCreate {
|
||||
this.processSelectableStats();
|
||||
}
|
||||
|
||||
if (step == 'select-race-perks-all') {
|
||||
if (step == 'select-race-perks') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
let perk = this.racePerks.find( item => item._id == itemId);
|
||||
this.actor.createEmbeddedDocuments( 'Item', [perk]);
|
||||
this.racePerks = this.racePerks.filter( item => item._id != itemId);
|
||||
this.nbperks -= 1;
|
||||
if ( this.nbperks == 0 || this.racePerks.length == 0) {
|
||||
this.nbRacePerks -= 1;
|
||||
if ( this.nbRacePerks == 0 || this.racePerks.length == 0) {
|
||||
this.showRoles()
|
||||
}else {
|
||||
this.showRacePerks();
|
||||
} else {
|
||||
this.manageRacePerks()
|
||||
}
|
||||
}
|
||||
|
||||
if (step == 'select-race-perks') {
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
this.showRoles()
|
||||
}
|
||||
|
||||
if ( step == 'select-role') {
|
||||
let role = this.roles.find( item => item._id == itemId);
|
||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||
@ -205,18 +202,23 @@ export class PegasusActorCreate {
|
||||
|
||||
/* --------------- -------------------- --------- */
|
||||
manageRacePerks(race) {
|
||||
console.log("MANAG RACE PERKsS", this.currentRace)
|
||||
if ( !this.currentRace.data.perksgained ) {
|
||||
this.showRoles()
|
||||
return;
|
||||
}
|
||||
console.log("MANAG RACE PERKsS 2", this.currentRace)
|
||||
if ( !this.racePerks) { // First init
|
||||
this.racePerks = duplicate(race.data.perks)
|
||||
this.nbRacePerks = race.data.perksnumber;
|
||||
}
|
||||
let formData
|
||||
if (race.data.perksall) {
|
||||
formData = this.createFormData("select-race-perks-all")
|
||||
} else {
|
||||
formData = this.createFormData("select-race-perks")
|
||||
formData.raceperks = this.racePerks;
|
||||
formData.nbraceperks = this.nbRacePerks;
|
||||
if ( this.currentRace.data.perksall) {
|
||||
this.racePerks = duplicate(this.perks)
|
||||
} else {
|
||||
this.racePerks = duplicate(this.currentRace.data.perks)
|
||||
}
|
||||
this.nbRacePerks = this.currentRace.data.perksnumber;
|
||||
}
|
||||
let formData = this.createFormData("select-race-perks")
|
||||
formData.raceperks = this.racePerks;
|
||||
formData.nbraceperks = this.nbRacePerks;
|
||||
this.renderChatMessage(formData)
|
||||
}
|
||||
|
||||
@ -224,7 +226,7 @@ export class PegasusActorCreate {
|
||||
async processSelectableStats() {
|
||||
// End of race options choice
|
||||
if ( this.raceSelectableStats.numberstats == 0) {
|
||||
this.showRoles()
|
||||
this.manageRacePerks();
|
||||
return;
|
||||
}
|
||||
let formData = this.createFormData("select-race-stats")
|
||||
|
@ -65,6 +65,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
mr: (this.object.type == 'specialisation'),
|
||||
isGM: game.user.isGM
|
||||
}
|
||||
|
||||
@ -339,9 +340,30 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addEffectSpec( event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
if ( event.toElement.className == 'drop-effect-spec') {
|
||||
let specArray = duplicate(this.object.data.data.recoveryrollspec);
|
||||
specArray.push( newItem );
|
||||
await this.object.update( { 'data.recoveryrollspec': specArray} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDrop(event) {
|
||||
//console.log(event);
|
||||
if (this.object.type == 'effect' ) {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse( data );
|
||||
let item = await this.searchItem( dataItem);
|
||||
if ( item.data.type == 'specialisation') {
|
||||
return this.addEffectSpec( event, item, dataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'race' ) {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
|
@ -20,6 +20,11 @@ export class PegasusUtility {
|
||||
this.optionsDiceList = "";
|
||||
this.buildDiceLists();
|
||||
PegasusCommands.init();
|
||||
|
||||
Handlebars.registerHelper('upper', function (text) {
|
||||
return text.toUpperCase();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -1160,6 +1160,7 @@ ul, li {
|
||||
.ul-level1 {
|
||||
padding-left: 2rem;
|
||||
}
|
||||
.drop-effect-spec,
|
||||
.drop-ability-weapon,
|
||||
.drop-ability-armor,
|
||||
.drop-race-perk,
|
||||
|
@ -100,9 +100,9 @@
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"templateVersion": 46,
|
||||
"templateVersion": 49,
|
||||
"title": "Pegasus RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||
"version": "0.0.46",
|
||||
"version": "0.0.49",
|
||||
"background" : "./images/ui/pegasus_welcome_page.webp"
|
||||
}
|
@ -174,7 +174,21 @@
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon"],
|
||||
"types": [ "race", "role", "ability", "specialisation", "perk", "power" , "armor", "shield", "equipment", "weapon", "effect"],
|
||||
"effect": {
|
||||
"type": "",
|
||||
"genre": "",
|
||||
"effectlevel": 0,
|
||||
"stataffected": "",
|
||||
"statdice": false,
|
||||
"bonusdice": false,
|
||||
"otherdice": false,
|
||||
"hindrance" : false,
|
||||
"resistedby": "",
|
||||
"recoveryroll": false,
|
||||
"recoveryrollspec": [],
|
||||
"description": ""
|
||||
},
|
||||
"race": {
|
||||
"description": "",
|
||||
"environment": "",
|
||||
|
@ -120,7 +120,7 @@
|
||||
<li class="item stat flexrow list-item" data-item-id="{{spec._id}}">
|
||||
<img class="sheet-competence-img" src="{{spec.img}}" />
|
||||
<span class="stat-label"><a class="roll-spec">{{spec.name}}</a></span>
|
||||
<span class="stat-label">{{spec.data.statistic}}</span>
|
||||
<span class="stat-label">{{upper spec.data.statistic}}</span>
|
||||
<span class="stat-label">{{spec.data.dice}}</span>
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
@ -140,7 +140,17 @@
|
||||
<li class="item stat flexrow list-item" data-item-id="{{perk._id}}">
|
||||
<img class="sheet-competence-img" src="{{perk.img}}" />
|
||||
<span class="stat-label">{{perk.name}}</span>
|
||||
<span class="stat-label">{{perk.data.level}}</span>
|
||||
<span class="stat-label">Lvl:{{perk.data.level}}</span>
|
||||
<span class="stat-label">Rounds:
|
||||
<select class="competence-base flexrow park-round-count" type="text" value="{{perk.data.roundcount}}" data-dtype="Number">
|
||||
{{#select perk.data.roundcount}}
|
||||
<option value="3">Ready</option>
|
||||
<option value="2">Activated</option>
|
||||
<option value="1">2 Rounds left</option>
|
||||
<option value="0">1 Round left</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</span>
|
||||
<div class="item-controls">
|
||||
<a class="item-control perk-active" title="active">{{#if perk.data.active}}<i
|
||||
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||
@ -184,24 +194,17 @@
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="attack-melee">Melee Attack</a></span>
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="attack-ranged">Ranged Attack</a></span>
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="defense-roll">Defense</a></span>
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="damage-melee">Melee/Thrown Damage</a></span>
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="damage-ranged">Ranged Damage</a></span>
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="damage-resistance">Damage Resistance</a></span>
|
||||
</li>
|
||||
<li class="item stat flexrow list-item">
|
||||
<span class="generic-label"><a class="unarmed-attack">Unarmed Attack</a></span>
|
||||
<span class="generic-label"><a class="damage-melee">Melee/Thrown Damage</a></span>
|
||||
<span class="generic-label"><a class="damage-ranged">Ranged Damage</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -219,6 +222,24 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<span class="generic-label">
|
||||
<h3>Effects</h3>
|
||||
</span>
|
||||
<ul class="stat-list alternate-list">
|
||||
{{#each effects as |effect key|}}
|
||||
<li class="item stat flexrow list-item" data-arme-id="{{effect.id}}" data-item-id="{{effect._id}}">
|
||||
<img class="sheet-competence-img" src="{{effect.img}}" />
|
||||
<span class="generic-label">{{effect.name}}</span>
|
||||
<span class="generic-label">{{effect.data.type}}</span>
|
||||
<span class="generic-label">{{effect.data.genre}}</span>
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<span class="generic-label">
|
||||
<h3>Weapons</h3>
|
||||
</span>
|
||||
|
@ -57,13 +57,13 @@
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq step "select-race-perks-all")}}
|
||||
<div>Select {{nbperks}} from the Perks Comepndium. Once done, click the button below<br>
|
||||
<div>Select {{nbperks}} from the Perks Compendium. Once done, click the button below<br>
|
||||
<a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-stat-key="{{key}}" >Race Perks selected!</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq step "select-race-perks")}}
|
||||
<div>Now select {{nbperks}} for your character
|
||||
<div>Now select {{nbraceperks}} Perk(s) for your character
|
||||
</div>
|
||||
<table class="table-create-actor">
|
||||
{{#each raceperks as |perk index|}}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{{#if notapplicable}}
|
||||
<option value="notapplicable">Not applicable</option>
|
||||
{{/if}}
|
||||
{{#if all}}
|
||||
<option value="notapplicable">All</option>
|
||||
{{/if}}
|
||||
<option value="agi">AGI</option>
|
||||
<option value="mnd">MND</option>
|
||||
<option value="soc">SOC</option>
|
||||
|
Loading…
Reference in New Issue
Block a user