Compare commits

..

4 Commits

Author SHA1 Message Date
241c7fa1ae Fix #6 Crew limits 2022-09-25 14:51:43 +02:00
857f36387a Fix #6 Crew limits 2022-09-25 14:45:02 +02:00
b185a3902d Fix #3 v10 fixes for processing embedded items 2022-09-25 14:26:18 +02:00
7d3f880633 Fix #1 for dropping items from compendium 2022-09-25 14:13:57 +02:00
6 changed files with 54 additions and 12 deletions

View File

@ -743,17 +743,20 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
getSubActors() {
let subActors = [];
for (let id of this.system.subactors) {
subActors.push(duplicate(game.actors.get(id)))
if (this.system.subactors) {
for (let id of this.system.subactors) {
subActors.push(duplicate(game.actors.get(id)))
}
}
return subActors;
}
/* -------------------------------------------- */
async addSubActor(subActorId) {
let subActors = duplicate(this.system.subactors);
let subActors = duplicate(this.system.subactors || []);
subActors.push(subActorId);
await this.update({ 'system.subactors': subActors });
}
/* -------------------------------------------- */
async delSubActor(subActorId) {
let newArray = [];
@ -1122,7 +1125,7 @@ export class PegasusActor extends Actor {
modifyHeroLevelRemaining(incDec) {
let biodata = duplicate(this.system.biodata)
biodata.currentlevelremaining = Math.max(biodata.currentlevelremaining + incDec, 0)
this.update({ "data.biodata": biodata })
this.update({ "system.biodata": biodata })
ChatMessage.create({ content: `${this.name} has used a Hero Level to reroll !` })
return biodata.currentlevelremaining
}
@ -1391,26 +1394,31 @@ export class PegasusActor extends Actor {
let newItems = []
if (ability.system.effectsgained) {
for (let effect of ability.system.effectsgained) {
if (!effect.system) effect.system = effect.data
newItems.push(effect);
}
}
if (ability.system.powersgained) {
for (let power of ability.system.powersgained) {
if (!power.system) power.system = power.data
newItems.push(power);
}
}
if (ability.system.specialisations) {
for (let spec of ability.system.specialisations) {
if (!spec.system) spec.system = spec.data
newItems.push(spec);
}
}
if (ability.system.attackgained) {
for (let weapon of ability.system.attackgained) {
if (!weapon.system) weapon.system = weapon.data
newItems.push(weapon);
}
}
if (ability.system.armorgained) {
for (let armor of ability.system.armorgained) {
if (!armor.system) armor.system = armor.data
newItems.push(armor);
}
}
@ -1427,11 +1435,13 @@ export class PegasusActor extends Actor {
console.log("DROPPED RACE", race)
for (let ability of race.system.abilities) {
if (!ability.system) ability.system = ability.data
newItems.push(ability)
this.applyAbility(ability, updates)
}
if (race.system.perksgained) {
for (let power of race.system.perks) {
if (!power.system) power.system = power.data
newItems.push(power);
}
}
@ -1462,7 +1472,7 @@ export class PegasusActor extends Actor {
this.getIncreaseStatValue(updates, role.system.statincrease2)
if (role.system.specialability.length > 0) {
console.log("Adding ability", role.system.specialability)
//console.log("Adding ability", role.system.specialability)
newItems = newItems.concat(duplicate(role.system.specialability)) // Add new ability
this.applyAbility(role.system.specialability[0], newItems)
}
@ -2056,6 +2066,10 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
addCrew(actorId) {
if ( this.system.crew.length >= this.system.crewmax) {
ui.notifications.warn("Vehicle crew is already full.")
return
}
let crewList = duplicate(this.system.crew.filter(actorDef => actorDef.id != actorId) || [])
crewList.push({ id: actorId })
this.update({ 'system.crew': crewList })

View File

@ -426,11 +426,15 @@ export class PegasusItemSheet extends ItemSheet {
let data = event.dataTransfer.getData('text/plain')
let dataItem = JSON.parse( data)
console.log("DROP", event, dataItem )
const item = fromUuidSync(dataItem.uuid)
let item = fromUuidSync(dataItem.uuid)
if (item.pack) {
item = await PegasusUtility.searchItem(item)
}
if (!item) {
ui.notifications.warn("Unable to find relevant item - Aborting drag&drop " + data.uuid)
return
}
console.log("DROP REULT", this.object.type, item.type)
if (this.object.type == 'virtue' ) {
if (item.type == 'effect') {

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.14",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.14.zip",
"version": "10.0.15",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.15.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -201,6 +201,8 @@
},
"vehicle": {
"crew": [],
"crewmax": 0,
"crewmin": 0,
"statistics": {
"fc": {
"label": "FC",

View File

@ -11,7 +11,11 @@
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.level"
value="{{stat.level}}" data-dtype="Number" disabled>
{{#select stat.level}}
{{{@root.optionsDiceList}}}
{{#if (eq key "ad")}}
{{{@root.optionsLevel}}}
{{else}}
{{{@root.optionsDiceList}}}
{{/if}}
{{/select}}
</select>
</div>
@ -20,8 +24,12 @@
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.currentlevel"
value="{{stat.currentlevel}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.currentlevel}}
{{{@root.optionsDiceList}}}
{{/select}}
{{#if (eq key "ad")}}
{{{@root.optionsLevel}}}
{{else}}
{{{@root.optionsDiceList}}}
{{/if}}
{{/select}}
</select>
</div>
{{#if (eq key "man")}}
@ -30,7 +38,7 @@
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.turningarc45"
value="{{stat.turningarc45}}" data-dtype="Number" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.turningarc45}}
{{{@root.optionsDiceList}}}
{{{@root.optionsLevel}}}
{{/select}}
</select>
</div>

View File

@ -553,6 +553,20 @@
{{!-- Crew Tab --}}
<div class="tab items" data-group="primary" data-tab="crew">
<div class="stat-item">
<ul class="stat-list alternate-list">
<li class="item stat flexrow list-item">
<span class="generic-label small-label "><strong>Maximum Crew Capacity</strong></span>
<input type="text" class="input-numeric-short padd-right" name="system.crewmax" value="{{data.crewmax}}"
data-dtype="Number" />
<span class="generic-label small-label"><strong>Minimum Crew Required</strong></span>
<input type="text" class="input-numeric-short" name="system.crewmin" value="{{data.crewmin}}"
data-dtype="Number" />
</li>
</ul>
</div>
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header">