Make DS4Item compile and commen getData methods for now
This commit is contained in:
parent
446340c064
commit
918fa5081b
4 changed files with 62 additions and 72 deletions
|
@ -9,7 +9,6 @@ import { ModifiableDataBaseTotal } from "../../common/common-data";
|
|||
import { DS4 } from "../../config";
|
||||
import { getCanvas } from "../../helpers";
|
||||
import { DS4Item } from "../../item/item";
|
||||
import { DS4ItemData } from "../../item/item-data-source";
|
||||
import { getDS4Settings } from "../../settings";
|
||||
import notifications from "../../ui/notifications";
|
||||
import { DS4Actor } from "../actor";
|
||||
|
@ -51,39 +50,39 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options> {
|
|||
return `${basePath}/${this.actor.data.type}-sheet.hbs`;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the data for the template of the actor sheet.
|
||||
* It explicitly adds the items of the object sorted by type in the
|
||||
* object itemsByType.
|
||||
* @returns The data fed to the template of the actor sheet
|
||||
*/
|
||||
async getData(): Promise<ActorSheet.Data<DS4Actor>> {
|
||||
const itemsByType = Object.fromEntries(
|
||||
Object.entries(this.actor.itemTypes).map(([itemType, items]) => {
|
||||
return [itemType, items.map((item) => item.data).sort((a, b) => (a.sort || 0) - (b.sort || 0))];
|
||||
}),
|
||||
);
|
||||
const data = {
|
||||
...this._addTooltipsToData(await super.getData()),
|
||||
// Add the localization config to the data:
|
||||
config: DS4,
|
||||
// Add the items explicitly sorted by type to the data:
|
||||
itemsByType,
|
||||
settings: getDS4Settings(),
|
||||
};
|
||||
return data;
|
||||
}
|
||||
// /**
|
||||
// * This method returns the data for the template of the actor sheet.
|
||||
// * It explicitly adds the items of the object sorted by type in the
|
||||
// * object itemsByType.
|
||||
// * @returns The data fed to the template of the actor sheet
|
||||
// */
|
||||
// async getData(): Promise<ActorSheet.Data<DS4Actor>> {
|
||||
// const itemsByType = Object.fromEntries(
|
||||
// Object.entries(this.actor.itemTypes).map(([itemType, items]) => {
|
||||
// return [itemType, items.map((item) => item.data).sort((a, b) => (a.sort || 0) - (b.sort || 0))];
|
||||
// }),
|
||||
// );
|
||||
// const data = {
|
||||
// ...this._addTooltipsToData(await super.getData()),
|
||||
// // Add the localization config to the data:
|
||||
// config: DS4,
|
||||
// // Add the items explicitly sorted by type to the data:
|
||||
// itemsByType,
|
||||
// settings: getDS4Settings(),
|
||||
// };
|
||||
// return data;
|
||||
// }
|
||||
|
||||
protected _addTooltipsToData(data: ActorSheet.Data<DS4Actor>): ActorSheet.Data<DS4Actor> {
|
||||
const valueGroups = [data.data.attributes, data.data.traits, data.data.combatValues];
|
||||
// protected _addTooltipsToData(data: ActorSheet.Data<DS4Actor>): ActorSheet.Data<DS4Actor> {
|
||||
// const valueGroups = [data.data.attributes, data.data.traits, data.data.combatValues];
|
||||
|
||||
valueGroups.forEach((valueGroup) => {
|
||||
Object.values(valueGroup).forEach((attribute: ModifiableDataBaseTotal<number> & { tooltip?: string }) => {
|
||||
attribute.tooltip = this._getTooltipForValue(attribute);
|
||||
});
|
||||
});
|
||||
return data;
|
||||
}
|
||||
// valueGroups.forEach((valueGroup) => {
|
||||
// Object.values(valueGroup).forEach((attribute: ModifiableDataBaseTotal<number> & { tooltip?: string }) => {
|
||||
// attribute.tooltip = this._getTooltipForValue(attribute);
|
||||
// });
|
||||
// });
|
||||
// return data;
|
||||
// }
|
||||
|
||||
protected _getTooltipForValue(value: ModifiableDataBaseTotal<number>): string {
|
||||
return `${value.base} (${game.i18n.localize("DS4.TooltipBaseValue")}) + ${value.mod} (${game.i18n.localize(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue