Add a datasheet for untyped items and foils
This commit is contained in:
parent
3d8d041915
commit
0f28e23b5c
7 changed files with 201 additions and 0 deletions
|
|
@ -75,6 +75,9 @@
|
||||||
"send-to-chat": "Send to Chat",
|
"send-to-chat": "Send to Chat",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"delete": "Delete"
|
"delete": "Delete"
|
||||||
|
},
|
||||||
|
"sheet-names": {
|
||||||
|
"UntypedDataSheet": "Data Sheet"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TYPES": {
|
"TYPES": {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import "./hooks/hotReload.mjs";
|
||||||
|
|
||||||
// Misc Imports
|
// Misc Imports
|
||||||
import loadSettings from "./settings/index.mjs";
|
import loadSettings from "./settings/index.mjs";
|
||||||
|
import { devInit } from "./hooks/devInit.mjs";
|
||||||
import DOTDUNGEON from "./config.mjs";
|
import DOTDUNGEON from "./config.mjs";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -101,6 +102,9 @@ Hooks.once(`init`, async () => {
|
||||||
label: "dotdungeon.sheet-names.PetSheet"
|
label: "dotdungeon.sheet-names.PetSheet"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (game.settings.get(`dotdungeon`, `devMode`)) {
|
||||||
|
devInit();
|
||||||
|
};
|
||||||
|
|
||||||
hbs.registerHandlebarsHelpers();
|
hbs.registerHandlebarsHelpers();
|
||||||
hbs.preloadHandlebarsTemplates();
|
hbs.preloadHandlebarsTemplates();
|
||||||
|
|
|
||||||
17
module/hooks/devInit.mjs
Normal file
17
module/hooks/devInit.mjs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
Initialization of dev-specific features for the init hook, this is primarily
|
||||||
|
used to register all of the data sheets of various entity types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { UntypedDataSheet } from "../sheets/Datasheets/UntypedDataSheet.mjs";
|
||||||
|
|
||||||
|
export function devInit() {
|
||||||
|
Items.registerSheet(
|
||||||
|
`dotdungeon`,
|
||||||
|
UntypedDataSheet,
|
||||||
|
{
|
||||||
|
types: [`untyped`, `foil`],
|
||||||
|
label: `dotdungeon.sheet-names.UntypedDataSheet`,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
27
module/sheets/Datasheets/UntypedDataSheet.mjs
Normal file
27
module/sheets/Datasheets/UntypedDataSheet.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
export class UntypedDataSheet extends ItemSheet {
|
||||||
|
static get defaultOptions() {
|
||||||
|
let opts = foundry.utils.mergeObject(
|
||||||
|
super.defaultOptions,
|
||||||
|
{
|
||||||
|
template: `systems/dotdungeon/templates/datasheets/untyped.hbs`,
|
||||||
|
width: 650,
|
||||||
|
height: 700
|
||||||
|
},
|
||||||
|
);
|
||||||
|
opts.classes.push(`dotdungeon`, `style-v3`);
|
||||||
|
return opts;
|
||||||
|
};
|
||||||
|
|
||||||
|
async getData() {
|
||||||
|
const ctx = {};
|
||||||
|
|
||||||
|
ctx.item = this.item;
|
||||||
|
ctx.system = this.item.system;
|
||||||
|
|
||||||
|
ctx.meta = {
|
||||||
|
idp: this.item.uuid,
|
||||||
|
};
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
@use "./elements/hr.scss";
|
@use "./elements/hr.scss";
|
||||||
@use "./elements/icons.scss";
|
@use "./elements/icons.scss";
|
||||||
|
|
||||||
|
/* Sheet Layouts */
|
||||||
|
@use "./layouts/datasheet.scss";
|
||||||
|
|
||||||
/* Sheet Options */
|
/* Sheet Options */
|
||||||
.dotdungeon.style-v3 {
|
.dotdungeon.style-v3 {
|
||||||
--scrollbar-width: 5px;
|
--scrollbar-width: 5px;
|
||||||
|
|
|
||||||
6
styles/v3/layouts/datasheet.scss
Normal file
6
styles/v3/layouts/datasheet.scss
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
.dotdungeon.style-v3 .datasheet {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
141
templates/datasheets/untyped.hbs
Normal file
141
templates/datasheets/untyped.hbs
Normal file
|
|
@ -0,0 +1,141 @@
|
||||||
|
<form autocomplete="off" class="datasheet">
|
||||||
|
<div>
|
||||||
|
<label for="{{meta.idp}}-name" data-tooltip="name">Name</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
id="{{meta.idp}}-name"
|
||||||
|
value="{{item.name}}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.quantity"
|
||||||
|
data-tooltip="system.quantity"
|
||||||
|
>
|
||||||
|
Quantity
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
name="system.quantity"
|
||||||
|
id="{{meta.idp}}-system.quantity"
|
||||||
|
value="{{system.quantity}}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.uses_inventory_slot"
|
||||||
|
data-tooltip="system.uses_inventory_slot"
|
||||||
|
>
|
||||||
|
Uses Inventory Slot?
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="system.uses_inventory_slot"
|
||||||
|
id="{{meta.idp}}-system.uses_inventory_slot"
|
||||||
|
{{checked system.uses_inventory_slot}}
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.quantity_affects_used_capacity"
|
||||||
|
data-tooltip="system.quantity_affects_used_capacity"
|
||||||
|
>
|
||||||
|
Quantity Impacts Used Capacity
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="system.quantity_affects_used_capacity"
|
||||||
|
id="{{meta.idp}}-system.quantity_affects_used_capacity"
|
||||||
|
{{checked system.quantity_affects_used_capacity}}
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Computed Capacity Usage: {{item.usedCapacity}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.buy"
|
||||||
|
data-tooltip="system.buy"
|
||||||
|
>
|
||||||
|
Purchase Cost
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
name="system.buy"
|
||||||
|
id="{{meta.idp}}-system.buy"
|
||||||
|
value="{{system.buy}}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.usage_cost"
|
||||||
|
data-tooltip="system.usage_cost"
|
||||||
|
>
|
||||||
|
Usage Cost
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
name="system.usage_cost"
|
||||||
|
id="{{meta.idp}}-system.usage_cost"
|
||||||
|
value="{{system.usage_cost}}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.tier"
|
||||||
|
data-tooltip="system.tier"
|
||||||
|
>
|
||||||
|
Rarity
|
||||||
|
</label>
|
||||||
|
{{!-- TODO: Dropdown? --}}
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="system.tier"
|
||||||
|
id="{{meta.idp}}-system.tier"
|
||||||
|
value="{{system.tier}}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.combat_relevant"
|
||||||
|
data-tooltip="system.combat_relevant"
|
||||||
|
>
|
||||||
|
Shows Up In Combat Tab?
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="system.combat_relevant"
|
||||||
|
id="{{meta.idp}}-system.combat_relevant"
|
||||||
|
{{checked system.combat_relevant}}
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.location"
|
||||||
|
data-tooltip="system.location"
|
||||||
|
>
|
||||||
|
Location
|
||||||
|
</label>
|
||||||
|
{{!-- TODO: Dropdown? --}}
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="system.location"
|
||||||
|
id="{{meta.idp}}-system.location"
|
||||||
|
value="{{system.location}}"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="{{meta.idp}}-system.description"
|
||||||
|
data-tooltip="system.description"
|
||||||
|
>
|
||||||
|
Description
|
||||||
|
</label>
|
||||||
|
{{!-- TODO: Dropdown? --}}
|
||||||
|
<textarea name="system.description" id="{{meta.idp}}-system.description">{{system.description}}</textarea>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue