forked from GitHub-Mirrors/foundry-sw5e
Update Core to 1.4.1
Update Core to 1.4.1 and internal Version to 1.4.1.R1-A8
This commit is contained in:
parent
f16383841b
commit
5bb253d9c3
56 changed files with 5440 additions and 3827 deletions
|
@ -13,7 +13,7 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["sw5e", "sheet", "actor", "vehicle"],
|
||||
width: 605,
|
||||
width: 720,
|
||||
height: 680
|
||||
});
|
||||
}
|
||||
|
@ -47,10 +47,17 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
_computeEncumbrance(totalWeight, actorData) {
|
||||
// Compute currency weight
|
||||
const totalCoins = Object.values(actorData.data.currency).reduce((acc, denom) => acc + denom, 0);
|
||||
totalWeight += totalCoins / CONFIG.SW5E.encumbrance.currencyPerWeight;
|
||||
|
||||
const currencyPerWeight = game.settings.get("sw5e", "metricWeightUnits")
|
||||
? CONFIG.SW5E.encumbrance.currencyPerWeight.metric
|
||||
: CONFIG.SW5E.encumbrance.currencyPerWeight.imperial;
|
||||
|
||||
totalWeight += totalCoins / currencyPerWeight;
|
||||
|
||||
// Vehicle weights are an order of magnitude greater.
|
||||
totalWeight /= CONFIG.SW5E.encumbrance.vehicleWeightMultiplier;
|
||||
totalWeight /= game.settings.get("sw5e", "metricWeightUnits")
|
||||
? CONFIG.SW5E.encumbrance.vehicleWeightMultiplier.metric
|
||||
: CONFIG.SW5E.encumbrance.vehicleWeightMultiplier.imperial;
|
||||
|
||||
// Compute overall encumbrance
|
||||
const max = actorData.data.attributes.capacity.cargo;
|
||||
|
@ -80,12 +87,10 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
|
||||
// Handle crew actions
|
||||
if (item.type === "feat" && item.data.activation.type === "crew") {
|
||||
item.crew = item.data.activation.cost;
|
||||
item.cover = game.i18n.localize(`SW5E.${item.data.cover ? "CoverTotal" : "None"}`);
|
||||
if (item.data.cover === 0.5) item.cover = "½";
|
||||
else if (item.data.cover === 0.75) item.cover = "¾";
|
||||
else if (item.data.cover === null) item.cover = "—";
|
||||
if (item.crew < 1 || item.crew === null) item.crew = "—";
|
||||
}
|
||||
|
||||
// Prepare vehicle weapons
|
||||
|
@ -114,7 +119,8 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
{
|
||||
label: game.i18n.localize("SW5E.Quantity"),
|
||||
css: "item-qty",
|
||||
property: "data.quantity"
|
||||
property: "data.quantity",
|
||||
editable: "Number"
|
||||
},
|
||||
{
|
||||
label: game.i18n.localize("SW5E.AC"),
|
||||
|
@ -138,14 +144,10 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
actions: {
|
||||
label: game.i18n.localize("SW5E.ActionPl"),
|
||||
items: [],
|
||||
hasActions: true,
|
||||
crewable: true,
|
||||
dataset: {"type": "feat", "activation.type": "crew"},
|
||||
columns: [
|
||||
{
|
||||
label: game.i18n.localize("SW5E.VehicleCrew"),
|
||||
css: "item-crew",
|
||||
property: "crew"
|
||||
},
|
||||
{
|
||||
label: game.i18n.localize("SW5E.Cover"),
|
||||
css: "item-cover",
|
||||
|
@ -179,6 +181,13 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
}
|
||||
};
|
||||
|
||||
data.items.forEach((item) => {
|
||||
item.hasUses = item.data.uses && item.data.uses.max > 0;
|
||||
item.isOnCooldown =
|
||||
item.data.recharge && !!item.data.recharge.value && item.data.recharge.charged === false;
|
||||
item.isDepleted = item.isOnCooldown && item.data.uses.per && item.data.uses.value > 0;
|
||||
});
|
||||
|
||||
const cargo = {
|
||||
crew: {
|
||||
label: game.i18n.localize("SW5E.VehicleCrew"),
|
||||
|
@ -284,6 +293,10 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
.click((evt) => evt.target.select())
|
||||
.change(this._onCargoRowChange.bind(this));
|
||||
|
||||
html.find(".item-qty:not(.cargo) input")
|
||||
.click((evt) => evt.target.select())
|
||||
.change(this._onQtyChange.bind(this));
|
||||
|
||||
if (this.actor.data.data.attributes.actions.stations) {
|
||||
html.find(".counter.actions, .counter.action-thresholds").hide();
|
||||
}
|
||||
|
@ -416,6 +429,24 @@ export default class ActorSheet5eVehicle extends ActorSheet5e {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Special handling for editing quantity value of equipment and weapons inside the features tab.
|
||||
* @param event {Event}
|
||||
* @returns {Promise<Item>}
|
||||
* @private
|
||||
*/
|
||||
|
||||
_onQtyChange(event) {
|
||||
event.preventDefault();
|
||||
const itemID = event.currentTarget.closest(".item").dataset.itemId;
|
||||
const item = this.actor.items.get(itemID);
|
||||
const qty = parseInt(event.currentTarget.value);
|
||||
event.currentTarget.value = qty;
|
||||
return item.update({"data.quantity": qty});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Handle toggling an item's crewed status.
|
||||
* @param event {Event}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue