Get items appearing on the sheet, still a lot to do but this is a strong step in the right direction
This commit is contained in:
parent
6b03d62234
commit
23a402f11a
9 changed files with 254 additions and 10 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { toPrecision } from "../../utils/roundToPrecision.mjs";
|
||||
|
||||
export class GenericItemData extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
@ -28,4 +30,12 @@ export class GenericItemData extends foundry.abstract.TypeDataModel {
|
|||
}),
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the total weight of the item based on the quantity of it, this
|
||||
* rounds the number to the nearest 2 decimal places.
|
||||
*/
|
||||
get quantifiedWeight() {
|
||||
return toPrecision(this.weight * this.quantity, 2);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue