Fix #38
This commit is contained in:
parent
1e37ae3eb1
commit
1a5ff925b7
@ -24,7 +24,8 @@ const __isVehicleUnique = { vehiclehull: 1, powercoremodule: 1, mobilitymodule:
|
|||||||
const __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
|
const __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
|
||||||
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"]
|
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"]
|
||||||
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1,
|
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1,
|
||||||
propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1, equipment: 1, weapon: 1, armor: 1, shield:1, money: 1 }
|
propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1, equipment: 1, weapon: 1, armor: 1, shield:1, money: 1, cargo: 1 }
|
||||||
|
const __isVehicleCargo = {equipment: 1, weapon: 1, armor: 1, shield:1, money: 1, cargo: 1}
|
||||||
const __bonusEffect = {
|
const __bonusEffect = {
|
||||||
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
|
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
|
||||||
system: {
|
system: {
|
||||||
@ -159,32 +160,30 @@ export class PegasusActor extends Actor {
|
|||||||
let comp = this.items.filter(item => item.type == 'combatmodule');
|
let comp = this.items.filter(item => item.type == 'combatmodule');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
getCargos() {
|
||||||
|
let comp = this.items.filter(item => item.type == 'cargo');
|
||||||
|
return comp;
|
||||||
|
}
|
||||||
getVehicleHull() {
|
getVehicleHull() {
|
||||||
let comp = this.items.filter(item => item.type == 'vehiclehull');
|
let comp = this.items.filter(item => item.type == 'vehiclehull');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
|
||||||
getPowercoreModules() {
|
getPowercoreModules() {
|
||||||
let comp = this.items.filter(item => item.type == 'powercoremodule');
|
let comp = this.items.filter(item => item.type == 'powercoremodule');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
|
||||||
getMobilityModules() {
|
getMobilityModules() {
|
||||||
let comp = this.items.filter(item => item.type == 'mobilitymodule');
|
let comp = this.items.filter(item => item.type == 'mobilitymodule');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
|
||||||
getPropulsionModules() {
|
getPropulsionModules() {
|
||||||
let comp = this.items.filter(item => item.type == 'propulsionmodule');
|
let comp = this.items.filter(item => item.type == 'propulsionmodule');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
|
||||||
getVehicleModules() {
|
getVehicleModules() {
|
||||||
let comp = this.items.filter(item => item.type == 'vehiclemodule');
|
let comp = this.items.filter(item => item.type == 'vehiclemodule');
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
|
||||||
getVehicleWeaponModules() {
|
getVehicleWeaponModules() {
|
||||||
let comp = this.items.filter(item => item.type == 'vehicleweaponmodule');
|
let comp = this.items.filter(item => item.type == 'vehicleweaponmodule');
|
||||||
return comp;
|
return comp;
|
||||||
@ -2050,6 +2049,20 @@ export class PegasusActor extends Actor {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( __isVehicleCargo[item.type]) {
|
||||||
|
let capacity = this.getCurrentCargoCapacity()
|
||||||
|
if ( item.type == "cargo") {
|
||||||
|
capacity += Number(item.system.capacity)
|
||||||
|
} else {
|
||||||
|
let q = item.system.quantity || 1
|
||||||
|
capacity += Number(q) * Number(item.system.weight)
|
||||||
|
}
|
||||||
|
console.log("capa", capacity, this.system.cargo.cargocapacity)
|
||||||
|
if ( capacity > this.system.cargo.cargocapacity) {
|
||||||
|
ui.notifications.warn("Your cargo capacity is already full, unable to add this content : " + item.name)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2163,7 +2176,10 @@ export class PegasusActor extends Actor {
|
|||||||
for (let cargo of this.items) {
|
for (let cargo of this.items) {
|
||||||
if (cargo.type == "equipment" || cargo.type == "weapon" || cargo.type == "armor" || cargo.type == "money" || cargo.type == "shield" ) {
|
if (cargo.type == "equipment" || cargo.type == "weapon" || cargo.type == "armor" || cargo.type == "money" || cargo.type == "shield" ) {
|
||||||
let q = cargo.system.quantity || 1
|
let q = cargo.system.quantity || 1
|
||||||
capacity += q * cargo.system.weight
|
capacity += Number(q) * Number(cargo.system.weight)
|
||||||
|
}
|
||||||
|
if (cargo.type == "cargo" ) {
|
||||||
|
capacity += Number(cargo.system.capacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return capacity
|
return capacity
|
||||||
|
@ -58,6 +58,7 @@ export class PegasusVehicleSheet 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()) ),
|
||||||
|
cargos: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getCargos()) ),
|
||||||
cargoCurrent: this.actor.getCurrentCargoCapacity(),
|
cargoCurrent: this.actor.getCurrentCargoCapacity(),
|
||||||
moneys: duplicate(this.actor.getMoneys()),
|
moneys: duplicate(this.actor.getMoneys()),
|
||||||
options: this.options,
|
options: this.options,
|
||||||
|
@ -253,7 +253,7 @@
|
|||||||
],
|
],
|
||||||
"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": "10.0.17",
|
"version": "10.0.18",
|
||||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.17.zip",
|
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.18.zip",
|
||||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
@ -596,7 +596,7 @@
|
|||||||
<ul class="stat-list alternate-list">
|
<ul class="stat-list alternate-list">
|
||||||
<li class="item stat flexrow list-item">
|
<li class="item stat flexrow list-item">
|
||||||
<span class="generic-label small-label "><strong>Cargo Capacity</strong></span>
|
<span class="generic-label small-label "><strong>Cargo Capacity</strong></span>
|
||||||
<input type="text" class="input-numeric-short padd-right" name="system.cargocapacity" value="{{data.cargocapacity}}"
|
<input type="text" class="input-numeric-short padd-right" name="system.cargo.cargocapacity" value="{{data.cargo.cargocapacity}}"
|
||||||
data-dtype="Number" />
|
data-dtype="Number" />
|
||||||
<span class="generic-label small-label"><strong>Total Cargo Capacity</strong></span>
|
<span class="generic-label small-label"><strong>Total Cargo Capacity</strong></span>
|
||||||
<input type="text" class="input-numeric-short" value="{{cargoCurrent}}"
|
<input type="text" class="input-numeric-short" value="{{cargoCurrent}}"
|
||||||
@ -605,6 +605,54 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul class="item-list alternate-list">
|
||||||
|
<li class="item flexrow list-item items-title-bg">
|
||||||
|
<span class="item-name-label-header">
|
||||||
|
<h3><label class="items-title-text">Cargo</label></h3>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-long">
|
||||||
|
<label class="short-label">Capacity</label>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-medium">
|
||||||
|
<label class="short-label">Value</label>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-medium">
|
||||||
|
<label class="short-label">IDR</label>
|
||||||
|
</span>
|
||||||
|
<div class="item-filler"> </div>
|
||||||
|
<div class="item-controls item-controls-fixed">
|
||||||
|
<a class="item-control item-add" data-type="cargo" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{#each cargos as |cargo key|}}
|
||||||
|
<li class="item flexrow list-item list-item-shadow" data-item-id="{{money._id}}">
|
||||||
|
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||||
|
src="{{cargo.img}}" /></a>
|
||||||
|
<span class="item-name-label">{{cargo.name}}</span>
|
||||||
|
|
||||||
|
<span class="item-field-label-long"><label>
|
||||||
|
{{cargo.system.capacity}}
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-medium">
|
||||||
|
<label>{{cargo.system.value}}</label>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-medium">
|
||||||
|
{{#if cargo.system.idrDice}}
|
||||||
|
<a class="roll-idr" data-dice-value="{{cargo.system.idrDice}}">{{cargo.system.idrDice}}</a>
|
||||||
|
{{else}}
|
||||||
|
-
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="item-filler"> </div>
|
||||||
|
<div class="item-controls item-controls-fixed">
|
||||||
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul class="item-list alternate-list">
|
<ul class="item-list alternate-list">
|
||||||
<li class="item flexrow list-item items-title-bg">
|
<li class="item flexrow list-item items-title-bg">
|
||||||
<span class="item-name-label-header">
|
<span class="item-name-label-header">
|
||||||
|
Loading…
Reference in New Issue
Block a user