This commit is contained in:
sladecraven 2022-09-27 20:31:01 +02:00
parent 85585325e3
commit ffaa9e4c19
8 changed files with 45 additions and 13 deletions

View File

@ -47,7 +47,7 @@ export class PegasusActorSheet extends ActorSheet {
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields()) ), shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields()) ),
equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ), equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ),
perks: duplicate(this.actor.getPerks()), perks: this.actor.getPerks(),
abilities: duplicate(this.actor.getAbilities()), abilities: duplicate(this.actor.getAbilities()),
activePerks: duplicate(this.actor.getActivePerks()), activePerks: duplicate(this.actor.getActivePerks()),
powers: duplicate(this.actor.getPowers()), powers: duplicate(this.actor.getPowers()),

View File

@ -120,6 +120,7 @@ export class PegasusActor extends Actor {
this.computeNRGHealth(); this.computeNRGHealth();
this.system.encCapacity = this.getEncumbranceCapacity() this.system.encCapacity = this.getEncumbranceCapacity()
this.buildContainerTree() this.buildContainerTree()
this.updatePPP()
} }
if (this.type == 'vehicle') { if (this.type == 'vehicle') {
this.computeVehicleStats(); this.computeVehicleStats();
@ -150,7 +151,12 @@ export class PegasusActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getPerks() { getPerks() {
let comp = this.items.filter(item => item.type == 'perk'); let comp = duplicate(this.items.filter(item => item.type == 'perk') || [])
for (let perk of comp) {
if (perk.system.features.range.flag) {
perk.rangeText = PegasusUtility.getRangeText( perk.system.features.range.value)
}
}
return comp; return comp;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -357,6 +363,21 @@ export class PegasusActor extends Actor {
} }
} }
/* -------------------------------------------- */
updatePPP() {
let ppp = 0
for(let power of this.items) {
if (power.type == "power") {
ppp += Number(power.system.powerlevelcost)
}
}
console.log("PPP update", ppp)
if ( ppp != this.system.ppp.spentPPP) {
console.log("PPP update2", ppp)
this.update( { 'system.ppp.spentPPP': ppp} )
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async activatePower(itemId) { async activatePower(itemId) {
let item = this.items.find(item => item.id == itemId) let item = this.items.find(item => item.id == itemId)

View File

@ -62,14 +62,19 @@ export class PegasusItemSheet extends ItemSheet {
optionsDiceList: PegasusUtility.getOptionsDiceList(), optionsDiceList: PegasusUtility.getOptionsDiceList(),
optionsStatusList: PegasusUtility.getOptionsStatusList(), optionsStatusList: PegasusUtility.getOptionsStatusList(),
data: itemData.system, data: itemData.system,
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
limited: this.object.limited, limited: this.object.limited,
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
mr: (this.object.type == 'specialisation'), mr: (this.object.type == 'specialisation'),
isGM: game.user.isGM isGM: game.user.isGM
} }
if (this.object.type == "power") {
formData.effects = await TextEditor.enrichHTML(this.object.system.effects, {async: true})
formData.purchasedeffects = await TextEditor.enrichHTML(this.object.system.purchasedeffects, {async: true})
}
this.options.editable = true //!(this.object.isEmbedded) this.options.editable = true
console.log("ITEM DATA", formData, this); console.log("ITEM DATA", formData, this);
return formData; return formData;
} }
@ -425,7 +430,6 @@ export class PegasusItemSheet extends ItemSheet {
let data = event.dataTransfer.getData('text/plain') let data = event.dataTransfer.getData('text/plain')
let dataItem = JSON.parse( data) let dataItem = JSON.parse( data)
console.log("DROP", event, dataItem )
let item = fromUuidSync(dataItem.uuid) let item = fromUuidSync(dataItem.uuid)
if (item.pack) { if (item.pack) {
item = await PegasusUtility.searchItem(item) item = await PegasusUtility.searchItem(item)
@ -434,7 +438,6 @@ export class PegasusItemSheet extends ItemSheet {
ui.notifications.warn("Unable to find relevant item - Aborting drag&drop " + data.uuid) ui.notifications.warn("Unable to find relevant item - Aborting drag&drop " + data.uuid)
return return
} }
console.log("DROP REULT", this.object.type, item.type)
if (this.object.type == 'virtue' ) { if (this.object.type == 'virtue' ) {
if (item.type == 'effect') { if (item.type == 'effect') {

View File

@ -8,6 +8,9 @@ import { PegasusRollDialog } from "./pegasus-roll-dialog.js";
const __level2Dice = ["d0", "d4", "d6", "d8", "d10", "d12"] const __level2Dice = ["d0", "d4", "d6", "d8", "d10", "d12"]
const __name2DiceValue = { "0": 0, "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10": 10, "d12": 12 } const __name2DiceValue = { "0": 0, "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10": 10, "d12": 12 }
const __dice2Level = { "d0": 0, "d4": 1, "d6": 2, "d8": 3, "d10": 4, "d12": 5 } const __dice2Level = { "d0": 0, "d4": 1, "d6": 2, "d8": 3, "d10": 4, "d12": 5 }
const __rangeKeyToText = { notapplicable: "N/A", touch: "Self Only", touchself: "Touch/Self", tz: "Threat Zone", close: "Close", medium: "Medium",
long: "Long", extreme: "Extreme", sight: "Lineof Sight", tz_close: "TZ/Close", close_medium: "Close/Medium", medium_long: "Medium/Long",
long_extreme: "Long/Extreme"}
/* -------------------------------------------- */ /* -------------------------------------------- */
export class PegasusUtility { export class PegasusUtility {
@ -98,6 +101,11 @@ export class PegasusUtility {
options.push({ name: "Apply -10", condition: true, icon: '<i class="fas fa-plus"></i>', callback: target => { PegasusCombat.decInitBy10(target.data('combatant-id'), -10); } }) options.push({ name: "Apply -10", condition: true, icon: '<i class="fas fa-plus"></i>', callback: target => { PegasusCombat.decInitBy10(target.data('combatant-id'), -10); } })
} }
/* -------------------------------------------- */
static getRangeText( rangeKey) {
return __rangeKeyToText[rangeKey] || "N/A"
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static getDiceList() { static getDiceList() {
return [{ key: "d4", level: 1, img: "systems/fvtt-pegasus-rpg/images/dice/d4.webp" }, { key: "d6", level: 2, img: "systems/fvtt-pegasus-rpg/images/dice/d6.webp" }, return [{ key: "d4", level: 1, img: "systems/fvtt-pegasus-rpg/images/dice/d4.webp" }, { key: "d6", level: 2, img: "systems/fvtt-pegasus-rpg/images/dice/d6.webp" },

View File

@ -208,7 +208,7 @@
<span class="item-field-label-short">{{perk.system.level}}</span> <span class="item-field-label-short">{{perk.system.level}}</span>
{{#if perk.system.features.range.flag}} {{#if perk.system.features.range.flag}}
<span class="item-field-label-medium">{{perk.system.features.range.value}}</span> <span class="item-field-label-medium">{{perk.rangeText}}</span>
{{else}} {{else}}
<span class="item-field-label-medium">&nbsp;-&nbsp;</span> <span class="item-field-label-medium">&nbsp;-&nbsp;</span>
@ -402,8 +402,7 @@
data-dtype="Number" /> data-dtype="Number" />
&nbsp;&nbsp; &nbsp;&nbsp;
<span class="small-label padd-right packed-left">Spent PPP</span><input type="text" <span class="small-label padd-right packed-left">Spent PPP</span><input type="text"
class="padd-right input-numeric-short" name="system.ppp.spent" value="{{data.ppp.spent}}" class="padd-right input-numeric-short" name="system.ppp.spentPPP" value="{{data.ppp.spentPPP}}" disabled data-dtype="Number" />
data-dtype="Number" />
</li> </li>
</ul> </ul>

View File

@ -9,6 +9,7 @@
{{!-- Sheet Body --}} {{!-- Sheet Body --}}
<section class="sheet-body"> <section class="sheet-body">
{{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}} {{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}}
<div class="tab details" data-group="primary" data-tab="details"> <div class="tab details" data-group="primary" data-tab="details">

View File

@ -14,15 +14,15 @@
<div class="tab description" data-group="primary" data-tab="description"> <div class="tab description" data-group="primary" data-tab="description">
<div class="medium-editor item-text-long-line"> <div class="medium-editor item-text-long-line">
<label class="generic-label">Description</label> <label class="generic-label">Description</label>
{{editor data.description target="system.description" button=true owner=owner editable=editable}} {{editor description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
<div class="medium-editor item-text-long-line"> <div class="medium-editor item-text-long-line">
<label class="generic-label">Available Effects</label> <label class="generic-label">Available Effects</label>
{{editor data.effects target="system.effects" button=true owner=owner editable=editable}} {{editor effects target="system.effects" button=true owner=owner editable=editable}}
</div> </div>
<div class="medium-editor item-text-long-line"> <div class="medium-editor item-text-long-line">
<label class="generic-label">Purchased Effects</label> <label class="generic-label">Purchased Effects</label>
{{editor data.purchasedeffects target="system.purchasedeffects" button=true owner=owner {{editor purchasedeffects target="system.purchasedeffects" button=true owner=owner
editable=editable}} editable=editable}}
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@
<div> <div>
<label class="generic-label">Description</label> <label class="generic-label">Description</label>
<div class="medium-editor item-text-long-line"> <div class="medium-editor item-text-long-line">
{{editor data.description target="system.description" button=true owner=owner editable=editable}} {{editor description target="system.description" button=true owner=owner editable=editable}}
</div> </div>
</div> </div>
</div> </div>