The calculated capacity is how much space in your inventory that the item will take up, the way it is calculated is determined by the item. Usually the main thing that affects the capacity is the item's quantity, but this can be turned off by the @dotdungeon.common.gm, which means that no matter the quantity it will only use up one capacity. The @dotdungeon.common.gm can also entirely disable capacity usage which will make the used capacity always be zero.
This action cannot be undone."
}
+ },
+ "untyped": {
+ "delete": {
+ "title": "Confirm Item Deletion",
+ "content": "Are you sure you would like to delete the item: {name}
This action cannot be undone."
+ }
}
},
"keyword": {
@@ -316,6 +329,9 @@
},
"pet": {
"name": "(Unnamed Pet)"
+ },
+ "untyped": {
+ "name": "Unknown Item"
}
}
},
diff --git a/module/components/icon.mjs b/module/components/icon.mjs
new file mode 100644
index 0000000..8c70d40
--- /dev/null
+++ b/module/components/icon.mjs
@@ -0,0 +1,125 @@
+import { StyledShadowElement } from "./mixins/Styles.mjs";
+
+/**
+Attributes:
+@property {string} name - The name of the icon, takes precedence over the path
+@property {string} path - The path of the icon file
+*/
+export class DotDungeonIcon extends StyledShadowElement(HTMLElement) {
+ static elementName = `dd-icon`;
+ static formAssociated = false;
+
+ /* Stuff for the mixin to use */
+ static _stylePath = `v3/components/icon.css`;
+
+
+ static _cache = new Map();
+ #container;
+ /** @type {null | string} */
+ _name;
+ /** @type {null | string} */
+ _path;
+
+ /* Stored IDs for all of the hooks that are in this component */
+ #svgHmr;
+
+ constructor() {
+ super();
+ // this._shadow = this.attachShadow({ mode: `open`, delegatesFocus: true });
+
+ this.#container = document.createElement(`div`);
+ this._shadow.appendChild(this.#container);
+ };
+
+ _mounted = false;
+ async connectedCallback() {
+ super.connectedCallback();
+ if (this._mounted) return;
+
+ this._name = this.getAttribute(`name`);
+ this._path = this.getAttribute(`path`);
+
+ /*
+ This converts all of the double-dash prefixed properties on the element to
+ CSS variables so that they don't all need to be provided by doing style=""
+ */
+ for (const attrVar of this.attributes) {
+ if (attrVar.name?.startsWith(`var:`)) {
+ const prop = attrVar.name.replace(`var:`, ``);
+ this.style.setProperty(`--` + prop, attrVar.value);
+ };
+ };
+
+ /*
+ Try to retrieve the icon if it isn't present, try the path then default to
+ the slot content, as then we can have a default per-icon usage
+ */
+ let content;
+ if (this._name) {
+ content = await this.#getIcon(`./systems/dotdungeon/assets/${this._name}.svg`);
+ };
+
+ if (this._path && !content) {
+ content = await this.#getIcon(this._path);
+ };
+
+ if (content) {
+ this.#container.appendChild(content.cloneNode(true));
+ };
+
+ /*
+ This is so that when we get an HMR event from Foundry we can appropriately
+ handle it using our logic to update the component and the icon cache.
+ */
+ if (game.settings.get(`dotdungeon`, `devMode`)) {
+ this.#svgHmr = Hooks.on(`dd-hmr:svg`, (iconName, data) => {
+ if (this._name === iconName || this._path?.endsWith(data.path)) {
+ const svg = this.#parseSVG(data.content);
+ this.constructor._cache.set(iconName, svg);
+ this.#container.replaceChildren(svg.cloneNode(true));
+ };
+ });
+ };
+
+ this._mounted = true;
+ };
+
+ disconnectedCallback() {
+ super.disconnectedCallback();
+ if (!this._mounted) return;
+
+ Hooks.off(`dd-hmr:svg`, this.#svgHmr);
+
+ this._mounted = false;
+ };
+
+ async #getIcon(path) {
+ // Cache hit!
+ if (this.constructor._cache.has(path)) {
+ console.debug(`.dungeon | Icon ${path} cache hit`);
+ return this.constructor._cache.get(path);
+ };
+
+ const r = await fetch(path);
+ switch (r.status) {
+ case 200:
+ case 201:
+ break;
+ default:
+ console.error(`.dungeon | Failed to fetch icon: ${path}`);
+ return;
+ };
+
+ console.debug(`.dungeon | Adding icon ${path} to the cache`);
+ const svg = this.#parseSVG(await r.text());
+ this.constructor._cache.set(path, svg);
+ return svg;
+ };
+
+ /** Takes an SVG string and returns it as a DOM node */
+ #parseSVG(content) {
+ const temp = document.createElement(`div`);
+ temp.innerHTML = content;
+ return temp.querySelector(`svg`);
+ };
+};
diff --git a/module/components/incrementer.mjs b/module/components/incrementer.mjs
new file mode 100644
index 0000000..68e426a
--- /dev/null
+++ b/module/components/incrementer.mjs
@@ -0,0 +1,149 @@
+import { DotDungeonIcon } from "./icon.mjs";
+import { StyledShadowElement } from "./mixins/Styles.mjs";
+
+/**
+Attributes:
+@property {string} name - The path to the value to update
+@property {number} value - The actual value of the input
+@property {number} min - The minimum value of the input
+@property {number} max - The maximum value of the input
+@property {number?} smallStep - The step size used for the buttons and arrow keys
+@property {number?} largeStep - The step size used for the buttons + Ctrl and page up / down
+
+Styling:
+- `--height`: Controls the height of the element + the width of the buttons (default: 1.25rem)
+- `--width`: Controls the width of the number input (default 50px)
+*/
+export class DotDungeonIncrementer extends StyledShadowElement(HTMLElement) {
+ static elementName = `dd-incrementer`;
+ static formAssociated = true;
+
+ static _stylePath = `v3/components/incrementer.css`;
+
+ _internals;
+ #input;
+
+ _min;
+ _max;
+ _smallStep;
+ _largeStep;
+
+ constructor() {
+ super();
+
+ // Form internals
+ this._internals = this.attachInternals();
+ this._internals.role = `spinbutton`;
+ };
+
+ get form() {
+ return this._internals.form;
+ }
+
+ get name() {
+ return this.getAttribute(`name`);
+ }
+ set name(value) {
+ this.setAttribute(`name`, value);
+ }
+
+ get value() {
+ return this.getAttribute(`value`);
+ };
+ set value(value) {
+ this.setAttribute(`value`, value);
+ };
+
+ get type() {
+ return `number`;
+ }
+
+ connectedCallback() {
+ super.connectedCallback();
+ this.replaceChildren();
+
+ // Attribute parsing / registration
+ const value = this.getAttribute(`value`);
+ this._min = parseInt(this.getAttribute(`min`) ?? 0);
+ this._max = parseInt(this.getAttribute(`max`) ?? 0);
+ this._smallStep = parseInt(this.getAttribute(`smallStep`) ?? 1);
+ this._largeStep = parseInt(this.getAttribute(`largeStep`) ?? 5);
+
+ this._internals.ariaValueMin = this._min;
+ this._internals.ariaValueMax = this._max;
+
+ const container = document.createElement(`div`);
+
+ // The input that the user can see / modify
+ const input = document.createElement(`input`);
+ this.#input = input;
+ input.type = `number`;
+ input.ariaHidden = true;
+ input.min = this.getAttribute(`min`);
+ input.max = this.getAttribute(`max`);
+ input.addEventListener(`change`, this.#updateValue.bind(this));
+ input.value = value;
+
+ // plus button
+ const increment = document.createElement(DotDungeonIcon.elementName);
+ increment.setAttribute(`name`, `ui/plus`);
+ increment.setAttribute(`var:size`, `0.75rem`);
+ increment.setAttribute(`var:fill`, `currentColor`);
+ increment.ariaHidden = true;
+ increment.classList.value = `increment`;
+ increment.addEventListener(`mousedown`, this.#increment.bind(this));
+
+ // minus button
+ const decrement = document.createElement(DotDungeonIcon.elementName);
+ decrement.setAttribute(`name`, `ui/minus`);
+ decrement.setAttribute(`var:size`, `0.75rem`);
+ decrement.setAttribute(`var:fill`, `currentColor`);
+ decrement.ariaHidden = true;
+ decrement.classList.value = `decrement`;
+ decrement.addEventListener(`mousedown`, this.#decrement.bind(this));
+
+ // Construct the DOM
+ container.appendChild(decrement);
+ container.appendChild(input);
+ container.appendChild(increment);
+ this._shadow.appendChild(container);
+
+ /*
+ This converts all of the namespace prefixed properties on the element to
+ CSS variables so that they don't all need to be provided by doing style=""
+ */
+ for (const attrVar of this.attributes) {
+ if (attrVar.name?.startsWith(`var:`)) {
+ const prop = attrVar.name.replace(`var:`, ``);
+ this.style.setProperty(`--` + prop, attrVar.value);
+ };
+ };
+ };
+
+ #updateValue() {
+ let value = parseInt(this.#input.value);
+ if (this.getAttribute(`min`)) value = Math.max(this._min, value);
+ if (this.getAttribute(`max`)) value = Math.min(this._max, value);
+ this.#input.value = value;
+ this.value = value;
+ this.dispatchEvent(new Event(`change`, { bubbles: true }));
+ };
+
+ /** @param {Event} $e */
+ #increment($e) {
+ $e.preventDefault();
+ let value = parseInt(this.#input.value);
+ value += $e.ctrlKey ? this._largeStep : this._smallStep;
+ this.#input.value = value;
+ this.#updateValue();
+ };
+
+ /** @param {Event} $e */
+ #decrement($e) {
+ $e.preventDefault();
+ let value = parseInt(this.#input.value);
+ value -= $e.ctrlKey ? this._largeStep : this._smallStep;
+ this.#input.value = value;
+ this.#updateValue();
+ };
+};
diff --git a/module/components/index.mjs b/module/components/index.mjs
new file mode 100644
index 0000000..f4d39e9
--- /dev/null
+++ b/module/components/index.mjs
@@ -0,0 +1,23 @@
+import { DotDungeonIncrementer } from "./incrementer.mjs";
+import { DotDungeonIcon } from "./icon.mjs";
+
+const components = [
+ DotDungeonIcon,
+ DotDungeonIncrementer,
+];
+
+export function registerCustomComponents() {
+ (CONFIG.CACHE ??= {}).componentListeners ??= [];
+ for (const component of components) {
+ if (!window.customElements.get(component.elementName)) {
+ console.debug(`.dungeon | Registering component "${component.elementName}"`);
+ window.customElements.define(
+ component.elementName,
+ component
+ );
+ if (component.formAssociated) {
+ CONFIG.CACHE.componentListeners.push(component.elementName);
+ }
+ };
+ }
+};
diff --git a/module/components/mixins/Styles.mjs b/module/components/mixins/Styles.mjs
new file mode 100644
index 0000000..33d5eb5
--- /dev/null
+++ b/module/components/mixins/Styles.mjs
@@ -0,0 +1,80 @@
+/**
+ * @param {HTMLElement} Base
+ */
+export function StyledShadowElement(Base) {
+ return class extends Base {
+ /**
+ * The path to the CSS that is loaded
+ * @type {string}
+ */
+ static _stylePath;
+
+ /**
+ * The stringified CSS to use
+ * @type {string}
+ */
+ static _styles;
+
+ /**
+ * The HTML element of the stylesheet
+ * @type {HTMLStyleElement}
+ */
+ _style;
+
+ /** @type {ShadowRoot} */
+ _shadow;
+
+ /**
+ * The hook ID for this element's CSS hot reload
+ * @type {number}
+ */
+ #cssHmr;
+
+ constructor() {
+ super();
+
+ this._shadow = this.attachShadow({ mode: `open` });
+ this._style = document.createElement(`style`);
+ this._shadow.appendChild(this._style);
+ };
+
+ #mounted = false;
+ connectedCallback() {
+ if (this.#mounted) return;
+
+ this._getStyles();
+
+ if (game.settings.get(`dotdungeon`, `devMode`)) {
+ this.#cssHmr = Hooks.on(`dd-hmr:css`, (data) => {
+ if (data.path.endsWith(this.constructor._stylePath)) {
+ this._style.innerHTML = data.content;
+ };
+ });
+ };
+
+ this.#mounted = true;
+ };
+
+ disconnectedCallback() {
+ if (!this.#mounted) return;
+ if (this.#cssHmr != null) {
+ Hooks.off(`dd-hmr:css`, this.#cssHmr);
+ this.#cssHmr = null;
+ };
+ this.#mounted = false;
+ };
+
+ _getStyles() {
+ if (this.constructor._styles) {
+ this._style.innerHTML = this.constructor._styles;
+ } else {
+ fetch(`./systems/dotdungeon/.styles/${this.constructor._stylePath}`)
+ .then(r => r.text())
+ .then(t => {
+ this.constructor._styles = t;
+ this._style.innerHTML = t;
+ });
+ }
+ };
+ };
+};
diff --git a/module/config.mjs b/module/config.mjs
index 95150f6..56a0fb4 100644
--- a/module/config.mjs
+++ b/module/config.mjs
@@ -1,35 +1,71 @@
-const statDice = [ `d4`, `d6`, `d8`, `d10`, `d12`, `d20` ];
+export const statDice = [ `d4`, `d6`, `d8`, `d10`, `d12`, `d20` ];
-const trainingLevels = [``, `locked`, `+2`, `+4`];
+export const trainingLevels = [
+ { key: "locked", label: "dotdungeon.trainingLevel.locked", value: -1 },
+ { key: "untrained", label: "dotdungeon.trainingLevel.untrained", value: 0 },
+ { key: "trained", label: "dotdungeon.trainingLevel.trained", value: 2 },
+ { key: "expert", label: "dotdungeon.trainingLevel.expert", value: 4 },
+];
-const damageTypes = [ `slashing`, `piercing`, `smashing`, `gun`, `neon`, `shadow`, `solar` ];
+export const damageTypes = [ `slashing`, `piercing`, `smashing`, `gun`, `neon`, `shadow`, `solar` ];
-const ammoTypes = [`quivers`, `mags`, `cells`];
+export const ammoTypes = [`quivers`, `mags`, `cells`];
-const stats = [ `build`, `meta`, `presence`, `hands`, `tilt`, `rng` ];
+export const stats = [ `build`, `meta`, `presence`, `hands`, `tilt`, `rng` ];
-const buildSkills = [ `defense`, `magic`, `melee`, `platforming`, `strength`, ];
-const metaSkills = [ `alchemy`, `arcanum`, `dreams`, `lore`, `navigation`, ];
-const presenceSkills = [ `animal_handling`, `perception`, `sneak`, `speech`, `vibes`, ];
-const handsSkills = [ `accuracy`, `crafting`, `engineering`, `explosives`, `piloting`, ];
+export const buildSkills = [ `defense`, `magic`, `melee`, `platforming`, `strength`, ];
+export const metaSkills = [ `alchemy`, `arcanum`, `dreams`, `lore`, `navigation`, ];
+export const presenceSkills = [ `animal_handling`, `perception`, `sneak`, `speech`, `vibes`, ];
+export const handsSkills = [ `accuracy`, `crafting`, `engineering`, `explosives`, `piloting`, ];
-const allSkills = [
+export const allSkills = [
...buildSkills,
...metaSkills,
...presenceSkills,
...handsSkills,
];
-const skills = {
+export const skills = {
build: buildSkills,
meta: metaSkills,
presence: presenceSkills,
hands: handsSkills,
};
-const itemTiers = [
- `simple`, `greater`,
- `rare`, `legendary`
+export const defaultItemTier = `simple`;
+export const itemTiers = [
+ { value: `simple`, label: `dotdungeon.rarity.simple` },
+ { value: `greater`, label: `dotdungeon.rarity.greater` },
+ { value: `rare`, label: `dotdungeon.rarity.rare` },
+ { value: `legendary`, label: `dotdungeon.rarity.legendary` },
+];
+
+export const syncMilestones = [
+ { value: 20, andReturn: true },
+ { value: 40, andReturn: false },
+ { value: 60, andReturn: true },
+ { value: 80, andReturn: false },
+ { value: 100, andReturn: true },
+];
+
+export const syncDice = `1d20`;
+
+export const localizerConfig = {
+ subKeyPattern: /@(?[a-zA-Z\.]+)/gm,
+ maxDepth: 10,
+};
+
+export const itemFilters = [
+ `material`,
+ `untyped`,
+ `aspect`,
+ `weapon`,
+ `armour`,
+ `equipment`,
+ `foil`,
+ `pet`,
+ `structure`,
+ `service`,
];
export default {
@@ -44,5 +80,10 @@ export default {
handsSkills,
allSkills,
skills,
+ defaultItemTier,
itemTiers,
-};
\ No newline at end of file
+ syncMilestones,
+ syncDice,
+ localizerConfig,
+ itemFilters,
+};
diff --git a/module/dialogs/DiceList.mjs b/module/dialogs/DiceList.mjs
new file mode 100644
index 0000000..3c305c8
--- /dev/null
+++ b/module/dialogs/DiceList.mjs
@@ -0,0 +1,82 @@
+import { GenericDialog } from "./GenericDialog.mjs";
+
+export class DiceList extends GenericDialog {
+
+ constructor(mobActor) {
+ super({}, { title: `${mobActor.name}'s Dice List` });
+ this.actor = mobActor;
+ this.dice = this.actor.system.dice.map((d) => ({
+ ...d,
+ id: randomID(),
+ }));
+ };
+
+ static get defaultOptions() {
+ const opts = foundry.utils.mergeObject({
+ ...super.defaultOptions,
+ template: `systems/dotdungeon/templates/dialogs/diceList.hbs`,
+ width: 275,
+ height: 400,
+ submitOnClose: false,
+ resizable: true,
+ });
+ opts.classes?.push(`dotdungeon`);
+ return opts;
+ };
+
+ async getData() {
+ const ctx = await super.getData();
+ ctx.dice = this.dice;
+ return ctx;
+ };
+
+ async activateListeners(html) {
+ super.activateListeners(html);
+
+ if (!this.isEditable) return;
+ console.debug(`.dungeon | DiceList adding event listeners`);
+
+ html.find(`[data-die-update]`)
+ .on(`change`, this.updateDieInMemoryOnly.bind(this))
+ };
+
+ async _updateObject(_event, formData) {
+ const newDice = this.dice.map(d => {
+ return {
+ count: formData[`${d.id}.count`],
+ sides: formData[`${d.id}.sides`],
+ repeat: formData[`${d.id}.repeat`],
+ };
+ });
+ await this.actor.update({ "system.dice": newDice });
+ };
+
+ updateDieInMemoryOnly($e) {
+ const target = $e.currentTarget;
+ const data = target.dataset;
+ const value = target.value;
+ const [ dieId, field ] = data.dieUpdate.split(`.`);
+ for (const die of this.dice) {
+ if (die.id === dieId) {
+ die[field] = value;
+ return
+ };
+ };
+ };
+
+ addDie() {
+ this.dice.push({
+ count: 1,
+ sides: 2,
+ repeat: 1,
+ id: randomID(),
+ });
+ this.render();
+ };
+
+ deleteDie($e) {
+ const data = $e.currentTarget.dataset;
+ this.dice = this.dice.filter(d => d.id !== data.id);
+ this.render();
+ };
+};
diff --git a/module/sheets/GenericItemSheet.mjs b/module/dialogs/GenericDialog.mjs
similarity index 61%
rename from module/sheets/GenericItemSheet.mjs
rename to module/dialogs/GenericDialog.mjs
index 098cc5b..1cd1c02 100644
--- a/module/sheets/GenericItemSheet.mjs
+++ b/module/dialogs/GenericDialog.mjs
@@ -1,22 +1,11 @@
import DOTDUNGEON from "../config.mjs";
-export class GenericItemSheet extends ItemSheet {
- _expanded = new Set();
+export class GenericDialog extends FormApplication {
#propogatedSettings = [
`devMode`,
- `showAvatarOnSheet`,
- `playersCanChangeGroup`,
- `resourcesOrSupplies`,
];
- activateListeners(html) {
- super.activateListeners(html);
-
- if (!this.isEditable) return;
- console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`);
- };
-
async getData() {
const ctx = {};
@@ -30,7 +19,6 @@ export class GenericItemSheet extends ItemSheet {
ctx.meta = {
expanded: this._expanded,
- idp: this.item.uuid,
};
ctx.config = DOTDUNGEON;
@@ -38,4 +26,24 @@ export class GenericItemSheet extends ItemSheet {
return ctx;
};
-};
\ No newline at end of file
+
+ activateListeners(html) {
+ super.activateListeners(html);
+
+ if (!this.isEditable) return;
+ console.debug(`.dungeon | Generic dialog adding listeners`);
+
+ html.find(`[data-action]`)
+ .on(`click`, this._handleActionClick.bind(this));
+ };
+
+ _handleActionClick($e) {
+ const data = $e.currentTarget.dataset;
+ if (!this[data.action]) return;
+ this[data.action].bind(this)($e);
+ };
+
+ closeNoSave() {
+ this.close({ submit: false, });
+ };
+};
diff --git a/module/dialogs/diceSelect.js b/module/dialogs/diceSelect.js
deleted file mode 100644
index e218c3a..0000000
--- a/module/dialogs/diceSelect.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const diceOptions = [
- `d4`,
- `d6`,
- `d8`,
- `d10`,
- `d12`,
- `d20`
-]
-
-export default Dialog({
- title: `Die Selector`,
- content: `
Select a Dice
`,
- buttons: {
- d4: {
- label: "d4",
- callback() {
- console.log(`Selected a d4`)
- }
- },
- d6: {
- label: "d6",
- callback() {
- console.log(`Selected a d6`)
- }
- }
- }
-})
\ No newline at end of file
diff --git a/module/documents/ActiveEffect/GenericActiveEffect.mjs b/module/documents/ActiveEffect/GenericActiveEffect.mjs
new file mode 100644
index 0000000..8ee70f3
--- /dev/null
+++ b/module/documents/ActiveEffect/GenericActiveEffect.mjs
@@ -0,0 +1,7 @@
+export class DotDungeonActiveEffect extends ActiveEffect {
+
+ // Invert the logic of the disabled property so it's easier to modify via
+ // embedded controls
+ get enabled() { return !this.disabled };
+ set enabled(newValue) { this.disabled = !newValue };
+};
diff --git a/module/documents/ActiveEffect/_proxy.mjs b/module/documents/ActiveEffect/_proxy.mjs
new file mode 100644
index 0000000..4b51b54
--- /dev/null
+++ b/module/documents/ActiveEffect/_proxy.mjs
@@ -0,0 +1,42 @@
+import { DotDungeonActiveEffect } from "./GenericActiveEffect.mjs";
+
+const classes = {};
+
+const defaultClass = DotDungeonActiveEffect;
+
+export const ActiveEffectProxy = new Proxy(function () {}, {
+ construct(target, args) {
+ const [data] = args;
+
+ if (!classes.hasOwnProperty(data.type)) {
+ return new defaultClass(...args);
+ }
+
+ return new classes[data.type](...args);
+ },
+ get(target, prop, receiver) {
+
+ if (["create", "createDocuments"].includes(prop)) {
+ return function (data, options) {
+ if (data.constructor === Array) {
+ return data.map(i => ActiveEffectProxy.create(i, options))
+ }
+
+ if (!classes.hasOwnProperty(data.type)) {
+ return defaultClass.create(data, options);
+ }
+
+ return classes[data.type].create(data, options);
+ };
+ };
+
+ if (prop == Symbol.hasInstance) {
+ return function (instance) {
+ if (instance instanceof defaultClass) return true;
+ return Object.values(classes).some(i => instance instanceof i);
+ };
+ };
+
+ return defaultClass[prop];
+ },
+});
diff --git a/module/documents/Actor/GenericActor.mjs b/module/documents/Actor/GenericActor.mjs
new file mode 100644
index 0000000..171af63
--- /dev/null
+++ b/module/documents/Actor/GenericActor.mjs
@@ -0,0 +1,49 @@
+export class DotDungeonActor extends Actor {
+
+ /*
+ Using this to take a "snapshot" of the system data prior to applying AE's so
+ that the inputs can still have the non-modified value in them, while we still
+ provide all that data to AE's without needing to disable any inputs.
+ */
+ prepareEmbeddedDocuments() {
+ this.preAE = foundry.utils.deepClone(this.system);
+ super.prepareEmbeddedDocuments();
+ };
+
+ async createEmbeddedItem(defaults, opts = {}) {
+ let items = await this.createEmbeddedDocuments(`Item`, defaults);
+ if (!Array.isArray(items)) items = items ? [items] : [];
+ if (items.length == 0) {
+ throw new Error(`Failed to create any items`);
+ };
+ this.sheet.render();
+ if (
+ game.settings.get(`dotdungeon`, `openEmbeddedOnCreate`)
+ && !opts.overrideSheetOpen
+ ) {
+ for (const item of items) {
+ item.sheet.render(true);
+ };
+ };
+ };
+
+ async preItemEmbed(item) {
+
+ // Increases the quantity of already present items if they match via source
+ let embedded = this.itemTypes[item.type].find(i => {
+ return i.getFlag(`core`, `sourceId`) === `Item.${item.id}`
+ });
+ if (embedded) {
+ await embedded.update({"system.quantity": embedded.system.quantity + 1});
+ ui.notifications.info(
+ game.i18n.format(
+ `dotdungeon.notification.info.increased-item-quantity`,
+ { name: embedded.name, quantity: embedded.system.quantity }
+ ),
+ { console: false }
+ );
+ return false;
+ };
+ return true;
+ };
+};
diff --git a/module/documents/Actor/Handler.mjs b/module/documents/Actor/Handler.mjs
deleted file mode 100644
index 342521a..0000000
--- a/module/documents/Actor/Handler.mjs
+++ /dev/null
@@ -1,92 +0,0 @@
-import PlayerActor from "./Player.mjs";
-import MobActor from "./Mob.mjs";
-
-/** @extends {Actor} */
-export class ActorHandler extends Actor {
- proxyTargets = {
- player: PlayerActor,
- mob: MobActor,
- };
-
- constructor(data, ctx) {
- super(data, ctx);
- };
-
- /** @type {class|undefined} */
- get fn() {
- return this.proxyTargets[this.type];
- };
-
- async proxyFunction(funcName, ...args) {
- if (!this.fn?.[funcName]) return;
- return await this.fn?.[funcName].bind(this)(...args);
- };
-
- async openEmbeddedSheet($event) {
- if (this.fn?.openEmbeddedSheet) {
- this.fn.openEmbeddedSheet.bind(this)($event);
- } else {
- const data = $event.target.dataset;
- let item = await fromUuid(data.embeddedEdit);
- item?.sheet.render(true);
- };
- };
-
- async genericEmbeddedUpdate($event) {
- if (this.fn?.genericEmbeddedUpdate) {
- return this.fn.genericEmbeddedUpdate.bind(this)($event);
- };
- const target = $event.delegateTarget;
- const data = target.dataset;
- const item = await fromUuid(data.embeddedId);
-
- let value = target.value;
- switch (target.type) {
- case "checkbox": value = target.checked; break;
- };
-
- await item?.update({ [data.embeddedUpdate]: value });
- };
-
- async genericEmbeddedDelete($event) {
- if (!this.fn?.genericEmbeddedDelete) return;
- this.fn.genericEmbeddedDelete.bind(this)($event);
- };
-
- async genericEmbeddedCreate($event) {
- const data = $event.currentTarget.dataset;
- if (!this.fn?.[`createCustom${data.embeddedCreate}`]) return;
- this.fn?.[`createCustom${data.embeddedCreate}`].bind(this)($event);
- };
-
- async genericSendToChat($event) {
- const data = $event.currentTarget.dataset;
- const type = data.messageType;
- console.log(data)
- if (this.fn?.[`send${type}ToChat`]) {
- return await this.fn?.[`send${type}ToChat`].bind(this)($event);
- };
- if (!data.messageContent) {
- console.warn(`.dungeon | Tried to send a chat message with no content`);
- return;
- };
- let message = await ChatMessage.create({
- content: data.messageContent,
- flavor: data.messageFlavor,
- speaker: { actor: this.actor }
- });
- message.render();
- };
-
- /**
- * @param {ItemHandler} item
- * @returns {boolean} true to allow the document to be embedded
- */
- async preItemEmbed(item) {
- let type = item.type[0].toUpperCase() + item.type.slice(1);
- if (this.fn?.[`pre${type}Embed`]) {
- return await this.fn?.[`pre${type}Embed`].bind(this)(item);
- };
- return true;
- };
-};
diff --git a/module/documents/Actor/Mob.mjs b/module/documents/Actor/Mob.mjs
index 7c645e4..cca7e96 100644
--- a/module/documents/Actor/Mob.mjs
+++ b/module/documents/Actor/Mob.mjs
@@ -1 +1,10 @@
-export default {};
\ No newline at end of file
+import { DotDungeonActor } from "./GenericActor.mjs";
+
+export class Mob extends DotDungeonActor {
+ getRollData() {
+ const data = {
+ initiative: this.system.initiative ?? 0,
+ };
+ return data;
+ };
+};
diff --git a/module/documents/Actor/Player.mjs b/module/documents/Actor/Player.mjs
index a1282c9..2c5840d 100644
--- a/module/documents/Actor/Player.mjs
+++ b/module/documents/Actor/Player.mjs
@@ -1,116 +1,51 @@
-import { ItemHandler } from "../Item/Handler.mjs";
+import { DotDungeonActor } from "./GenericActor.mjs";
-/** @this {Actor} */
-async function genericEmbeddedDelete($event) {
- let data = $event.currentTarget.dataset;
- let item = await fromUuid(data.embeddedId);
+export class Player extends DotDungeonActor {
- if (!item) {
- ui.notifications.error(
- `dotdungeon.notification.error.item-not-found`,
- { console: false }
+ applyActiveEffects() {
+ super.applyActiveEffects();
+
+ /*
+ These are the (groups of) fields that ActiveEffects may modify safely and
+ remain editable in the sheet. This needs to be done because of default
+ Foundry behaviour that otherwise prevents these fields from being edited.
+ The deletes must use optional chaining otherwise they can cause issues
+ during the document preparation lifecycle as an actor with no AE's affecting
+ anything in one of these areas will result in these paths being undefined.
+ */
+ delete this.overrides.system?.stats;
+ delete this.overrides.system?.skills;
+ };
+
+ async createCustomPet() {
+ const body = new URLSearchParams({
+ number: 1,
+ animal: `Cat`,
+ "X-Requested-With": "fetch"
+ });
+ const r = await fetch(
+ `https://randommer.io/pet-names`,
+ {
+ method: "POST",
+ body
+ }
);
- return;
+ await this.createEmbeddedItem([{
+ type: `pet`,
+ name: (await r.json())[0] ?? game.i18n.localize(`dotdungeon.defaults.pet.name`),
+ }]);
};
- Dialog.confirm({
- title: game.i18n.format(
- `dotdungeon.dialogs.${item.type}.delete.title`,
- item
- ),
- content: game.i18n.format(
- `dotdungeon.dialogs.${item.type}.delete.content`,
- item
- ),
- yes: () => {
- item.delete();
- },
- defaultYes: false,
- });
-};
-
-/** @this {Actor} */
-async function createCustomItem(defaults, opts = {}) {
- let items = await this.createEmbeddedDocuments(`Item`, defaults);
- if (items.length == 0) {
- throw new Error();
+ get atAspectLimit() {
+ let limit = game.settings.get(`dotdungeon`, `aspectLimit`);
+ return this.itemTypes.aspect.length >= limit;
};
- this.sheet.render();
- if (
- game.settings.get(`dotdungeon`, `openEmbeddedOnCreate`)
- && !opts.overrideSheetOpen
- ) {
- for (const item of items) {
- item.sheet.render(true);
+
+ getRollData() {
+ const data = {
+ initiative: this.system.stats.hands ?? 0,
+ stats: this.system.stats,
};
+ return data;
};
};
-
-/** @this {Actor} */
-async function createCustomAspect() {
- await createCustomItem.bind(this)([{
- type: `aspect`,
- name: game.i18n.format(`dotdungeon.defaults.aspect.name`),
- }]);
-};
-
-/** @this {Actor} */
-async function createCustomSpell() {
- await createCustomItem.bind(this)([{
- type: `spell`,
- name: game.i18n.format(`dotdungeon.defaults.spell.name`),
- }]);
-};
-
-/** @this {Actor} */
-async function createCustomPet() {
- const body = new URLSearchParams({
- number: 1,
- animal: `Cat`,
- "X-Requested-With": "fetch"
- })
- const r = await fetch(
- `https://randommer.io/pet-names`,
- {
- method: "POST",
- body
- }
- );
- await createCustomItem.bind(this)([{
- type: `pet`,
- name: (await r.json())[0] ?? game.i18n.localize(`dotdungeon.defaults.pet.name`),
- }]);
-};
-
-/** @this {Actor} */
-async function atAspectLimit() {
- let limit = game.settings.get(`dotdungeon`, `aspectLimit`);
- return this.itemTypes.aspect.length >= limit;
-};
-
-/**
- * @param {ItemHandler} item
- * @this {Actor}
- */
-async function preAspectEmbed(item) {
- if (await atAspectLimit.bind(this)()) {
- ui.notifications.error(
- game.i18n.format(
- `dotdungeon.notification.error.aspect-limit-reached`,
- { limit: game.settings.get(`dotdungeon`, `aspectLimit`) }
- ),
- { console: false }
- );
- return false;
- };
-};
-
-export default {
- atAspectLimit,
- createCustomItem,
- createCustomAspect,
- createCustomSpell,
- createCustomPet,
- genericEmbeddedDelete,
- preAspectEmbed,
-};
\ No newline at end of file
diff --git a/module/documents/Actor/Sync.mjs b/module/documents/Actor/Sync.mjs
new file mode 100644
index 0000000..171a67c
--- /dev/null
+++ b/module/documents/Actor/Sync.mjs
@@ -0,0 +1,56 @@
+import { DotDungeonActor } from "./GenericActor.mjs";
+import { syncMilestones } from "../../config.mjs";
+
+export class Sync extends DotDungeonActor {
+ async useRestDie() {
+ let addToSync = await (new Roll(syncDice)).evaluate();
+ await addToSync.toMessage({
+ speaker: ChatMessage.getSpeaker({ actor: this.actor }),
+ flavor: `Sync Restoration`,
+ });
+ this.update({
+ "system.rest_dice": this.system.rest_dice - 1,
+ "system.value": this.system.value + addToSync.total,
+ });
+ };
+
+ async _preUpdate(data, options) {
+ if (options.diff) {
+ if (data.system?.value != null) {
+ let currentSync = this.system.value;
+ let newSync = data.system.value;
+
+ let minSync = Math.min(currentSync, newSync);
+ let maxSync = Math.max(currentSync, newSync);
+ let milestones = syncMilestones.filter(
+ m => minSync < m.value && m.value <= maxSync
+ );
+
+ if (milestones.length > 0) data.system.rest_dice ??= this.system.rest_dice;
+
+ for (const milestone of milestones) {
+ // Damage
+ if (newSync < currentSync) {
+ if (!this.system.milestones_hit.has(milestone.value)) {
+ data.system.rest_dice += 1;
+ this.system.milestones_hit.add(milestone.value);
+ };
+ }
+
+ // Healing
+ else if (newSync > currentSync) {
+ if (
+ this.system.milestones_hit.has(milestone.value)
+ && milestone.andReturn
+ && milestone.value <= newSync
+ ) {
+ this.system.milestones_hit.delete(milestone.value);
+ };
+ };
+ };
+
+ data.system.milestones_hit = [ ...this.system.milestones_hit ];
+ };
+ };
+ };
+};
diff --git a/module/documents/Actor/_proxy.mjs b/module/documents/Actor/_proxy.mjs
new file mode 100644
index 0000000..dd6cf6c
--- /dev/null
+++ b/module/documents/Actor/_proxy.mjs
@@ -0,0 +1,49 @@
+import { DotDungeonActor } from "./GenericActor.mjs";
+import { Player } from "./Player.mjs";
+import { Sync } from "./Sync.mjs";
+import { Mob } from "./Mob.mjs";
+
+const classes = {
+ player: Player,
+ mob: Mob,
+ sync: Sync,
+};
+
+const defaultClass = DotDungeonActor;
+
+export const ActorProxy = new Proxy(function () {}, {
+ construct(target, args) {
+ const [data] = args;
+
+ if (!classes.hasOwnProperty(data.type)) {
+ return new defaultClass(...args);
+ }
+
+ return new classes[data.type](...args);
+ },
+ get(target, prop, receiver) {
+
+ if (["create", "createDocuments"].includes(prop)) {
+ return function (data, options) {
+ if (data.constructor === Array) {
+ return data.map(i => ActorProxy.create(i, options))
+ }
+
+ if (!classes.hasOwnProperty(data.type)) {
+ return defaultClass.create(data, options);
+ }
+
+ return classes[data.type].create(data, options);
+ };
+ };
+
+ if (prop == Symbol.hasInstance) {
+ return function (instance) {
+ if (instance instanceof defaultClass) return true;
+ return Object.values(classes).some(i => instance instanceof i);
+ };
+ };
+
+ return defaultClass[prop];
+ },
+});
diff --git a/module/documents/Item/Aspect.mjs b/module/documents/Item/Aspect.mjs
index 733e252..ea66b6c 100644
--- a/module/documents/Item/Aspect.mjs
+++ b/module/documents/Item/Aspect.mjs
@@ -1,10 +1,42 @@
-/** @this {ItemHandler} */
-async function _preCreate(_data, _options, _user) {
- if (this.isEmbedded) {
- return await this.actor?.preItemEmbed(this);
+import { DotDungeonItem } from "./GenericItem.mjs";
+
+const secondsInAMinute = 60;
+const secondsInAnHour = 60 * secondsInAMinute;
+
+export class Aspect extends DotDungeonItem {
+ async _preCreate() {
+ if (this.isEmbedded) {
+ if (this.actor.atAspectLimit) {
+ ui.notifications.error(
+ game.i18n.format(
+ `dotdungeon.notification.error.aspect-limit-reached`,
+ { limit: game.settings.get(`dotdungeon`, `aspectLimit`) }
+ ),
+ { console: false }
+ );
+ return false;
+ };
+
+ return await this.actor?.preItemEmbed(this);
+ };
+ };
+
+ get friendlyDuration() {
+ let friendly = ``;
+ let duration = this.system.deactivateAfter;
+ if (duration >= secondsInAnHour) {
+ let hours = Math.floor(duration / secondsInAnHour);
+ friendly += `${hours}h`;
+ duration -= hours * secondsInAnHour;
+ };
+ if (duration >= secondsInAMinute) {
+ let minutes = Math.floor(duration / secondsInAMinute);
+ friendly += `${minutes}m`;
+ duration -= minutes * secondsInAMinute;
+ };
+ if (duration > 0) {
+ friendly += `${duration}s`;
+ };
+ return friendly;
};
};
-
-export default {
- _preCreate,
-};
\ No newline at end of file
diff --git a/module/documents/Item/GenericItem.mjs b/module/documents/Item/GenericItem.mjs
new file mode 100644
index 0000000..786824e
--- /dev/null
+++ b/module/documents/Item/GenericItem.mjs
@@ -0,0 +1,24 @@
+export class DotDungeonItem extends Item {
+ async _preCreate() {
+ if (this.isEmbedded) {
+ return await this.actor?.preItemEmbed(this);
+ };
+ };
+
+ get usedCapacity() {
+ if (!this.system.uses_inventory_slot) return 0;
+ if (!this.system.quantity_affects_used_capacity) {
+ return 1;
+ };
+ return this.system.quantity;
+ };
+
+ get availableLocations() {
+ return [
+ { value: null, label: `dotdungeon.location.unknown` },
+ { value: `inventory`, label: `dotdungeon.location.inventory` },
+ { value: `equipped`, label: `dotdungeon.location.equipped` },
+ { value: `storage`, label: `dotdungeon.location.storage` },
+ ];
+ };
+};
diff --git a/module/documents/Item/Handler.mjs b/module/documents/Item/Handler.mjs
deleted file mode 100644
index c072abd..0000000
--- a/module/documents/Item/Handler.mjs
+++ /dev/null
@@ -1,34 +0,0 @@
-import AspectItem from "./Aspect.mjs";
-import SpellItem from "./Spell.mjs";
-
-/** @extends {Item} */
-export class ItemHandler extends Item {
- proxyTargets = {
- aspect: AspectItem,
- spell: SpellItem,
- };
-
- constructor(data, ctx) {
- super(data, ctx);
- };
-
- /** @type {class|undefined} */
- get fn() {
- return this.proxyTargets[this.type];
- };
-
- async migrateSystemData() {
- if (!this.fn?.migrateSystemData) return;
- this.fn?.migrateSystemData.bind(this)();
- };
-
- async proxyFunction(funcName, ...args) {
- if (!this.fn?.[funcName]) return;
- return await this.fn?.[funcName].bind(this)(...args);
- };
-
- async _preCreate(...args) {
- if (!this.fn?._preCreate) return;
- return this.fn?._preCreate.bind(this)(...args);
- };
-};
diff --git a/module/documents/Item/Material.mjs b/module/documents/Item/Material.mjs
new file mode 100644
index 0000000..c6c5b72
--- /dev/null
+++ b/module/documents/Item/Material.mjs
@@ -0,0 +1,15 @@
+import { DotDungeonItem } from "./GenericItem.mjs";
+
+export class Material extends DotDungeonItem {
+ get usedCapacity() {
+ let affects = game.settings.get(`dotdungeon`, `materialsAffectCapacity`);
+ return affects ? super.usedCapacity : 0;
+ };
+
+ get availableLocations() {
+ return [
+ { value: null, label: `dotdungeon.location.unknown` },
+ { value: `inventory`, label: `dotdungeon.location.inventory` },
+ ];
+ };
+};
diff --git a/module/documents/Item/Spell.mjs b/module/documents/Item/Spell.mjs
deleted file mode 100644
index ea7da45..0000000
--- a/module/documents/Item/Spell.mjs
+++ /dev/null
@@ -1,10 +0,0 @@
-import { ItemHandler } from "./Handler.mjs";
-
-/** @this {ItemHandler} */
-async function migrateSystemData() {
- this.system
-};
-
-export default {
- migrateSystemData,
-};
diff --git a/module/documents/Item/_proxy.mjs b/module/documents/Item/_proxy.mjs
new file mode 100644
index 0000000..b579136
--- /dev/null
+++ b/module/documents/Item/_proxy.mjs
@@ -0,0 +1,47 @@
+import { DotDungeonItem } from "./GenericItem.mjs";
+import { Aspect } from "./Aspect.mjs";
+import { Material } from "./Material.mjs";
+
+const classes = {
+ aspect: Aspect,
+ material: Material,
+};
+
+const defaultClass = DotDungeonItem;
+
+export const ItemProxy = new Proxy(function () {}, {
+ construct(target, args) {
+ const [data] = args;
+
+ if (!classes.hasOwnProperty(data.type)) {
+ return new defaultClass(...args);
+ }
+
+ return new classes[data.type](...args);
+ },
+ get(target, prop, receiver) {
+
+ if (["create", "createDocuments"].includes(prop)) {
+ return function (data, options) {
+ if (data.constructor === Array) {
+ return data.map(i => ItemProxy.create(i, options))
+ }
+
+ if (!classes.hasOwnProperty(data.type)) {
+ return defaultClass.create(data, options);
+ }
+
+ return classes[data.type].create(data, options);
+ };
+ };
+
+ if (prop == Symbol.hasInstance) {
+ return function (instance) {
+ if (instance instanceof defaultClass) return true;
+ return Object.values(classes).some(i => instance instanceof i);
+ };
+ };
+
+ return defaultClass[prop];
+ },
+});
diff --git a/module/dotdungeon.mjs b/module/dotdungeon.mjs
index 4784205..8731314 100644
--- a/module/dotdungeon.mjs
+++ b/module/dotdungeon.mjs
@@ -1,4 +1,7 @@
// Data Models
+import { DescribedItemData } from "./models/Item/DescribedItemData.mjs";
+import { CommonItemData } from "./models/Item/CommonItemData.mjs";
+import { WeaponItemData } from "./models/Item/Weapon.mjs";
import { AspectItemData } from "./models/Item/Aspect.mjs";
import { SpellItemData } from "./models/Item/Spell.mjs";
import { PlayerData } from "./models/Actor/Player.mjs";
@@ -7,16 +10,21 @@ import { SyncData } from "./models/Actor/Sync.mjs";
import { MobData } from "./models/Actor/Mob.mjs";
// Main Documents
-import { ActorHandler } from "./documents/Actor/Handler.mjs";
-import { ItemHandler } from "./documents/Item/Handler.mjs";
+import { ActiveEffectProxy } from "./documents/ActiveEffect/_proxy.mjs";
+import { ActorProxy } from "./documents/Actor/_proxy.mjs";
+import { ItemProxy } from "./documents/Item/_proxy.mjs";
-// Character Sheets
-import { SpellSheet } from "./sheets/SpellSheet.mjs";
-import { AspectSheet } from "./sheets/AspectSheet.mjs";
-import { PlayerSheet } from "./sheets/PlayerSheet.mjs";
+// Item Sheets
+import { UntypedItemSheet } from "./sheets/Items/UntypedItemSheet.mjs";
+import { AspectSheet } from "./sheets/Items/AspectSheet.mjs";
+import { SpellSheet } from "./sheets/Items/SpellSheet.mjs";
+import { PetSheet } from "./sheets/Items/PetSheet.mjs";
+
+// Actor Sheets
import { BasicSyncSheet } from "./sheets/SyncVariations/BasicSyncSheet.mjs";
+import { PlayerSheetv2 } from "./sheets/Actors/PC/PlayerSheetV2.mjs";
+import { MVPPCSheet } from "./sheets/MVPPCSheet.mjs";
import { MobSheet } from "./sheets/MobSheet.mjs";
-import { PetSheet } from "./sheets/PetSheet.mjs";
// Utility imports
import * as hbs from "./handlebars.mjs";
@@ -25,31 +33,44 @@ import * as hbs from "./handlebars.mjs";
import "./hooks/hotReload.mjs";
// Misc Imports
+import { registerCustomComponents } from "./components/index.mjs";
import loadSettings from "./settings/index.mjs";
+import { devInit } from "./hooks/devInit.mjs";
import DOTDUNGEON from "./config.mjs";
Hooks.once(`init`, async () => {
console.debug(`.dungeon | Initializing`);
+ CONFIG.ActiveEffect.legacyTransferral = false;
loadSettings();
CONFIG.Actor.dataModels.player = PlayerData;
CONFIG.Actor.dataModels.sync = SyncData;
CONFIG.Actor.dataModels.mob = MobData;
+ CONFIG.Item.dataModels.untyped = DescribedItemData;
+ CONFIG.Item.dataModels.material = CommonItemData;
+ CONFIG.Item.dataModels.foil = DescribedItemData;
+ CONFIG.Item.dataModels.weapon = WeaponItemData;
CONFIG.Item.dataModels.aspect = AspectItemData;
CONFIG.Item.dataModels.spell = SpellItemData;
CONFIG.Item.dataModels.pet = PetItemData;
- CONFIG.Actor.documentClass = ActorHandler;
- CONFIG.Item.documentClass = ItemHandler;
+ CONFIG.Actor.documentClass = ActorProxy;
+ CONFIG.Item.documentClass = ItemProxy;
+ CONFIG.ActiveEffect.documentClass = ActiveEffectProxy;
CONFIG.DOTDUNGEON = DOTDUNGEON;
- // Actors.unregisterSheet("core", ActorSheet);
- Actors.registerSheet("dotdungeon", PlayerSheet, {
+
+ Actors.registerSheet("dotdungeon", MVPPCSheet, {
makeDefault: true,
types: ["player"],
- label: "dotdungeon.sheet-names.PlayerSheet"
+ label: "dotdungeon.sheet-names.PlayerSheet.MVP"
+ });
+ Actors.registerSheet("dotdungeon", PlayerSheetv2, {
+ makeDefault: false,
+ types: ["player"],
+ label: "dotdungeon.sheet-names.PlayerSheet.v2"
});
Actors.registerSheet("dotdungeon", MobSheet, {
makeDefault: true,
@@ -62,6 +83,13 @@ Hooks.once(`init`, async () => {
label: "dotdungeon.sheet-names.SyncSheet.basic"
});
+ Items.registerSheet("dotdungeon", UntypedItemSheet, {
+ makeDefault: true,
+ label: "dotdungeon.sheet-names.UntypedItemSheet",
+ });
+ Items.unregisterSheet("dotdungeon", UntypedItemSheet, {
+ types: ["aspect"],
+ });
Items.registerSheet("dotdungeon", AspectSheet, {
makeDefault: true,
types: ["aspect"],
@@ -75,15 +103,16 @@ Hooks.once(`init`, async () => {
Items.registerSheet("dotdungeon", PetSheet, {
makeDefault: true,
types: ["pet"],
- lable: "dotdungeon.sheet-names.PetSheet"
+ label: "dotdungeon.sheet-names.PetSheet"
});
+ if (true || game.settings.get(`dotdungeon`, `devMode`)) {
+ devInit();
+ };
hbs.registerHandlebarsHelpers();
hbs.preloadHandlebarsTemplates();
-
- CONFIG.CACHE = {};
- CONFIG.CACHE.icons = await hbs.preloadIcons();
+ registerCustomComponents();
});
@@ -93,10 +122,10 @@ Hooks.once(`ready`, () => {
let defaultTab = game.settings.get(`dotdungeon`, `defaultTab`);
if (defaultTab) {
if (!ui.sidebar?.tabs?.[defaultTab]) {
- console.error(`Couldn't find a sidebar tab with ID:`, defaultTab);
+ console.error(`.dungeon | Couldn't find a sidebar tab with ID:`, defaultTab);
} else {
- console.debug(`Switching sidebar tab to:`, defaultTab);
+ console.debug(`.dungeon | Switching sidebar tab to:`, defaultTab);
ui.sidebar.tabs[defaultTab].activate();
};
};
-});
\ No newline at end of file
+});
diff --git a/module/handlebars.mjs b/module/handlebars.mjs
index 32eec11..cdaa1b7 100644
--- a/module/handlebars.mjs
+++ b/module/handlebars.mjs
@@ -7,7 +7,7 @@ export const partials = [
`partials/panel.hbs`,
`items/aspect.hbs`,
- // All of the partials for the PC sheet panels
+ // All of the partials for the PC MVP sheet panels
`actors/char-sheet-mvp/panels/aspect.pc.hbs`,
`actors/char-sheet-mvp/panels/backpack.pc.hbs`,
`actors/char-sheet-mvp/panels/mounts.pc.hbs`,
@@ -18,27 +18,32 @@ export const partials = [
`actors/char-sheet-mvp/panels/pets.pc.hbs`,
`actors/char-sheet-mvp/panels/sync.pc.hbs`,
`actors/char-sheet-mvp/panels/weapons.pc.hbs`,
+
+ // The v2 PC sheet partials
+ `actors/char-sheet/v2/partials/stats.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/effects.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/inventory.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/item-list.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/storage.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs`,
+ `actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs`,
+
+ // The v2 Untyped sheet partials
+ `items/untyped/v2/tabs/general.v2.untyped.hbs`,
+ `items/untyped/v2/tabs/details.v2.untyped.hbs`,
+ `items/untyped/v2/tabs/effects.v2.untyped.hbs`,
+ `items/untyped/v2/tabs/settings.v2.untyped.hbs`,
];
-export const icons = [
- `caret-right.svg`,
- `garbage-bin.svg`,
- `chat-bubble.svg`,
- `dice/d4.svg`,
- `dice/d6.svg`,
- `dice/d8.svg`,
- `dice/d10.svg`,
- `dice/d12.svg`,
- `dice/d20.svg`,
- `create.svg`,
- `close.svg`,
- `edit.svg`,
- `sheet.svg`,
-];
-
+export const preAliasedPartials = {
+ "dotdungeon.pc.v2.foil": "actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs",
+};
export async function registerHandlebarsHelpers() {
- console.log(Handlebars)
Handlebars.registerHelper(helpers);
};
@@ -48,6 +53,10 @@ export async function preloadHandlebarsTemplates() {
const paths = {};
+ for (const alias in preAliasedPartials) {
+ paths[alias] = `${pathPrefix}${preAliasedPartials[alias]}`;
+ };
+
for ( const partial of partials ) {
console.debug(`Loading partial: ${partial}`);
const path = `${pathPrefix}${partial}`;
@@ -69,38 +78,3 @@ export async function preloadHandlebarsTemplates() {
console.groupEnd();
return loadTemplates(paths);
};
-
-/**
- * Loads all of the icons that are needed in the handlebars templating to make
- * the sheet look nicer.
- *
- * @returns An object containing icon names to the corresponding HTML data for
- * displaying the icon
- */
-export async function preloadIcons() {
- const pathPrefix = `systems/dotdungeon/assets/`
- const parsedIcons = {};
-
- for (const icon of icons) {
- const iconName = icon.split(`/`).slice(-1)[0].slice(0, -4);
- if (icon.endsWith(`.svg`)) {
- try {
- const response = await fetchWithTimeout(`${pathPrefix}${icon}`);
- if (response.status !== 200) { continue };
- const svgData = await response.text();
- parsedIcons[iconName] = svgData;
- } catch {
- console.error(`.dungeon | Failed to fetch/parse icon: ${icon}`);
- continue;
- };
- }
- else if (icon.endsWith(`.png`)) {
- parsedIcons[iconName] = ``;
- }
- else {
- console.warn(`.dungeon | Icon "${icon}" failed to be handled by a loader`)
- };
- };
-
- return parsedIcons;
-};
\ No newline at end of file
diff --git a/module/helpers/createArray.mjs b/module/helpers/createArray.mjs
index 6fb6500..d92c6b7 100644
--- a/module/helpers/createArray.mjs
+++ b/module/helpers/createArray.mjs
@@ -1,3 +1,3 @@
export function createArray(...args) {
return args.slice(0, -1);
-};
\ No newline at end of file
+};
diff --git a/module/helpers/detailsExpanded.mjs b/module/helpers/detailsExpanded.mjs
index 0a277aa..6094849 100644
--- a/module/helpers/detailsExpanded.mjs
+++ b/module/helpers/detailsExpanded.mjs
@@ -11,4 +11,4 @@ export function detailsExpanded(expanded, collapseId) {
return `open`;
}
return ``;
-};
\ No newline at end of file
+};
diff --git a/module/helpers/index.mjs b/module/helpers/index.mjs
index 6489fb4..b48baa3 100644
--- a/module/helpers/index.mjs
+++ b/module/helpers/index.mjs
@@ -2,20 +2,24 @@ import { schemaOptions } from "./schemaOptions.mjs";
import { createArray } from "./createArray.mjs";
import { detailsExpanded } from "./detailsExpanded.mjs";
import { objectValue } from "./objectValue.mjs";
-import { toFriendlyDuration } from "./toFriendlyDuration.mjs";
+import { handlebarsLocalizer, localizer } from "../utils/localizer.mjs";
+import { options } from "./options.mjs";
export default {
// Complex helpers
"dd-schemaOptions": schemaOptions,
"dd-array": createArray,
- "dd-toFriendlyDuration": toFriendlyDuration,
"dd-objectValue": objectValue,
"dd-expanded": detailsExpanded,
+ "dd-i18n": handlebarsLocalizer,
+ "dd-options": options,
// Simple helpers
"dd-stringify": v => JSON.stringify(v, null, ` `),
"dd-empty": v => v.length == 0,
+ "dd-set-has": (s, k) => s.has(k),
+ "dd-empty-state": (v) => v ?? localizer(`dotdungeon.common.empty`),
// Logic helpers
"eq": (a, b) => a == b,
@@ -28,4 +32,4 @@ export default {
"xor": (a, b) => (a || b) && !(a && b),
"xnor": (a, b) => !((a || b) && !(a && b)),
"defined": v => v != null,
-};
\ No newline at end of file
+};
diff --git a/module/helpers/objectValue.mjs b/module/helpers/objectValue.mjs
index be22aed..43f3913 100644
--- a/module/helpers/objectValue.mjs
+++ b/module/helpers/objectValue.mjs
@@ -8,4 +8,4 @@ export function objectValue(obj, keypath) {
};
let resp = helper(obj, keypath.string.split(`.`));
return resp;
-};
\ No newline at end of file
+};
diff --git a/module/helpers/options.mjs b/module/helpers/options.mjs
new file mode 100644
index 0000000..97a2d62
--- /dev/null
+++ b/module/helpers/options.mjs
@@ -0,0 +1,35 @@
+import { localizer } from "../utils/localizer.mjs";
+
+/**
+ * @typedef {object} Option
+ * @property {string} [label]
+ * @property {string|number} value
+ * @property {boolean} [disabled]
+ */
+
+/**
+ * @param {string | number} selected
+ * @param {Array`
+ );
+ };
+ return htmlOptions.join(`\n`);
+};
diff --git a/module/helpers/schemaOptions.mjs b/module/helpers/schemaOptions.mjs
index 24f3b78..32ca167 100644
--- a/module/helpers/schemaOptions.mjs
+++ b/module/helpers/schemaOptions.mjs
@@ -7,4 +7,4 @@ export function schemaOptions(document, schemaPath) {
}
return CONFIG.Actor.dataModels.player.schema.fields.weapon.fields.mainHand.fields.damage.options.options;
-};
\ No newline at end of file
+};
diff --git a/module/helpers/toFriendlyDuration.mjs b/module/helpers/toFriendlyDuration.mjs
deleted file mode 100644
index 9a2ad30..0000000
--- a/module/helpers/toFriendlyDuration.mjs
+++ /dev/null
@@ -1,26 +0,0 @@
-const secondsInAMinute = 60;
-const secondsInAnHour = 60 * secondsInAMinute;
-
-
-/**
- * Converts a duration into a more human-friendly format
- * @param {number} duration The length of time in seconds
- * @returns The human-friendly time string
- */
-export function toFriendlyDuration(duration) {
- let friendly = ``;
- if (duration >= secondsInAnHour) {
- let hours = Math.floor(duration / secondsInAnHour);
- friendly += `${hours}h`;
- duration -= hours * secondsInAnHour;
- };
- if (duration >= secondsInAMinute) {
- let minutes = Math.floor(duration / secondsInAMinute);
- friendly += `${minutes}m`;
- duration -= minutes * secondsInAMinute;
- };
- if (duration > 0) {
- friendly += `${duration}s`;
- };
- return friendly;
-};
\ No newline at end of file
diff --git a/module/hooks/devInit.mjs b/module/hooks/devInit.mjs
new file mode 100644
index 0000000..b7ef326
--- /dev/null
+++ b/module/hooks/devInit.mjs
@@ -0,0 +1,27 @@
+/*
+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 { GroupDataSheet } from "../sheets/Datasheets/GroupDataSheet.mjs";
+import { UntypedDataSheet } from "../sheets/Datasheets/UntypedDataSheet.mjs";
+
+export function devInit() {
+ Items.registerSheet(
+ `dotdungeon`,
+ UntypedDataSheet,
+ {
+ types: [`untyped`, `foil`],
+ label: `dotdungeon.sheet-names.*DataSheet`,
+ }
+ );
+
+ Actors.registerSheet(
+ `dotdungeon`,
+ GroupDataSheet,
+ {
+ types: [`sync`],
+ label: `dotdungeon.sheet-names.*DataSheet`,
+ }
+ );
+};
diff --git a/module/hooks/hotReload.mjs b/module/hooks/hotReload.mjs
index c2370ee..8c44a46 100644
--- a/module/hooks/hotReload.mjs
+++ b/module/hooks/hotReload.mjs
@@ -3,8 +3,8 @@ import * as hbs from "../handlebars.mjs";
const loaders = {
svg(data) {
const iconName = data.path.split(`/`).slice(-1)[0].slice(0, -4);
- console.log(`.dungeon | hot-reloading icon: ${iconName}`);
- CONFIG.CACHE.icons[iconName] = data.content;
+ console.debug(`.dungeon | hot-reloading icon: ${iconName}`);
+ Hooks.call(`dd-hmr:svg`, iconName, data);
},
hbs(data) {
if (!hbs.partials.some(p => data.path.endsWith(p))) {
@@ -33,9 +33,15 @@ const loaders = {
return false;
},
+ js() {window.location.reload()},
+ mjs() {window.location.reload()},
+ css(data) {
+ console.debug(`.dungeon | Hot-reloading CSS: ${data.path}`);
+ Hooks.call(`dd-hmr:css`, data);
+ },
};
Hooks.on(`hotReload`, async (data) => {
if (!loaders[data.extension]) return;
return loaders[data.extension](data);
-});
\ No newline at end of file
+});
diff --git a/module/models/Actor/Mob.mjs b/module/models/Actor/Mob.mjs
index e56c572..57d6e40 100644
--- a/module/models/Actor/Mob.mjs
+++ b/module/models/Actor/Mob.mjs
@@ -2,9 +2,6 @@ export class MobData extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
- dice: new fields.StringField({
- initial: ``,
- }),
bonus: new fields.NumberField({
initial: 0,
nullable: false,
@@ -25,6 +22,36 @@ export class MobData extends foundry.abstract.TypeDataModel {
initial: ``,
blank: true,
}),
+ immune: new fields.StringField({
+ initial: ``,
+ blank: true,
+ }),
+ weak: new fields.StringField({
+ initial: ``,
+ blank: true,
+ }),
+ bytes: new fields.NumberField({
+ initial: 0,
+ min: 0,
+ }),
+ description: new fields.StringField({
+ initial: ``,
+ blank: true,
+ }),
+ dice: new fields.ArrayField(
+ new fields.SchemaField({
+ // {count}d{sides} x {repeat}
+ count: new fields.NumberField({ min: 1 }),
+ sides: new fields.NumberField({ min: 2 }),
+ repeat: new fields.NumberField({ min: 1 }),
+ }),
+ { initial: [] }
+ ),
};
};
+
+ // Called during create, read, and update
+ static migrateData(source) {
+ return source;
+ };
};
diff --git a/module/models/Actor/Player.mjs b/module/models/Actor/Player.mjs
index 7baeb04..244c887 100644
--- a/module/models/Actor/Player.mjs
+++ b/module/models/Actor/Player.mjs
@@ -1,4 +1,4 @@
-import { MappingField } from "../fields/MappingField.mjs";
+import DOTDUNGEON from "../../config.mjs";
function diceChoiceField() {
return new foundry.data.fields.StringField({
@@ -6,33 +6,17 @@ function diceChoiceField() {
blank: true,
trim: true,
options() {
- return CONFIG.DOTDUNGEON.statDice;
+ return DOTDUNGEON.statDice;
},
});
};
function trainingLevelField() {
- return new foundry.data.fields.StringField({
- initial: ``,
- blank: true,
- trim: true,
- options: CONFIG.DOTDUNGEON.trainingLevels,
- });
-};
-
-function weaponDamageTypeField() {
- return new foundry.data.fields.StringField({
- initial: ``,
- blank: true,
- options: [ ``, ...CONFIG.DOTDUNGEON.damageTypes ],
- });
-};
-
-function ammoTypeField() {
- return new foundry.data.fields.StringField({
- initial: ``,
- blank: true,
- options: [ ``, ...CONFIG.DOTDUNGEON.ammoTypes ],
+ return new foundry.data.fields.NumberField({
+ initial: 0,
+ min: -1,
+ integer: true,
+ options: Object.values(DOTDUNGEON.trainingLevels),
});
};
@@ -40,6 +24,14 @@ export class PlayerData extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
+ /*
+ These are special data properties that will be used by ActiveEffects
+ to modify certain limits within the actor, allowing for neat hacks
+ that change these
+ */
+ weapon_slots: new fields.NumberField({ initial: 2 }),
+ inventory_slots: new fields.NumberField({ initial: 0 }),
+
bytes: new fields.NumberField({
initial: 0,
min: 0,
@@ -83,67 +75,18 @@ export class PlayerData extends foundry.abstract.TypeDataModel {
piloting: trainingLevelField(),
})
}),
- aspect: new fields.SchemaField({
- name: new fields.StringField({ blank: true, trim: true }),
- description: new fields.StringField({ blank: true, trim: true }),
- deactivateAfter: new fields.NumberField({ min: 0, integer: true}),
- used: new fields.BooleanField(),
- }),
+ // ! Delete
roles: new fields.SchemaField({
r1: new fields.StringField({ blank: true, trim: true }),
r2: new fields.StringField({ blank: true, trim: true }),
r3: new fields.StringField({ blank: true, trim: true }),
r4: new fields.StringField({ blank: true, trim: true }),
}),
- weapon: new fields.SchemaField({
- mainHand: new fields.SchemaField({
- name: new fields.StringField({ blank: true, trim: true }),
- damage: weaponDamageTypeField(),
- ranged: new fields.BooleanField({ initial: false }),
- scope: new fields.BooleanField({ initial: false }),
- ammo: ammoTypeField(),
- }),
- offHand: new fields.SchemaField({
- name: new fields.StringField({ blank: true, trim: true }),
- damage: weaponDamageTypeField(),
- ranged: new fields.BooleanField({ initial: false }),
- scope: new fields.BooleanField({ initial: false }),
- ammo: ammoTypeField(),
- }),
- ammo: new fields.SchemaField({
- quivers: new fields.NumberField({ min: 0, max: 10, integer: true }),
- mags: new fields.NumberField({ min: 0, max: 10, integer: true }),
- cells: new fields.NumberField({ min: 0, max: 10, integer: true }),
- }),
- }),
supplies: new fields.NumberField({
initial: 0,
min: 0,
- max: 5,
integer: true
}),
- materials: new fields.NumberField({
- initial: 0,
- min: 0,
- max: 5,
- integer: true
- }),
- pet: new fields.SchemaField({
- name: new fields.StringField(),
- info: new fields.StringField(),
- }),
- transport: new fields.SchemaField({
- name: new fields.StringField(),
- upkeep: new fields.NumberField({ min: 0, integer: true }),
- info: new fields.StringField(),
- }),
- spells: new MappingField(
- new fields.SchemaField({
- name: new fields.StringField({ initial: ``, blank: true, trim: true }),
- cost: new fields.NumberField({ initial: 0, min: 0 }),
- info: new fields.StringField({ initial: ``, blank: true, trim: true }),
- })
- ),
respawns: new fields.SchemaField({
r1: new fields.BooleanField(),
r2: new fields.BooleanField(),
@@ -154,7 +97,6 @@ export class PlayerData extends foundry.abstract.TypeDataModel {
integer: true,
initial: 0,
}),
- inventoryString: new fields.StringField({ blank: true, trim: true }),
};
};
-};
\ No newline at end of file
+};
diff --git a/module/models/Actor/Sync.mjs b/module/models/Actor/Sync.mjs
index 64bf260..9d8082e 100644
--- a/module/models/Actor/Sync.mjs
+++ b/module/models/Actor/Sync.mjs
@@ -3,10 +3,18 @@ export class SyncData extends foundry.abstract.TypeDataModel {
const fields = foundry.data.fields;
return {
value: new fields.NumberField({
- required: true,
integer: true,
initial: 100,
}),
+ rest_dice: new fields.NumberField({
+ integer: true,
+ initial: 0,
+ min: 0,
+ }),
+ milestones_hit: new fields.SetField(
+ new fields.NumberField({ integer: true, }),
+ { initial: [] },
+ ),
};
};
-};
\ No newline at end of file
+};
diff --git a/module/models/Item/Aspect.mjs b/module/models/Item/Aspect.mjs
index 23d1f04..92b3eac 100644
--- a/module/models/Item/Aspect.mjs
+++ b/module/models/Item/Aspect.mjs
@@ -1,11 +1,19 @@
-export class AspectItemData extends foundry.abstract.TypeDataModel {
+import { DescribedItemData } from "./DescribedItemData.mjs";
+
+export class AspectItemData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
- return {
+ const parentSchema = super.defineSchema();
+
+ // Purge fields that I don't want in this schema
+ delete parentSchema.quantity;
+ delete parentSchema.quantity_affects_used_capacity;
+ delete parentSchema.usage_cost;
+
+ return foundry.utils.mergeObject(parentSchema, {
used: new fields.BooleanField({ initial: false }),
/** The number of seconds that the effect of the aspect stays */
deactivateAfter: new fields.NumberField({ nullable: true }),
- info: new fields.HTMLField({ nullable: true, blank: false, trim: true }),
- };
+ });
};
-};
\ No newline at end of file
+};
diff --git a/module/models/Item/CommonItemData.mjs b/module/models/Item/CommonItemData.mjs
index a8ad598..9e11800 100644
--- a/module/models/Item/CommonItemData.mjs
+++ b/module/models/Item/CommonItemData.mjs
@@ -4,18 +4,46 @@ export class CommonItemData extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields;
return {
+ quantity: new fields.NumberField({
+ initial: 1,
+ min: 0,
+ nullable: false,
+ integer: true,
+ }),
+ uses_inventory_slot: new fields.BooleanField({
+ initial: true,
+ nullable: false,
+ }),
+ quantity_affects_used_capacity: new fields.BooleanField({
+ initial: true,
+ nullable: false,
+ }),
buy: new fields.NumberField({
initial: null,
nullable: true,
+ integer: true,
}),
usage_cost: new fields.NumberField({
initial: null,
nullable: true,
+ integer: true,
}),
tier: new fields.StringField({
- initial: `simple`,
+ initial: DOTDUNGEON.defaultItemTier,
+ nullable: false,
+ choices: DOTDUNGEON.itemTiers.map(tier => tier.value),
+ }),
+ /*
+ If this property is set to true, the item will be shown in the combat tab
+ list of items. This is shown whether or not the item is marked as "equipped".
+ */
+ combat_relevant: new fields.BooleanField({
+ initial: false,
+ nullable: false,
+ }),
+ location: new fields.StringField({
+ initial: "",
nullable: false,
- choices: DOTDUNGEON.itemTiers,
}),
};
};
diff --git a/module/models/Item/DescribedItemData.mjs b/module/models/Item/DescribedItemData.mjs
index ebfce48..eb913a0 100644
--- a/module/models/Item/DescribedItemData.mjs
+++ b/module/models/Item/DescribedItemData.mjs
@@ -3,7 +3,7 @@ import { CommonItemData } from "./CommonItemData.mjs";
export class DescribedItemData extends CommonItemData {
static defineSchema() {
const fields = foundry.data.fields;
- return mergeObject(super.defineSchema(), {
+ return foundry.utils.mergeObject(super.defineSchema(), {
description: new fields.StringField({
initial: ``,
blank: true,
diff --git a/module/models/Item/Equipment.mjs b/module/models/Item/Equipment.mjs
index 6e9d7f9..309fd3b 100644
--- a/module/models/Item/Equipment.mjs
+++ b/module/models/Item/Equipment.mjs
@@ -3,12 +3,6 @@ import { DescribedItemData } from "./DescribedItemData.mjs";
export class EquipmentItemData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
- return mergeObject(super.defineSchema(), {
- extra_inventory: new fields.NumberField({
- initial: null,
- nullable: true,
- required: false,
- }),
- });
+ return foundry.utils.mergeObject(super.defineSchema(), {});
};
};
diff --git a/module/models/Item/Pet.mjs b/module/models/Item/Pet.mjs
index 7d46e94..34c6de5 100644
--- a/module/models/Item/Pet.mjs
+++ b/module/models/Item/Pet.mjs
@@ -3,7 +3,13 @@ import { DescribedItemData } from "./DescribedItemData.mjs";
export class PetItemData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
- return mergeObject(super.defineSchema(), {
+ const parentSchema = super.defineSchema();
+
+ delete parentSchema.quantity;
+ delete parentSchema.quantity_affects_used_capacity;
+ delete parentSchema.usage_cost;
+
+ return foundry.utils.mergeObject(parentSchema, {
upkeep: new fields.NumberField({ initial: null, nullable: true }),
pokeballd: new fields.BooleanField({ initial: true }),
});
diff --git a/module/models/Item/Spell.mjs b/module/models/Item/Spell.mjs
index 00bab71..f96381f 100644
--- a/module/models/Item/Spell.mjs
+++ b/module/models/Item/Spell.mjs
@@ -4,7 +4,7 @@ import DOTDUNGEON from "../../config.mjs";
export class SpellItemData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
- return mergeObject(super.defineSchema(), {
+ return foundry.utils.mergeObject(super.defineSchema(), {
skill: new fields.StringField({
initial: ``,
blank: true,
@@ -18,4 +18,4 @@ export class SpellItemData extends DescribedItemData {
}),
});
};
-};
\ No newline at end of file
+};
diff --git a/module/models/Item/Transportation.mjs b/module/models/Item/Transportation.mjs
deleted file mode 100644
index fd1f427..0000000
--- a/module/models/Item/Transportation.mjs
+++ /dev/null
@@ -1,28 +0,0 @@
-import { DescribedItemData } from "./DescribedItemData.mjs";
-
-export class TransportationItemData extends DescribedItemData {
- static defineSchema() {
- const fields = foundry.data.fields;
- return mergeObject(super.defineSchema(), {
- single_trip: new fields.NumberField({
- initial: null,
- nullable: true,
- }),
- upkeep: new fields.NumberField({
- initial: null,
- nullable: true,
- }),
- can_be_in_inventory: new fields.BooleanField({
- initial: false,
- }),
- inventory_slots: new fields.NumberField({
- initial: 0,
- min: 0,
- }),
- logon_bonus: new fields.NumberField({
- initial: null,
- nullable: true,
- })
- });
- };
-};
diff --git a/module/models/Item/Weapon.mjs b/module/models/Item/Weapon.mjs
new file mode 100644
index 0000000..20db6b7
--- /dev/null
+++ b/module/models/Item/Weapon.mjs
@@ -0,0 +1,24 @@
+import { DescribedItemData } from "./DescribedItemData.mjs";
+import DOTDUNGEON from "../../config.mjs";
+
+export class WeaponItemData extends DescribedItemData {
+ static defineSchema() {
+ const fields = foundry.data.fields;
+ return foundry.utils.mergeObject(super.defineSchema(), {
+ damage: new fields.StringField({
+ initial: null,
+ nullable: true,
+ blank: true,
+ options: DOTDUNGEON.damageTypes,
+ }),
+ ranged: new fields.BooleanField({ initial: false, }),
+ scoped: new fields.BooleanField({ initial: false, }),
+ ammo: new fields.StringField({
+ initial: null,
+ nullable: true,
+ blank: true,
+ options: DOTDUNGEON.ammoTypes,
+ }),
+ });
+ };
+};
diff --git a/module/models/fields/MappingField.mjs b/module/models/fields/MappingField.mjs
index 9d62f66..3547be7 100644
--- a/module/models/fields/MappingField.mjs
+++ b/module/models/fields/MappingField.mjs
@@ -129,4 +129,4 @@ export class MappingField extends foundry.data.fields.ObjectField {
path.shift();
return this.model._getField(path);
}
-}
\ No newline at end of file
+};
diff --git a/module/models/template.mjs b/module/models/template.mjs
index f3cea2a..77340ee 100644
--- a/module/models/template.mjs
+++ b/module/models/template.mjs
@@ -3,7 +3,7 @@ import { DescribedItemData } from "./DescribedItemData.mjs";
export class TemplateData extends DescribedItemData {
static defineSchema() {
const fields = foundry.data.fields;
- return mergeObject(super.defineSchema(), {
+ return foundry.utils.mergeObject(super.defineSchema(), {
});
};
};
diff --git a/module/settings/client_settings.mjs b/module/settings/client_settings.mjs
index c3e568f..703c94a 100644
--- a/module/settings/client_settings.mjs
+++ b/module/settings/client_settings.mjs
@@ -18,4 +18,4 @@ export default function() {
default: true,
requiresReload: false,
});
-};
\ No newline at end of file
+};
diff --git a/module/settings/dev_settings.mjs b/module/settings/dev_settings.mjs
index 939afda..51c278c 100644
--- a/module/settings/dev_settings.mjs
+++ b/module/settings/dev_settings.mjs
@@ -13,4 +13,4 @@ export default function() {
config: false,
requiresReload: false,
});
-};
\ No newline at end of file
+};
diff --git a/module/settings/index.mjs b/module/settings/index.mjs
index 0a0b83f..5ad91cc 100644
--- a/module/settings/index.mjs
+++ b/module/settings/index.mjs
@@ -6,4 +6,4 @@ export default function registerSettings() {
registerClientSettings();
registerWorldSettings();
registerDevSettings();
-};
\ No newline at end of file
+};
diff --git a/module/settings/world_settings.mjs b/module/settings/world_settings.mjs
index 314ae3b..cac1757 100644
--- a/module/settings/world_settings.mjs
+++ b/module/settings/world_settings.mjs
@@ -9,6 +9,16 @@ export default function() {
requiresReload: false,
});
+ game.settings.register(`dotdungeon`, `materialsAffectCapacity`, {
+ name: `dotdungeon.settings.materialsAffectCapacity.name`,
+ hint: `dotdungeon.settings.materialsAffectCapacity.description`,
+ scope: `world`,
+ config: true,
+ type: Boolean,
+ default: true,
+ requiresReload: false,
+ });
+
game.settings.register(`dotdungeon`, `resourcesOrSupplies`, {
name: `dotdungeon.settings.resourcesOrSupplies.name`,
hint: `dotdungeon.settings.resourcesOrSupplies.description`,
@@ -59,4 +69,4 @@ export default function() {
game.settings.set(`dotdungeon`, `preSaveAspectLimit`, floored);
},
});
-};
\ No newline at end of file
+};
diff --git a/module/sheets/Actors/PC/PlayerSheetV2.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs
new file mode 100644
index 0000000..ac1a378
--- /dev/null
+++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs
@@ -0,0 +1,172 @@
+import { GenericActorSheet } from "../../GenericActorSheet.mjs";
+import DOTDUNGEON from "../../../config.mjs";
+import { localizer } from "../../../utils/localizer.mjs";
+import { modifierToString } from "../../../utils/modifierToString.mjs";
+import { GenericContextMenu } from "../../../utils/GenericContextMenu.mjs";
+
+export class PlayerSheetv2 extends GenericActorSheet {
+ static get defaultOptions() {
+ let opts = foundry.utils.mergeObject(
+ super.defaultOptions,
+ {
+ template: `systems/dotdungeon/templates/actors/char-sheet/v2/sheet.hbs`,
+ tabs: [
+ {
+ group: `page`,
+ navSelector: `nav.page`,
+ contentSelector: `.page-content`,
+ initial: `inventory`,
+ },
+ {
+ group: `inventory`,
+ navSelector: `nav.inventory`,
+ contentSelector: `.tab[data-tab="inventory"]`,
+ initial: `player`,
+ }
+ ],
+ }
+ );
+ opts.classes.push(`style-v3`);
+ return opts;
+ };
+
+ activateListeners(html) {
+ super.activateListeners(html);
+
+ if (this.document.isEmbedded) return;
+ if (!this.isEditable) return;
+ console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`);
+
+ html.find(`.create-ae`).on(`click`, async ($e) => {
+ console.debug(`Creating an ActiveEffect?`);
+ const ae = this.actor.createEmbeddedDocuments(`ActiveEffect`, [{name: "Default AE"}]);
+ ae.sheet.render(true);
+ });
+ html.find(`[data-filter-toggle]`).on(`change`, ($e) => {
+ const target = $e.delegateTarget;
+ const filter = target.dataset.filterToggle;
+ this.toggleItemFilter(filter);
+ this._renderInner();
+ });
+
+ // Make materials be able to be edited/deleted
+ new GenericContextMenu(html, `.material`, [
+ {
+ name: localizer(`dotdungeon.common.edit`),
+ callback: (html) => {
+ const data = html[0].dataset;
+ this.openEmbeddedSheet.bind(this)(data.embeddedId);
+ },
+ },
+ {
+ name: localizer(`dotdungeon.common.delete`),
+ callback: (html) => {
+ const data = html[0].dataset;
+ this.genericEmbeddedDelete.bind(this)(data.embeddedId);
+ },
+ },
+ ]);
+ };
+
+ async getData() {
+ const ctx = await super.getData();
+ /** @type {ActorHandler} */
+ const actor = this.actor;
+
+ ctx.preAE = actor.preAE;
+ ctx.system = actor.system;
+ ctx.flags = actor.flags;
+ ctx.items = this.actor.itemTypes;
+
+ ctx.computed = {
+ canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM,
+ canAddAspect: !this.actor.atAspectLimit,
+ stats: this.#statData,
+ itemFilters: this.#itemFilters,
+ noItemTypesVisible: this._itemTypesHidden.size === DOTDUNGEON.itemFilters.length,
+ capacity: this.#inventoryCapacity,
+ };
+ console.log(ctx)
+ return ctx;
+ };
+
+ get #statData() {
+ const stats = [];
+ const usedDice = new Set(Object.values(this.actor.system.stats));
+ for (const statName in this.actor.system.stats) {
+ const stat = {
+ key: statName,
+ name: localizer(`dotdungeon.stat.${statName}`),
+ original: this.actor.preAE.stats[statName],
+ value: this.actor.system.stats[statName],
+ };
+
+ /*
+ Determine what dice are available to the user in the dropdown
+ selector. Disables all dice options that are selected, but not used
+ by this stat.
+ */
+ stat.dieOptions = [
+ { label: `---`, value: `` },
+ ...DOTDUNGEON.statDice.map(die => {
+ return {
+ value: die,
+ label: localizer(`dotdungeon.die.${die}`, { stat: statName }),
+ disabled: usedDice.has(die) && this.actor.preAE.stats[statName] !== die,
+ };
+ })
+ ];
+
+ /*
+ Calculating the data needed in order to display all of the skills
+ for this character.
+ */
+ stat.skills = [];
+ for (const skill in this.actor.system.skills[statName]) {
+ const value = this.actor.system.skills[statName][skill];
+ stat.skills.push({
+ key: skill,
+ name: game.i18n.format(`dotdungeon.skills.${skill}`),
+ value,
+ original: this.actor.preAE.skills[statName][skill],
+ formula: `1` + stat.value + modifierToString(value, { spaces: true }),
+ rollDisabled: this.actor.preAE.skills[statName][skill] === -1,
+ });
+ };
+
+ stats.push(stat);
+ };
+ return stats;
+ };
+
+ _itemTypesHidden = new Set([`armour`, `equipment`, `structure`, `service`]);
+ toggleItemFilter(filterName) {
+ if (this._itemTypesHidden.has(filterName)) {
+ this._itemTypesHidden.delete(filterName);
+ } else {
+ this._itemTypesHidden.add(filterName);
+ };
+ this.render();
+ };
+
+ get #itemFilters() {
+ const types = DOTDUNGEON.itemFilters;
+ const filters = {};
+ for (const type of types) {
+ filters[type] = {
+ label: localizer(`TYPES.Item.${type}`),
+ active: !this._itemTypesHidden.has(type),
+ createLabel: localizer(`dotdungeon.sheet.actor.v2.create-item`, {type}),
+ };
+ };
+ return filters;
+ };
+
+ get #inventoryCapacity() {
+ return {
+ used: this.actor.items
+ .reduce((sum, i) => sum + i.usedCapacity, 0),
+ max: this.actor.system.inventory_slots,
+ };
+ };
+}
diff --git a/module/sheets/Datasheets/GroupDataSheet.mjs b/module/sheets/Datasheets/GroupDataSheet.mjs
new file mode 100644
index 0000000..6c9527a
--- /dev/null
+++ b/module/sheets/Datasheets/GroupDataSheet.mjs
@@ -0,0 +1,31 @@
+export class GroupDataSheet extends ActorSheet {
+ static get defaultOptions() {
+ let opts = foundry.utils.mergeObject(
+ super.defaultOptions,
+ {
+ template: `systems/dotdungeon/templates/datasheets/actor/group.hbs`,
+ width: 200,
+ height: 275
+ },
+ );
+ opts.classes.push(`dotdungeon`, `style-v3`);
+ return opts;
+ };
+
+ async getData() {
+ const ctx = {};
+
+ ctx.actor = this.actor;
+ ctx.system = this.actor.system;
+
+ ctx.computed = {
+ milestones_hit_viewable: [...this.actor.system.milestones_hit.values()].join(`, `)
+ }
+
+ ctx.meta = {
+ idp: this.actor.uuid,
+ };
+
+ return ctx;
+ };
+};
diff --git a/module/sheets/Datasheets/UntypedDataSheet.mjs b/module/sheets/Datasheets/UntypedDataSheet.mjs
new file mode 100644
index 0000000..c3d7702
--- /dev/null
+++ b/module/sheets/Datasheets/UntypedDataSheet.mjs
@@ -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;
+ };
+};
diff --git a/module/sheets/GenericActorSheet.mjs b/module/sheets/GenericActorSheet.mjs
index 80818d7..2010304 100644
--- a/module/sheets/GenericActorSheet.mjs
+++ b/module/sheets/GenericActorSheet.mjs
@@ -1,6 +1,18 @@
+import { localizer } from "../utils/localizer.mjs";
import DOTDUNGEON from "../config.mjs";
export class GenericActorSheet extends ActorSheet {
+ static get defaultOptions() {
+ let opts = foundry.utils.mergeObject(
+ super.defaultOptions,
+ {
+ scrollY: [`.scrollable`],
+ }
+ );
+ opts.classes.push(`dotdungeon`);
+ return opts;
+ };
+
_expanded = new Set();
#propogatedSettings = [
@@ -28,7 +40,7 @@ export class GenericActorSheet extends ActorSheet {
ctx.actor = this.actor;
ctx.config = DOTDUNGEON;
- ctx.icons = CONFIG.CACHE.icons;
+ ctx.icons = {};
return ctx;
};
@@ -40,26 +52,49 @@ export class GenericActorSheet extends ActorSheet {
if (!this.isEditable) return;
console.debug(`.dungeon | Generic sheet adding listeners`);
- html.find(`summary`).on(`click`, this._handleSummaryToggle.bind(this));
- html.find(`.roll`).on(`click`, this._handleRoll.bind(this));
- html.find(`[data-embedded-update]`)
- .on(`change`, this.actor.genericEmbeddedUpdate.bind(this.actor));
+ /*
+ Custom element event listeners because Foundry doesn't listen to them by
+ default.
+ */
+ html.find(
+ CONFIG.CACHE.componentListeners.map(n => `${n}[name]`).join(`,`)
+ ).on(`change`, () => this._onChangeInput.bind(this));
+
+ /*
+ Utility event listeners that apply
+ */
+ html.find(`[data-collapse-id]`).on(`click`, this._handleSummaryToggle.bind(this));
+ html.find(`[data-roll-formula]`).on(`click`, this._handleRoll.bind(this));
+ html.find(`[data-embedded-update-on="change"]`)
+ .on(`change`, this.genericEmbeddedUpdate.bind(this));
+ html.find(`[data-embedded-update-on="blur"]`)
+ .on(`blur`, this.genericEmbeddedUpdate.bind(this));
html.find(`[data-embedded-delete]`)
- .on(`click`, this.actor.genericEmbeddedDelete.bind(this.actor));
+ .on(`click`, ($e) => {
+ const id = $e.currentTarget.dataset.embeddedDelete;
+ this.genericEmbeddedDelete.bind(this)(id);
+ });
html.find(`[data-embedded-create]`)
- .on(`click`, this.actor.genericEmbeddedCreate.bind(this.actor));
+ .on(`click`, this.genericEmbeddedCreate.bind(this));
html.find(`[data-message-type]`)
- .on(`click`, this.actor.genericSendToChat.bind(this.actor));
+ .on(`click`, this.genericSendToChat.bind(this));
html.find(`[data-embedded-edit]`)
- .on(`click`, this.actor.openEmbeddedSheet.bind(this.actor));
+ .on(`click`, ($e) => {
+ const id = $e.currentTarget.dataset.embeddedEdit;
+ this.openEmbeddedSheet.bind(this)(id);
+ })
+ html.find(`button[data-increment]`)
+ .on(`click`, this._incrementValue.bind(this));
+ html.find(`button[data-decrement]`)
+ .on(`click`, this._decrementValue.bind(this));
+ html.find(`button[data-embedded-increment]`)
+ .on(`click`, this.genericEmbeddedIncrement.bind(this));
+ html.find(`button[data-embedded-decrement]`)
+ .on(`click`, this.genericEmbeddedDecrement.bind(this));
};
async _handleRoll($e) {
let data = $e.currentTarget.dataset;
- if (!data.rollFormula) {
- console.warn(`.dungeon | Element has .roll class with no roll formula`, $e.target);
- return;
- };
console.debug(`.dungeon | Attempting to roll with formula "${data.rollFormula}"`);
let flavor;
@@ -75,21 +110,139 @@ export class GenericActorSheet extends ActorSheet {
});
};
- _handleSummaryToggle($e) {
- let data = $e.currentTarget.dataset;
- let open = $e.currentTarget.parentNode.open;
- console.debug(`.dungeon | Collapse ID: ${data.collapseId} (open: ${open})`);
+ async _incrementValue($e) {
+ const target = $e.currentTarget;
+ const data = target.dataset;
+ const value = getProperty(this.actor, data.increment);
+ if (typeof value != "number") {
+ return;
+ };
+ this.actor.update({ [data.increment]: value + 1 });
+ };
- /*
- This seeming inversion of logic is due to the fact that this handler
- gets called before the element is updated to include/reflect the
- change, so if the parentNode doesn't actually have it, then we're
- opening it and vice-versa.
- */
- if (!open) {
+ async _decrementValue($e) {
+ const target = $e.currentTarget;
+ const data = target.dataset;
+ const value = getProperty(this.actor, data.decrement);
+ if (typeof value != "number") {
+ return;
+ };
+ this.actor.update({ [data.decrement]: value - 1 });
+ };
+
+ async _handleSummaryToggle($e) {
+ $e.stopPropagation();
+ let target = $e.currentTarget;
+ let parent = target.closest(`.collapse`);
+ let data = target.dataset;
+ console.debug(`.dungeon | Collapse ID: ${data.collapseId}`);
+
+ if (!this._expanded.has(data.collapseId)) {
this._expanded.add(data.collapseId);
+ parent.setAttribute(`open`, ``);
} else {
this._expanded.delete(data.collapseId);
+ parent.removeAttribute(`open`, ``);
};
};
-};
\ No newline at end of file
+
+ async openEmbeddedSheet(item_id) {
+ let item = await fromUuid(item_id);
+ item?.sheet.render(true);
+ };
+
+ async genericEmbeddedCreate($event) {
+ const data = $event.currentTarget.dataset;
+ if (!this[`createCustom${data.embeddedCreate}`]) {
+ this.actor.createEmbeddedItem({
+ type: data.embeddedCreate,
+ name: localizer(
+ `dotdungeon.default.name`,
+ { document: `Item`, type: data.embeddedCreate }
+ ),
+ });
+ } else {
+ this[`createCustom${data.embeddedCreate}`]($event);
+ };
+ };
+
+ async genericEmbeddedUpdate($event) {
+ const target = $event.currentTarget;
+ const data = target.dataset;
+ const item = await fromUuid(data.embeddedId);
+
+ let value = target.value;
+ switch (target.type) {
+ case "checkbox": value = target.checked; break;
+ };
+
+ await item?.update({ [data.embeddedUpdate]: value });
+ };
+
+ async genericEmbeddedIncrement($event) {
+ const target = $event.currentTarget;
+ const data = target.dataset;
+ const item = await fromUuid(data.embeddedId);
+ const value = getProperty(item, data.embeddedIncrement);
+ if (typeof value != "number") {
+ return;
+ };
+ await item?.update({ [data.embeddedIncrement]: value + 1 });
+ };
+
+ async genericEmbeddedDecrement($event) {
+ const target = $event.currentTarget;
+ const data = target.dataset;
+ const item = await fromUuid(data.embeddedId);
+ const value = getProperty(item, data.embeddedDecrement);
+ if (typeof value != "number") {
+ return;
+ };
+ await item?.update({ [data.embeddedDecrement]: value - 1 });
+ };
+
+ async genericEmbeddedDelete(item_uuid) {
+ let item = await fromUuid(item_uuid);
+
+ if (!item) {
+ ui.notifications.error(
+ `dotdungeon.notification.error.item-not-found`,
+ { console: false }
+ );
+ return;
+ };
+
+ Dialog.confirm({
+ title: game.i18n.format(
+ `dotdungeon.dialogs.${item.type}.delete.title`,
+ item
+ ),
+ content: game.i18n.format(
+ `dotdungeon.dialogs.${item.type}.delete.content`,
+ item
+ ),
+ yes: () => {
+ item.delete();
+ },
+ defaultYes: false,
+ });
+ };
+
+ async genericSendToChat($event) {
+ const data = $event.currentTarget.dataset;
+ const type = data.messageType;
+ if (this[`send${type}ToChat`]) {
+ return await this[`send${type}ToChat`]($event);
+ };
+ if (!data.messageContent) {
+ console.warn(`.dungeon | Tried to send a chat message with no content`);
+ return;
+ };
+ let message = await ChatMessage.create({
+ content: data.messageContent,
+ flavor: data.messageFlavor,
+ speaker: { actor: this.actor },
+ });
+ message.render();
+ };
+};
diff --git a/module/sheets/AspectSheet.mjs b/module/sheets/Items/AspectSheet.mjs
similarity index 74%
rename from module/sheets/AspectSheet.mjs
rename to module/sheets/Items/AspectSheet.mjs
index 976fa4d..2bf8638 100644
--- a/module/sheets/AspectSheet.mjs
+++ b/module/sheets/Items/AspectSheet.mjs
@@ -2,7 +2,7 @@ import { GenericItemSheet } from "./GenericItemSheet.mjs";
export class AspectSheet extends GenericItemSheet {
static get defaultOptions() {
- let opts = mergeObject(
+ let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
template: `systems/dotdungeon/templates/items/aspect.hbs`,
@@ -22,14 +22,7 @@ export class AspectSheet extends GenericItemSheet {
};
async getData() {
- const ctx = {};
- const item = this.item;
-
- ctx.item = item;
- ctx.system = item.system;
- ctx.flags = item.flags;
-
- console.log(item.uuid, `context:`, ctx);
+ const ctx = await super.getData();
return ctx;
};
-};
\ No newline at end of file
+};
diff --git a/module/sheets/Items/GenericItemSheet.mjs b/module/sheets/Items/GenericItemSheet.mjs
new file mode 100644
index 0000000..936bd6c
--- /dev/null
+++ b/module/sheets/Items/GenericItemSheet.mjs
@@ -0,0 +1,86 @@
+import { DialogManager } from "../../utils/DialogManager.mjs";
+import DOTDUNGEON from "../../config.mjs";
+
+export class GenericItemSheet extends ItemSheet {
+ _expanded = new Set();
+
+ #propogatedSettings = [
+ `devMode`,
+ `showAvatarOnSheet`,
+ `playersCanChangeGroup`,
+ `resourcesOrSupplies`,
+ ];
+
+ async getData() {
+ const ctx = {};
+
+ // Send all of the settings that sheets need into their context
+ ctx.settings = {};
+ for (const setting of this.#propogatedSettings) {
+ ctx.settings[setting] = game.settings.get(`dotdungeon`, setting);
+ };
+
+ ctx.isGM = game.users.current.hasRole(CONST.USER_ROLES.ASSISTANT);
+
+ ctx.meta = {
+ expanded: this._expanded,
+ idp: this.item.uuid,
+ };
+
+ ctx.item = this.item;
+ ctx.system = this.item.system;
+ ctx.flags = this.item.flags;
+ ctx.effects = this.item.effects;
+
+ ctx.config = DOTDUNGEON;
+ ctx.icons = {};
+
+ return ctx;
+ };
+
+ activateListeners(html) {
+ super.activateListeners(html);
+
+ if (!this.isEditable) return;
+ console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`);
+ html.find(`button[data-increment]`)
+ .on(`click`, this._incrementValue.bind(this));
+ html.find(`button[data-decrement]`)
+ .on(`click`, this._decrementValue.bind(this));
+
+
+ html.find(`[data-help-id]`)
+ .on(`click`, this._helpPopup.bind(this));
+ };
+
+ async _incrementValue($e) {
+ const target = $e.currentTarget;
+ const data = target.dataset;
+ const value = getProperty(this.actor, data.increment);
+ if (typeof value != "number") {
+ return;
+ };
+ this.actor.update({ [data.increment]: value + 1 });
+ };
+
+ async _decrementValue($e) {
+ const target = $e.currentTarget;
+ const data = target.dataset;
+ const value = getProperty(this.actor, data.decrement);
+ if (typeof value != "number") {
+ return;
+ };
+ this.actor.update({ [data.decrement]: value - 1 });
+ };
+
+ async _helpPopup($e) {
+ const target = $e.currentTarget;
+ const data = target.dataset;
+ if (!data.helpId) return;
+ DialogManager.helpDialog(
+ data.helpId,
+ data.helpContent,
+ data.helpTitle
+ );
+ };
+};
diff --git a/module/sheets/PetSheet.mjs b/module/sheets/Items/PetSheet.mjs
similarity index 83%
rename from module/sheets/PetSheet.mjs
rename to module/sheets/Items/PetSheet.mjs
index f3955af..a2db3b9 100644
--- a/module/sheets/PetSheet.mjs
+++ b/module/sheets/Items/PetSheet.mjs
@@ -2,7 +2,7 @@ import { GenericItemSheet } from "./GenericItemSheet.mjs";
export class PetSheet extends GenericItemSheet {
static get defaultOptions() {
- let opts = mergeObject(
+ let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
template: `systems/dotdungeon/templates/items/pet.hbs`,
@@ -23,10 +23,6 @@ export class PetSheet extends GenericItemSheet {
async getData() {
const ctx = await super.getData();
-
- ctx.item = this.item;
- ctx.system = this.item.system;
- ctx.flags = this.item.flags;
return ctx;
};
};
diff --git a/module/sheets/SpellSheet.mjs b/module/sheets/Items/SpellSheet.mjs
similarity index 83%
rename from module/sheets/SpellSheet.mjs
rename to module/sheets/Items/SpellSheet.mjs
index 281408a..8e92831 100644
--- a/module/sheets/SpellSheet.mjs
+++ b/module/sheets/Items/SpellSheet.mjs
@@ -2,7 +2,7 @@ import { GenericItemSheet } from "./GenericItemSheet.mjs";
export class SpellSheet extends GenericItemSheet {
static get defaultOptions() {
- let opts = mergeObject(
+ let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
template: `systems/dotdungeon/templates/items/spell.hbs`,
@@ -23,10 +23,6 @@ export class SpellSheet extends GenericItemSheet {
async getData() {
const ctx = await super.getData();
-
- ctx.item = this.item;
- ctx.system = this.item.system;
- ctx.flags = this.item.flags;
return ctx;
};
};
diff --git a/module/sheets/Items/UntypedItemSheet.mjs b/module/sheets/Items/UntypedItemSheet.mjs
new file mode 100644
index 0000000..5ae0f24
--- /dev/null
+++ b/module/sheets/Items/UntypedItemSheet.mjs
@@ -0,0 +1,116 @@
+import { GenericContextMenu } from "../../utils/GenericContextMenu.mjs";
+import { DialogManager } from "../../utils/DialogManager.mjs";
+import { GenericItemSheet } from "./GenericItemSheet.mjs";
+import { localizer } from "../../utils/localizer.mjs";
+
+export class UntypedItemSheet extends GenericItemSheet {
+ static get defaultOptions() {
+ let opts = foundry.utils.mergeObject(
+ super.defaultOptions,
+ {
+ template: `systems/dotdungeon/templates/items/untyped/v2/index.hbs`,
+ width: 300,
+ height: 340,
+ tabs: [
+ {
+ group: `page`,
+ navSelector: `nav.page`,
+ contentSelector: `.page-content`,
+ initial: `general`,
+ },
+ ],
+ }
+ );
+ opts.classes.push(`dotdungeon`, `style-v3`);
+ return opts;
+ };
+
+ activateListeners(html) {
+ super.activateListeners(html);
+
+ new GenericContextMenu(html, `.photo.panel`, [
+ {
+ name: localizer(`dotdungeon.common.view-larger`),
+ callback: () => {
+ (new ImagePopout(this.item.img)).render(true);
+ },
+ },
+ {
+ name: localizer(`dotdungeon.common.edit`),
+ condition: () => this.isEditable,
+ callback: () => {
+ const fp = new FilePicker({
+ callback: (path) => {
+ this.item.update({"img": path});
+ },
+ });
+ fp.render(true);
+ },
+ },
+ {
+ name: localizer(`dotdungeon.common.reset`),
+ condition: () => this.isEditable,
+ callback: () => {
+ console.log(`.dungeon | Reset Item Image`)
+ },
+ }
+ ]);
+
+ if (!this.isEditable) return;
+ console.debug(`.dungeon | Adding event listeners for Untyped Item: ${this.item.id}`);
+
+ html.find(`.create-ae`).on(`click`, async () => {
+ await this.item.createEmbeddedDocuments(
+ `ActiveEffect`,
+ [{name: localizer(`dotdungeon.default.name`, { document: `ActiveEffect`, type: `base` })}],
+ { renderSheet: true }
+ );
+ });
+
+ new GenericContextMenu(html, `.effect.panel`, [
+ {
+ name: localizer(`dotdungeon.common.edit`),
+ callback: async (html) => {
+ (await fromUuid(html.closest(`.effect`)[0].dataset.embeddedId))?.sheet.render(true);
+ },
+ },
+ {
+ name: localizer(`dotdungeon.common.delete`),
+ callback: async (html) => {
+ const target = html.closest(`.effect`)[0];
+ const data = target.dataset;
+ const id = data.embeddedId;
+ const doc = await fromUuid(id);
+ DialogManager.createOrFocus(
+ `${doc.uuid}-delete`,
+ {
+ title: localizer(`dotdungeon.delete.ActiveEffect.title`, doc),
+ content: localizer(`dotdungeon.delete.ActiveEffect.content`, doc),
+ buttons: {
+ yes: {
+ label: localizer(`Yes`),
+ callback() {
+ doc.delete();
+ },
+ },
+ no: {
+ label: localizer(`No`),
+ }
+ }
+ }
+ );
+ },
+ }
+ ]);
+ };
+
+ async getData() {
+ const ctx = await super.getData();
+
+ ctx.meta.showSettingsTab = ctx.isGM || this.item.isOwned;
+ ctx.meta.isEmbedded = this.item.isOwned;
+ ctx.meta.isEditable = this.isEditable;
+
+ return ctx;
+ };
+};
diff --git a/module/sheets/PlayerSheet.mjs b/module/sheets/MVPPCSheet.mjs
similarity index 76%
rename from module/sheets/PlayerSheet.mjs
rename to module/sheets/MVPPCSheet.mjs
index bf15fba..a5f05f5 100644
--- a/module/sheets/PlayerSheet.mjs
+++ b/module/sheets/MVPPCSheet.mjs
@@ -1,12 +1,11 @@
-import { ActorHandler } from "../documents/Actor/Handler.mjs";
import { GenericActorSheet } from "./GenericActorSheet.mjs";
-export class PlayerSheet extends GenericActorSheet {
+export class MVPPCSheet extends GenericActorSheet {
/** @override {ActorHandler} actor */
static get defaultOptions() {
- let opts = mergeObject(
+ let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
template: `systems/dotdungeon/templates/actors/char-sheet-mvp/sheet.hbs`
@@ -35,10 +34,9 @@ export class PlayerSheet extends GenericActorSheet {
ctx.computed = {
canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM,
- canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`),
+ canAddAspect: !this.actor.atAspectLimit,
};
- console.log(actor.uuid, `context:`, ctx)
return ctx;
};
-};
\ No newline at end of file
+};
diff --git a/module/sheets/MobSheet.mjs b/module/sheets/MobSheet.mjs
index 2b359df..b2f2213 100644
--- a/module/sheets/MobSheet.mjs
+++ b/module/sheets/MobSheet.mjs
@@ -1,14 +1,14 @@
-import { ActorHandler } from "../documents/Actor/Handler.mjs";
import { GenericActorSheet } from "./GenericActorSheet.mjs";
+import { DiceList } from "../dialogs/DiceList.mjs";
export class MobSheet extends GenericActorSheet {
static get defaultOptions() {
- let opts = mergeObject(
+ let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
template: `systems/dotdungeon/templates/actors/mobs/main.hbs`,
- width: 300,
- height: 360,
+ width: 750,
+ height: 390,
}
);
opts.classes.push(`dotdungeon`);
@@ -21,6 +21,12 @@ export class MobSheet extends GenericActorSheet {
if (this.document.isEmbedded) return;
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Mob: ${this.id}`);
+
+ html.find(`.edit-dice`)
+ .on(`click`, async () => {
+ let d = new DiceList(this.actor);
+ d.render(true);
+ });
};
async getData() {
@@ -34,7 +40,8 @@ export class MobSheet extends GenericActorSheet {
ctx.computed = {};
- console.log(actor.uuid, `context:`, ctx)
+ // Compute rolls here
+
return ctx;
};
-};
\ No newline at end of file
+};
diff --git a/module/sheets/SyncVariations/AbstractSyncSheet.mjs b/module/sheets/SyncVariations/AbstractSyncSheet.mjs
index 7af1899..80e372b 100644
--- a/module/sheets/SyncVariations/AbstractSyncSheet.mjs
+++ b/module/sheets/SyncVariations/AbstractSyncSheet.mjs
@@ -2,11 +2,11 @@ import { GenericActorSheet } from "../GenericActorSheet.mjs";
export class AbstractSyncSheet extends GenericActorSheet {
static get defaultOptions() {
- let opts = mergeObject(
+ let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
width: 200,
- height: 200,
+ height: 275,
}
);
opts.classes.push(
@@ -22,11 +22,12 @@ export class AbstractSyncSheet extends GenericActorSheet {
ctx.system = actor.system;
ctx.flags = actor.flags;
-
- console.groupCollapsed(`SyncSheet.getData`);
- console.log(`ctx`, ctx);
- console.log(`actor`, actor);
- console.groupEnd();
return ctx;
};
-};
\ No newline at end of file
+
+ activateListeners(html) {
+ super.activateListeners(html);
+ html.find(`.use-rest-die`)
+ .on(`click`, this.actor.useRestDie.bind(this.actor));
+ };
+};
diff --git a/module/sheets/SyncVariations/BasicSyncSheet.mjs b/module/sheets/SyncVariations/BasicSyncSheet.mjs
index 197b95b..115fe13 100644
--- a/module/sheets/SyncVariations/BasicSyncSheet.mjs
+++ b/module/sheets/SyncVariations/BasicSyncSheet.mjs
@@ -4,4 +4,4 @@ export class BasicSyncSheet extends AbstractSyncSheet {
get template() {
return `systems/dotdungeon/templates/actors/sync/basic.hbs`;
};
-};
\ No newline at end of file
+};
diff --git a/module/utils.mjs b/module/utils.mjs
deleted file mode 100644
index 7d63d62..0000000
--- a/module/utils.mjs
+++ /dev/null
@@ -1,13 +0,0 @@
-export function reloadWindows(type = null) {
- if (!type) {
- for (const window of globalThis.ui.windows) {
- window.render(true);
- };
- return;
- };
- for (const window of globalThis.ui.windows) {
- if (window instanceof type) {
- window.render(true);
- };
- };
-};
\ No newline at end of file
diff --git a/module/utils/DialogManager.mjs b/module/utils/DialogManager.mjs
new file mode 100644
index 0000000..7c40407
--- /dev/null
+++ b/module/utils/DialogManager.mjs
@@ -0,0 +1,83 @@
+import { localizer } from "./localizer.mjs";
+
+/**
+ * A utility class that allows managing Dialogs that are created for various
+ * purposes such as deleting items, help popups, etc. This is a singleton class
+ * that upon instantiating after the first time will just return the first instance
+ */
+export class DialogManager {
+
+ /** @type {Map} */
+ static #dialogs = new Map();
+
+ /**
+ * Focuses a dialog if it already exists, or creates a new one and renders it.
+ *
+ * @param {string} dialogId The ID to associate with the dialog, should be unique
+ * @param {object} data The data to pass to the Dialog constructor
+ * @param {DialogOptions} opts The options to pass to the Dialog constructor
+ * @returns {Dialog} The Dialog instance
+ */
+ static async createOrFocus(dialogId, data, opts = {}) {
+ if (DialogManager.#dialogs.has(dialogId)) {
+ const dialog = DialogManager.#dialogs.get(dialogId);
+ dialog.bringToTop();
+ return dialog;
+ };
+
+ /*
+ This makes sure that if I provide a close function as a part of the data,
+ that the dialog still gets removed from the set once it's closed, otherwise
+ it could lead to dangling references that I don't care to keep. Or if I don't
+ provide the close function, it just sets the function as there isn't anything
+ extra that's needed to be called.
+ */
+ if (data?.close) {
+ const provided = data.close;
+ data.close = () => {
+ DialogManager.#dialogs.delete(dialogId);
+ provided();
+ };
+ }
+ else {
+ data.close = () => DialogManager.#dialogs.delete(dialogId);
+ };
+
+ // Create the Dialog with the modified data
+ const dialog = new Dialog(data, opts);
+ DialogManager.#dialogs.set(dialogId, dialog);
+ dialog.render(true);
+ return dialog;
+ };
+
+ /**
+ * Closes a dialog if it is rendered
+ *
+ * @param {string} dialogId The ID of the dialog to close
+ */
+ static async close(dialogId) {
+ const dialog = DialogManager.#dialogs.get(dialogId);
+ dialog?.close();
+ };
+
+ static async helpDialog(
+ helpId,
+ helpContent,
+ helpTitle = `dotdungeon.common.help`,
+ localizationData = {},
+ ) {
+ DialogManager.createOrFocus(
+ helpId,
+ {
+ title: localizer(helpTitle, localizationData),
+ content: localizer(helpContent, localizationData),
+ buttons: {},
+ },
+ { resizable: true, }
+ );
+ };
+
+ static get size() {
+ return DialogManager.#dialogs.size;
+ }
+};
diff --git a/module/utils/GenericContextMenu.mjs b/module/utils/GenericContextMenu.mjs
new file mode 100644
index 0000000..9749b4f
--- /dev/null
+++ b/module/utils/GenericContextMenu.mjs
@@ -0,0 +1,6 @@
+export class GenericContextMenu extends ContextMenu {
+ constructor(element, selector, menuItems, opts = {}) {
+ super(element, selector, menuItems, opts);
+ this.menuItems.forEach(i => i.icon ??= ``);
+ };
+};
diff --git a/module/utils/localizer.mjs b/module/utils/localizer.mjs
new file mode 100644
index 0000000..7cfebb0
--- /dev/null
+++ b/module/utils/localizer.mjs
@@ -0,0 +1,37 @@
+import { localizerConfig } from "../config.mjs";
+
+export function handlebarsLocalizer(key, ...args) {
+ let data = args[0]
+ if (args.length === 1) data = args[0].hash;
+ if (key instanceof Handlebars.SafeString) key = key.toString();
+ const localized = localizer(key, data);
+ return localized;
+};
+
+export function localizer(key, args = {}, depth = 0) {
+ /** @type {string} */
+ let localized = game.i18n.format(key, args);
+ const subkeys = localized.matchAll(localizerConfig.subKeyPattern);
+
+ // Short-cut to help prevent infinite recursion
+ if (depth > localizerConfig.maxDepth) {
+ return localized;
+ };
+
+ /*
+ Helps prevent recursion on the same key so that we aren't doing excess work.
+ */
+ const localizedSubkeys = new Map();
+ for (const match of subkeys) {
+ const subkey = match.groups.key;
+ if (localizedSubkeys.has(subkey)) continue;
+ localizedSubkeys.set(subkey, localizer(subkey, args, depth + 1));
+ };
+
+ return localized.replace(
+ localizerConfig.subKeyPattern,
+ (_fullMatch, subkey) => {
+ return localizedSubkeys.get(subkey);
+ }
+ );
+};
diff --git a/module/utils/modifierToString.mjs b/module/utils/modifierToString.mjs
new file mode 100644
index 0000000..2d1c59c
--- /dev/null
+++ b/module/utils/modifierToString.mjs
@@ -0,0 +1,18 @@
+/**
+ * Takes in an integer and converts it into a string format that can be used in
+ * roll formulas or for displaying to the user.
+ *
+ * @param {number} mod The modifier to stringify
+ * @param {object} opts
+ * @param {boolean} opts.spaces Puts spaces on either side of the operand
+ * @returns {string}
+ */
+export function modifierToString(mod, opts = {}) {
+ if (mod == 0) return ``;
+
+ let value = [``, `+`, mod]
+ if (mod < 0) {
+ value = [``, `-`, Math.abs(mod)]
+ };
+ return value.join(opts.spaces ? ` ` : ``);
+};
diff --git a/new-pc-sheet.md b/new-pc-sheet.md
new file mode 100644
index 0000000..f43ce4c
--- /dev/null
+++ b/new-pc-sheet.md
@@ -0,0 +1,80 @@
+## Tabs:
+- Main
+ - Stats
+ - Skills
+- Inventory
+ - Player
+ - Containers
+ - Inventory (divided into category of items)
+ - This is the items that the player will have "on them"
+ - Storage (divided into category of items)
+ - This is all of the items that the players owns and has put into storage *somewhere*
+ - Transportation
+- Combat
+ - Easy skill buttons:
+ - Melee
+ - Accuracy
+ - Weapons
+ - Sync / Respawns
+- Info
+ - Account name
+ - PFP
+ - Group name
+ - Aspects
+ - Roles
+- Spells
+
+======
+
+## Requirements:
+
+Stats:
+ - Needs to list all 6 of the primary stats
+ - Needs to have a dropdown for to select a die
+ - Nice to have: disables dice that have been selected in other stats
+ - Needs to have a button to roll the stat (when a die is selected)
+ - Foundry v12: ActiveEffect - Die needs to be able to be affected by ActiveEffects
+
+Skills:
+ - Each of the 25 skills needs to be grouped under a header of what stat it's
+ associated with
+ - Each skill must have a dropdown to indicate training level (null, trained,
+ expert, locked)
+ - Every skill must have a button to roll the dice that is labelled with the
+ correct formula for that skill (or "Locked" if the skill is locked)
+ - ActiveEffect - Increase Modifier
+ - Foundry v12: ActiveEffect - Increase Training Level
+
+Combat:
+ - Two weapon slots for the equipped weapon(s)
+ - A single armor slot
+ - Quick-access to the Melee / Accuracy skills
+
+Inventory:
+ - Needs three sub-tabs:
+ - Player
+ - Storage
+ - Transportation
+ - Player Subtab:
+ - Needs to have a section for container items, and indicating how many slots
+ each one has.
+ - List all of the items that the player has with the "inventory" location
+ - Show the total number of items the player on their character and how many
+ total slots are available
+ - Needs some way to move items to a different storage area (embedded-only
+ item sheet field maybe)
+ - Storage Subtab:
+ - List all of the items that the player has marked as in-storage
+ - Transportation:
+ - This is currently just a placeholder tab, no functionality needed other
+ than existing
+
+Spells:
+ - Lists all spells on a page (sortable by: alphabetical, cost, etc.)
+
+Info:
+ - Needs a place to edit the actor's name
+ - Needs a place to edit the actor's image
+ - Needs a place to edit the group name (if enabled by the GM, or is the GM)
+ - Needs a place to see and manage all equipped aspects
+ - Needs a place to see and manage all equipped roles
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 2e25431..8fe7e1c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,10 +5,32 @@
"packages": {
"": {
"devDependencies": {
+ "@foundryvtt/foundryvtt-cli": "^1.0.2",
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
"sass": "^1.69.5"
}
},
+ "node_modules/@foundryvtt/foundryvtt-cli": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@foundryvtt/foundryvtt-cli/-/foundryvtt-cli-1.0.2.tgz",
+ "integrity": "sha512-pERML7ViBiqwP11NS1kci0Q38t4h557F/Mj+DjYmmgumMJIZqDsVv2XU3bwOJS7+6yzbUmUc2/jRD6EIx+U/fw==",
+ "dev": true,
+ "dependencies": {
+ "chalk": "^5.2.0",
+ "classic-level": "^1.2.0",
+ "esm": "^3.2.25",
+ "js-yaml": "^4.1.0",
+ "mkdirp": "^3.0.0",
+ "nedb-promises": "^6.2.1",
+ "yargs": "^17.7.1"
+ },
+ "bin": {
+ "fvtt": "fvtt.mjs"
+ },
+ "engines": {
+ "node": ">17.0.0"
+ }
+ },
"node_modules/@league-of-foundry-developers/foundry-vtt-types": {
"version": "9.280.0",
"resolved": "https://registry.npmjs.org/@league-of-foundry-developers/foundry-vtt-types/-/foundry-vtt-types-9.280.0.tgz",
@@ -2152,6 +2174,23 @@
"@pixi/settings": "6.5.10"
}
},
+ "node_modules/@seald-io/binary-search-tree": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@seald-io/binary-search-tree/-/binary-search-tree-1.0.3.tgz",
+ "integrity": "sha512-qv3jnwoakeax2razYaMsGI/luWdliBLHTdC6jU55hQt1hcFqzauH/HsBollQ7IR4ySTtYhT+xyHoijpA16C+tA==",
+ "dev": true
+ },
+ "node_modules/@seald-io/nedb": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@seald-io/nedb/-/nedb-4.0.4.tgz",
+ "integrity": "sha512-CUNcMio7QUHTA+sIJ/DC5JzVNNsHe743TPmC4H5Gij9zDLMbmrCT2li3eVB72/gF63BPS8pWEZrjlAMRKA8FDw==",
+ "dev": true,
+ "dependencies": {
+ "@seald-io/binary-search-tree": "^1.0.3",
+ "localforage": "^1.9.0",
+ "util": "^0.12.4"
+ }
+ },
"node_modules/@socket.io/component-emitter": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz",
@@ -2175,9 +2214,9 @@
}
},
"node_modules/@types/node": {
- "version": "20.10.6",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz",
- "integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==",
+ "version": "20.11.16",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz",
+ "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@@ -2205,6 +2244,48 @@
"integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==",
"dev": true
},
+ "node_modules/abstract-level": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.4.tgz",
+ "integrity": "sha512-eUP/6pbXBkMbXFdx4IH2fVgvB7M0JvR7/lIL33zcs0IBcwjdzSSl31TOJsaCzmKSSDF9h8QYSOJux4Nd4YJqFg==",
+ "dev": true,
+ "dependencies": {
+ "buffer": "^6.0.3",
+ "catering": "^2.1.0",
+ "is-buffer": "^2.0.5",
+ "level-supports": "^4.0.0",
+ "level-transcoder": "^1.0.1",
+ "module-error": "^1.0.1",
+ "queue-microtask": "^1.2.3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
@@ -2218,12 +2299,50 @@
"node": ">= 8"
}
},
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
+ "node_modules/available-typed-arrays": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.6.tgz",
+ "integrity": "sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/backo2": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
"integrity": "sha512-zj6Z6M7Eq+PBZ7PQxl5NT665MvJdAkzp0f60nAJ+sLaSCBPMwVak5ZegFbgVCzFcCJTKFoMizvM5Ld7+JrRJHA==",
"dev": true
},
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@@ -2245,20 +2364,69 @@
"node": ">=8"
}
},
+ "node_modules/buffer": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "dependencies": {
+ "base64-js": "^1.3.1",
+ "ieee754": "^1.2.1"
+ }
+ },
"node_modules/call-bind": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz",
- "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==",
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.6.tgz",
+ "integrity": "sha512-Mj50FLHtlsoVfRfnHaZvyrooHcrlceNZdL/QBvJJVd9Ta55qCQK0gs4ss2oZDeV9zFCs6ewzYgVE5yfVmfFpVg==",
"dev": true,
"dependencies": {
+ "es-errors": "^1.3.0",
"function-bind": "^1.1.2",
- "get-intrinsic": "^1.2.1",
- "set-function-length": "^1.1.1"
+ "get-intrinsic": "^1.2.3",
+ "set-function-length": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/catering": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz",
+ "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/chalk": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
+ "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
+ "dev": true,
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@@ -2286,6 +2454,55 @@
"fsevents": "~2.3.2"
}
},
+ "node_modules/classic-level": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.4.1.tgz",
+ "integrity": "sha512-qGx/KJl3bvtOHrGau2WklEZuXhS3zme+jf+fsu6Ej7W7IP/C49v7KNlWIsT1jZu0YnfzSIYDGcEWpCa1wKGWXQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "dependencies": {
+ "abstract-level": "^1.0.2",
+ "catering": "^2.1.0",
+ "module-error": "^1.0.1",
+ "napi-macros": "^2.2.2",
+ "node-gyp-build": "^4.3.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -2304,14 +2521,15 @@
}
},
"node_modules/define-data-property": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz",
- "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==",
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.2.tgz",
+ "integrity": "sha512-SRtsSqsDbgpJBbW3pABMCOt6rQyeM8s8RiyeSN8jYG8sYmt/kGJejbydttUsnDs1tadr19tvhT4ShwMyoqAm4g==",
"dev": true,
"dependencies": {
- "get-intrinsic": "^1.2.1",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.2",
"gopd": "^1.0.1",
- "has-property-descriptors": "^1.0.0"
+ "has-property-descriptors": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
@@ -2323,6 +2541,12 @@
"integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==",
"dev": true
},
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
"node_modules/engine.io-client": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.0.3.tgz",
@@ -2349,12 +2573,39 @@
"node": ">=10.0.0"
}
},
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/es6-promise-polyfill": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/es6-promise-polyfill/-/es6-promise-polyfill-1.2.0.tgz",
"integrity": "sha512-HHb0vydCpoclpd0ySPkRXMmBw80MRt1wM4RBJBlXkux97K7gleabZdsR0gvE1nNPM9mgOZIBTzjjXiPxf4lIqQ==",
"dev": true
},
+ "node_modules/escalade": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
+ "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/esm": {
+ "version": "3.2.25",
+ "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz",
+ "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/eventemitter3": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz",
@@ -2373,6 +2624,15 @@
"node": ">=8"
}
},
+ "node_modules/for-each": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
+ "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
+ "dev": true,
+ "dependencies": {
+ "is-callable": "^1.1.3"
+ }
+ },
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -2396,17 +2656,30 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true,
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
"node_modules/get-intrinsic": {
- "version": "1.2.2",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
- "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==",
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
+ "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
"dev": true,
"dependencies": {
+ "es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3",
"hasown": "^2.0.0"
},
+ "engines": {
+ "node": ">= 0.4"
+ },
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@@ -2498,6 +2771,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+ "dev": true,
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/hasown": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
@@ -2510,12 +2798,60 @@
"node": ">= 0.4"
}
},
+ "node_modules/ieee754": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/immediate": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
+ "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
+ "dev": true
+ },
"node_modules/immutable": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.4.tgz",
"integrity": "sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==",
"dev": true
},
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "node_modules/is-arguments": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
+ "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "has-tostringtag": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
@@ -2528,6 +2864,41 @@
"node": ">=8"
}
},
+ "node_modules/is-buffer": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
+ "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/is-callable": {
+ "version": "1.2.7",
+ "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
+ "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -2537,6 +2908,30 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-generator-function": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz",
+ "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==",
+ "dev": true,
+ "dependencies": {
+ "has-tostringtag": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
@@ -2558,12 +2953,79 @@
"node": ">=0.12.0"
}
},
+ "node_modules/is-typed-array": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz",
+ "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==",
+ "dev": true,
+ "dependencies": {
+ "which-typed-array": "^1.1.14"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/ismobilejs": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz",
"integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==",
"dev": true
},
+ "node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/level-supports": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz",
+ "integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/level-transcoder": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz",
+ "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==",
+ "dev": true,
+ "dependencies": {
+ "buffer": "^6.0.3",
+ "module-error": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/lie": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
+ "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==",
+ "dev": true,
+ "dependencies": {
+ "immediate": "~3.0.5"
+ }
+ },
+ "node_modules/localforage": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz",
+ "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==",
+ "dev": true,
+ "dependencies": {
+ "lie": "3.1.1"
+ }
+ },
"node_modules/mini-signals": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mini-signals/-/mini-signals-1.2.0.tgz",
@@ -2579,18 +3041,68 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/mkdirp": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
+ "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
+ "dev": true,
+ "bin": {
+ "mkdirp": "dist/cjs/src/bin.js"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/module-error": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz",
+ "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
+ "node_modules/napi-macros": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz",
+ "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==",
+ "dev": true
+ },
+ "node_modules/nedb-promises": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/nedb-promises/-/nedb-promises-6.2.3.tgz",
+ "integrity": "sha512-enq0IjNyBz9Qy9W/QPCcLGh/QORGBjXbIeZeWvIjO3OMLyAvlKT3hiJubP2BKEiFniUlR3L01o18ktqgn5jxqA==",
+ "dev": true,
+ "dependencies": {
+ "@seald-io/nedb": "^4.0.2"
+ }
+ },
"node_modules/neo-async": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
+ "node_modules/node-gyp-build": {
+ "version": "4.8.0",
+ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz",
+ "integrity": "sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==",
+ "dev": true,
+ "bin": {
+ "node-gyp-build": "bin.js",
+ "node-gyp-build-optional": "optional.js",
+ "node-gyp-build-test": "build-test.js"
+ }
+ },
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
@@ -2833,6 +3345,26 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@@ -2845,6 +3377,15 @@
"node": ">=8.10.0"
}
},
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/resource-loader": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/resource-loader/-/resource-loader-3.0.1.tgz",
@@ -2873,29 +3414,35 @@
}
},
"node_modules/set-function-length": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
- "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==",
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz",
+ "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==",
"dev": true,
"dependencies": {
- "define-data-property": "^1.1.1",
- "get-intrinsic": "^1.2.1",
+ "define-data-property": "^1.1.2",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.3",
"gopd": "^1.0.1",
- "has-property-descriptors": "^1.0.0"
+ "has-property-descriptors": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/side-channel": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
- "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz",
+ "integrity": "sha512-QcgiIWV4WV7qWExbN5llt6frQB/lBven9pqliLXfGPB+K9ZYXxDozp0wLkHS24kWCm+6YXH/f0HhnObZnZOBnQ==",
"dev": true,
"dependencies": {
- "call-bind": "^1.0.0",
- "get-intrinsic": "^1.0.2",
- "object-inspect": "^1.9.0"
+ "call-bind": "^1.0.6",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.4",
+ "object-inspect": "^1.13.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -2949,6 +3496,32 @@
"node": ">=0.10.0"
}
},
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/tinymce": {
"version": "5.10.1",
"resolved": "https://registry.npmjs.org/tinymce/-/tinymce-5.10.1.tgz",
@@ -2996,12 +3569,61 @@
"qs": "^6.11.2"
}
},
+ "node_modules/util": {
+ "version": "0.12.5",
+ "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz",
+ "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==",
+ "dev": true,
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "is-arguments": "^1.0.4",
+ "is-generator-function": "^1.0.7",
+ "is-typed-array": "^1.1.3",
+ "which-typed-array": "^1.1.2"
+ }
+ },
+ "node_modules/which-typed-array": {
+ "version": "1.1.14",
+ "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.14.tgz",
+ "integrity": "sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg==",
+ "dev": true,
+ "dependencies": {
+ "available-typed-arrays": "^1.0.6",
+ "call-bind": "^1.0.5",
+ "for-each": "^0.3.3",
+ "gopd": "^1.0.1",
+ "has-tostringtag": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/wordwrap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
"dev": true
},
+ "node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
"node_modules/ws": {
"version": "8.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
@@ -3032,6 +3654,42 @@
"node": ">=0.4.0"
}
},
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "dev": true,
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/yeast": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
diff --git a/package.json b/package.json
index dd1e0cf..879d5e8 100644
--- a/package.json
+++ b/package.json
@@ -4,6 +4,7 @@
"build": "sass --embed-source-map --no-error-css styles/:.styles/"
},
"devDependencies": {
+ "@foundryvtt/foundryvtt-cli": "^1.0.2",
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
"sass": "^1.69.5"
}
diff --git a/packs/adventures/_source/Tutorial_Dungeon_P4I3A3FYvW0Yedqm.json b/packs/adventures/_source/Tutorial_Dungeon_P4I3A3FYvW0Yedqm.json
new file mode 100644
index 0000000..a9be6ac
--- /dev/null
+++ b/packs/adventures/_source/Tutorial_Dungeon_P4I3A3FYvW0Yedqm.json
@@ -0,0 +1,29 @@
+{
+ "name": "Tutorial Dungeon",
+ "img": null,
+ "caption": "",
+ "sort": 0,
+ "description": "",
+ "actors": [],
+ "combats": [],
+ "items": [],
+ "journal": [],
+ "scenes": [],
+ "tables": [],
+ "macros": [],
+ "cards": [],
+ "playlists": [],
+ "folders": [],
+ "_id": "P4I3A3FYvW0Yedqm",
+ "folder": null,
+ "flags": {},
+ "_stats": {
+ "systemId": "dotdungeon",
+ "systemVersion": "0.0.5",
+ "coreVersion": "11.315",
+ "createdTime": 1708052903525,
+ "modifiedTime": 1708052903525,
+ "lastModifiedBy": "SXF6LgHA8oYfOhCm"
+ },
+ "_key": "!adventures!P4I3A3FYvW0Yedqm"
+}
diff --git a/packs/beastiary/_source/Arya_oCHOQYCQEI1zk5zO.json b/packs/beastiary/_source/Arya_oCHOQYCQEI1zk5zO.json
new file mode 100644
index 0000000..4474fb8
--- /dev/null
+++ b/packs/beastiary/_source/Arya_oCHOQYCQEI1zk5zO.json
@@ -0,0 +1,105 @@
+{
+ "name": "Arya",
+ "type": "mob",
+ "_id": "oCHOQYCQEI1zk5zO",
+ "img": "icons/svg/mystery-man.svg",
+ "system": {
+ "bonus": 4,
+ "initiative": null,
+ "morale": 20,
+ "drops": "Arya's Cloak",
+ "stunts": "Arya's Shroud - On her initiative, Arya drags a player into her shroud, a foggy one-on-one arena. They leave at the beginning of Arya's next turn if she chooses a new victim.",
+ "immune": "Solar, Shadow, Neon",
+ "weak": "Gun",
+ "bytes": 0,
+ "description": "The Queen of the Wode. A gargantuan fox who converses with her all-seeing children (the Palims) through hidden strings of code. If you find her, perform a /bow and offer anything of value. She can guide you where you need to go.",
+ "dice": [
+ {
+ "count": 3,
+ "sides": 6,
+ "repeat": 5
+ }
+ ]
+ },
+ "prototypeToken": {
+ "name": "Arya",
+ "displayName": 0,
+ "actorLink": false,
+ "appendNumber": false,
+ "prependAdjective": false,
+ "texture": {
+ "src": "icons/svg/mystery-man.svg",
+ "scaleX": 1,
+ "scaleY": 1,
+ "offsetX": 0,
+ "offsetY": 0,
+ "rotation": 0
+ },
+ "width": 1,
+ "height": 1,
+ "lockRotation": false,
+ "rotation": 0,
+ "alpha": 1,
+ "disposition": -1,
+ "displayBars": 0,
+ "bar1": {
+ "attribute": null
+ },
+ "bar2": {
+ "attribute": null
+ },
+ "light": {
+ "alpha": 0.5,
+ "angle": 360,
+ "bright": 0,
+ "coloration": 1,
+ "dim": 0,
+ "attenuation": 0.5,
+ "luminosity": 0.5,
+ "saturation": 0,
+ "contrast": 0,
+ "shadows": 0,
+ "animation": {
+ "type": null,
+ "speed": 5,
+ "intensity": 5,
+ "reverse": false
+ },
+ "darkness": {
+ "min": 0,
+ "max": 1
+ }
+ },
+ "sight": {
+ "enabled": false,
+ "range": 0,
+ "angle": 360,
+ "visionMode": "basic",
+ "attenuation": 0.1,
+ "brightness": 0,
+ "saturation": 0,
+ "contrast": 0
+ },
+ "detectionModes": [],
+ "flags": {},
+ "randomImg": false
+ },
+ "items": [],
+ "effects": [],
+ "folder": null,
+ "sort": 0,
+ "ownership": {
+ "default": 0,
+ "SXF6LgHA8oYfOhCm": 3
+ },
+ "flags": {},
+ "_stats": {
+ "systemId": "dotdungeon",
+ "systemVersion": "0.0.5",
+ "coreVersion": "11.315",
+ "createdTime": 1708052549670,
+ "modifiedTime": 1708052728103,
+ "lastModifiedBy": "SXF6LgHA8oYfOhCm"
+ },
+ "_key": "!actors!oCHOQYCQEI1zk5zO"
+}
diff --git a/packs/beastiary/_source/Dragon_TxMsleI1qG86zj6B.json b/packs/beastiary/_source/Dragon_TxMsleI1qG86zj6B.json
new file mode 100644
index 0000000..29986f4
--- /dev/null
+++ b/packs/beastiary/_source/Dragon_TxMsleI1qG86zj6B.json
@@ -0,0 +1,110 @@
+{
+ "name": "Dragon",
+ "type": "mob",
+ "_id": "TxMsleI1qG86zj6B",
+ "img": "icons/svg/mystery-man.svg",
+ "system": {
+ "bonus": 6,
+ "initiative": 20,
+ "morale": 2,
+ "drops": "Dragon Materials",
+ "stunts": "Breath Weapon: At the end of the round, the Dragon breathes its fire onto the battlefield, forcing everyone to make a contest against its current dice.",
+ "immune": "Piercing, Slashing, Smashing",
+ "weak": "Gun, Neon",
+ "bytes": 0,
+ "description": "Children of Annwn that explode from her body and conquer the hex of their birth. Stylized after the lung Dragons",
+ "dice": [
+ {
+ "count": 3,
+ "sides": 6,
+ "repeat": 4
+ },
+ {
+ "count": 2,
+ "sides": 6,
+ "repeat": 2
+ }
+ ]
+ },
+ "prototypeToken": {
+ "name": "Dragon",
+ "displayName": 0,
+ "actorLink": false,
+ "appendNumber": false,
+ "prependAdjective": false,
+ "texture": {
+ "src": "icons/svg/mystery-man.svg",
+ "scaleX": 1,
+ "scaleY": 1,
+ "offsetX": 0,
+ "offsetY": 0,
+ "rotation": 0
+ },
+ "width": 1,
+ "height": 1,
+ "lockRotation": false,
+ "rotation": 0,
+ "alpha": 1,
+ "disposition": -1,
+ "displayBars": 0,
+ "bar1": {
+ "attribute": null
+ },
+ "bar2": {
+ "attribute": null
+ },
+ "light": {
+ "alpha": 0.5,
+ "angle": 360,
+ "bright": 0,
+ "coloration": 1,
+ "dim": 0,
+ "attenuation": 0.5,
+ "luminosity": 0.5,
+ "saturation": 0,
+ "contrast": 0,
+ "shadows": 0,
+ "animation": {
+ "type": null,
+ "speed": 5,
+ "intensity": 5,
+ "reverse": false
+ },
+ "darkness": {
+ "min": 0,
+ "max": 1
+ }
+ },
+ "sight": {
+ "enabled": false,
+ "range": 0,
+ "angle": 360,
+ "visionMode": "basic",
+ "attenuation": 0.1,
+ "brightness": 0,
+ "saturation": 0,
+ "contrast": 0
+ },
+ "detectionModes": [],
+ "flags": {},
+ "randomImg": false
+ },
+ "items": [],
+ "effects": [],
+ "folder": null,
+ "sort": 0,
+ "ownership": {
+ "default": 0,
+ "SXF6LgHA8oYfOhCm": 3
+ },
+ "flags": {},
+ "_stats": {
+ "systemId": "dotdungeon",
+ "systemVersion": "0.0.5",
+ "coreVersion": "11.315",
+ "createdTime": 1707676733262,
+ "modifiedTime": 1707676892258,
+ "lastModifiedBy": "SXF6LgHA8oYfOhCm"
+ },
+ "_key": "!actors!TxMsleI1qG86zj6B"
+}
diff --git a/packs/rules/_source/Exploration_RT4uYaDJYd2RkDaA.json b/packs/rules/_source/Exploration_RT4uYaDJYd2RkDaA.json
new file mode 100644
index 0000000..f0a3d7d
--- /dev/null
+++ b/packs/rules/_source/Exploration_RT4uYaDJYd2RkDaA.json
@@ -0,0 +1,21 @@
+{
+ "name": "Exploration",
+ "_id": "RT4uYaDJYd2RkDaA",
+ "pages": [],
+ "folder": null,
+ "sort": 0,
+ "ownership": {
+ "default": 0,
+ "SXF6LgHA8oYfOhCm": 3
+ },
+ "flags": {},
+ "_stats": {
+ "systemId": "dotdungeon",
+ "systemVersion": "0.0.5",
+ "coreVersion": "11.315",
+ "createdTime": 1708054253372,
+ "modifiedTime": 1708054253372,
+ "lastModifiedBy": "SXF6LgHA8oYfOhCm"
+ },
+ "_key": "!journal!RT4uYaDJYd2RkDaA"
+}
diff --git a/packs/rules/_source/Inventory_y7CfRycKl5A8SpnH.json b/packs/rules/_source/Inventory_y7CfRycKl5A8SpnH.json
new file mode 100644
index 0000000..ec5324f
--- /dev/null
+++ b/packs/rules/_source/Inventory_y7CfRycKl5A8SpnH.json
@@ -0,0 +1,94 @@
+{
+ "name": "Inventory",
+ "_id": "y7CfRycKl5A8SpnH",
+ "pages": [
+ {
+ "sort": 100000,
+ "name": "Bytes",
+ "type": "text",
+ "_id": "3uVI4u2ByT8Tt6jq",
+ "title": {
+ "show": true,
+ "level": 1
+ },
+ "image": {},
+ "text": {
+ "format": 1,
+ "content": "
Bytes are the currency of .dungeon. They can only be gained by interacting with the game: travelling to far away places, fighting mobs, exploring randomly generated structures, and taking on quests. They are used for everything from buying gear, to casting spells, and uncovering secrets in the world.
Gaining Bytes
A character gains 1 Byte (1b) per day as long as they log in and play. Traveling into a new hex for the first time also nets 1b. Defeating an encounter without taking Sync damage will gain the party an additional 1b each.
The Hidden World of Bytes
Last year, players discovered that an entire region of the map was unlocked once they accumulated enough Bytes, leading to speculation that the developers have hidden other things behind Bytes. Secret doors have been found in the tutorial dungeon. Some mobs are hidden until a certain number of Bytes are acquired. There are many secrets we've yet to uncover.
Skills are in-game abilities that dictate how good your Avatar is at accomplishing tasks. Choose three skills to gain training in, alongside the one skill gifted by your job. Training in a skill means you get +2 to rolls when using it. Expertise in a skill means you get +4 to rolls when using it.
Skills are categorized by which Stat they fall under. Add your bonus to Contests where the Skill is applicable, rolling your Stat Dice and adding the Skill to the result.
Skill Training
To learn a new skill, PCs must find someone who can teach it to them. This requires a payment of 20 Bytes and a week of downtime. To gain Expertise in a skill, the player and the Server Host must agree to a challenge. Failure to accomplish the challenge locks you out of the skill into another challenge is agreed upon. If the challenge is accomplished the player gains Expertise in the skill.
Instead of armor, characters have a base defense that acts as damage reduction. Training in defense gives you 1dr, and Expertise gives you 2dr. Some clothes and armour may offer more damage reduction.
Magic
Training in magic lets you cast spells. Without training, you might be able to read the spells but their magic is lost on you. Expertise allows you to identify who cast a particular spell and detect magic in the area.
Melee
Training in melee allows you to use big melee weapons. Expertise allows you a unique \"stance\" with your weapon of choice. Whether you're swinging a sword or a punch, add your training when making attacks against against opponents.
Platforming
Acrobatic leaps, climbing, and navigating dangerous terrain. Training in platforming gives you tighter control over your Avatar's movements. Expertise gives you a double jump.
Strength
Knocking this over, pushing things out of the way, and general, hand-made destruction. Training in strength makes objects weigh less to your character. Expertise lets you throw large objects.
Creating and identifying foils. Training in alchemy allows your character to craft lesser foils out of Materials. Expertise lets you craft greater foils.
Arcanum
The knowledge and training to use magic items and sci-fi tech. Training in arcanum allows you to use neon weapons. Expertise gives you basic information about magic items that are within your line of sight.
Dreams
Considered a hidden skill of the game, because it's not clearly defined on the wiki. [Call to action! The .dungeon wiki is open for contributors who know more about this skill]
Training in dreams allows you to make pacts with the pantheon of .dungeon. Expertise in it allows you to open yourself to the world of Annwn and receive messages from it. Often cryptic or prophetic.
Lore
Training in lore means the game expands descriptive text. Expertise means the game might butt in to give you information, even when you didn't ask for it.
Navigation
Training in navigation improves your HUD radar and quest markers. Expertise gives you active hints to help you search and travel.
Training in animal handling allows you to take on animals (and some monsters) as pets. Expertise in animal handling lets you reroll animal reactions to you, and take on a mount.
Perception
Training in perception improves colours, sounds, and smells to enhance your senses. Expertise in perception does this even more and also adds faint outlines to things of interest. The invisible hands of the game like you.
Sneak
Training in sneak reduces the ambient and active sounds of your Avatar. Expertise makes you completely silent while crouched.
Speech
Training in speech improves NPC reactions to you. Expertise in speech rerolls reaction rolls even in dangerous situations.
Vibes
Training in vibes improves the haptic feedback of your VR rig, giving you subtle signals when things are off. Expertise improves this even more and makes NPCs more readable.
Training in accuracy reduces arrow and bullet drop and other things that affect trajectory of ranged attacks. Expertise subtly slows aiming down to give you greater control.
Crafting
Training in crafting allows you to create lesser versions of items as long as you have the supplies. Expertise allows you to create greater versions.
Engineering
Training in engineering aids you in repairing vehicles and other machinery in the world. Expertise aids you further by reducing repair costs.
Explosives
Training in explosives allows you more wiggle room for failure while using them in combat and aids you in building and disarming explosives. Expertise allows you to disarm explosives without destroying them.
Piloting
Training in piloting improves vehicle responsiveness and makes them easier to control. Expertise allows for a semi-auto-pilot so you can take on simple tasks while also piloting.
System mastery, character optimization, the crunch of the game.
Meta
Knowledge of the game, its setting, and its development.
Presence
Your senses, charisma, and immersion in the virtual world.
Hands
Your reaction time, hand-eye coordination, and precision.
Tilt
Tilt is how you keep your cool when the virtual world is unfair. Other RPGs call this a \"save\" or a \"saving throw\". Whenever your character would take on a status effect, roll your Tilt dice, getting a 4 or higher is a success, avoiding the status.
RNG
RNG is also known as \"luck\" in other RPGs, RNG rolls are done for random events, loot drops, and other acts of chance the Server needs to account for. You can also roll RNG against an NPC to see if they are nearby.
Status are applied when traps are triggered, mobs land unique attacks, or by fumbling certain actions. When a status is applied, its effects are immediate. A player can use their action to make a tilt roll to end the status. Otherwise they'll need foils or magic to cure the status.
Make an RNG roll to be able to spot an invisible target. All combat rolls must be made using RNG as well. Hitting an invisible target makes them visible.
Melee attacks against you count as crits if they hit. Ranged attacks treat you as behind partial cover. You can end this status at the end of your turn, no roll is needed.