Skip to content

Commit

Permalink
Merge pull request #189 from juanferrer/master
Browse files Browse the repository at this point in the history
4.1.0
  • Loading branch information
ClipplerBlood committed Jun 20, 2024
2 parents 748ea83 + 603e49c commit e814706
Show file tree
Hide file tree
Showing 11 changed files with 1,127 additions and 7,236 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
parserOptions: {
sourceType: 'module',
ecmaVersion: 2022
},

env: {
Expand Down
7,967 changes: 836 additions & 7,131 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 14 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "demonlord-cromethius",
"version": "2.2.7",
"name": "demonlord",
"version": "4.0.0",
"description": "",
"license": "",
"homepage": "",
Expand All @@ -10,14 +10,9 @@
"url": ""
},
"bugs": {
"url": ""
"url": "https://github.com/Xacus/demonlord/issues"
},
"contributors": [
{
"name": "",
"email": ""
}
],
"contributors": [],
"scripts": {
"build": "gulp build",
"build:watch": "gulp watch",
Expand All @@ -33,25 +28,25 @@
"release": "dotenv release-it --"
},
"devDependencies": {
"@foundryvtt/foundryvtt-cli": "^1.0.0-rc.4",
"@foundryvtt/foundryvtt-cli": "^1.0.2",
"@release-it/bumper": "^6.0.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@typhonjs-fvtt/eslint-config-foundry.js": "^0.8.0",
"chalk": "^4.1.1",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"chalk": "^4.1.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^3.4.1",
"fs-extra": "^9.1.0",
"gulp": "^5.0.0",
"gulp-sass": "^5.1.0",
"husky": "^6.0.0",
"lint-staged": "^10.5.4",
"prettier": "^2.3.0",
"prettier": "^2.8.8",
"release-it": "^17.3.0",
"rollup": "^2.78.1",
"sass": "^1.66.1",
"rollup": "^2.79.1",
"sass": "^1.77.4",
"semver": "^7.3.5",
"yargs": "^16.2.0"
},
Expand All @@ -60,9 +55,9 @@
"*.(json|scss)": "prettier --write"
},
"dependencies": {
"dotenv-cli": "^4.0.0",
"dotenv-cli": "^4.1.1",
"jszip-cli": "^1.4.24",
"rollup-plugin-import-css": "^3.0.3",
"rollup-plugin-import-css": "^3.5.0",
"tippy.js": "^6.3.7"
}
}
1 change: 1 addition & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@
"DL.stabilize": "Stabilize",
"DL.stunned": "Stunned",
"DL.surprised": "Surprised",
"DL.StatEditor": "Stat Editor",
"DL.TabsAfflictions": "Afflictions",
"DL.TabsActivatedEffect": "Activated Effect",
"DL.TabsAttributes": "Attributes",
Expand Down
1 change: 1 addition & 0 deletions src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@
"DL.rush": "Apresurado",
"DL.stabilize": "Estabilizando",
"DL.encumbered": "Sobrecargado",
"DL.StatEditor": "Editor de Estadística",
"DL.GMTools": "Herramientas del DJ",
"DL.ToogleBarView": "Activar/Desactivar vista de barra.",
"DL.AfflictionsAsleep": "Una criatura dormida se considera derribada e inconsciente. Cualquiera que pueda alcanzarla tendrá la opción de despertarla. A menos que se indique lo contrario, sufrir daño elimina la aflicción.",
Expand Down
10 changes: 8 additions & 2 deletions src/module/active-effects/sheets/active-effect-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ export class DLActiveEffectConfig extends ActiveEffectConfig {
'system.bonuses.attack.boons.will': i18n('DL.TalentAttackBoonsBanes') + ' - ' + i18n('DL.AttributeWill'),
'system.bonuses.attack.boons.perception': i18n('DL.TalentAttackBoonsBanes') + ' - ' + i18n('DL.AttributePerception'),
'system.bonuses.attack.boons.all': i18n('DL.TalentAttackBoonsBanes') + ' - ' + i18n('DL.AllTitle'),
'system.bonuses.attack.damage': i18n('DL.TalentExtraDamage'),
'system.bonuses.attack.plus20Damage': i18n('DL.TalentExtraDamage20plus'),
'system.bonuses.attack.damage.spell': i18n('DL.TalentExtraDamage') + ' - ' + i18n('DL.MagicSpellsTitle'),
'system.bonuses.attack.damage.weapon': i18n('DL.TalentExtraDamage') + ' - ' + i18n('DL.WeaponTitle'),
'system.bonuses.attack.damage.talent': i18n('DL.TalentExtraDamage') + ' - ' + i18n('DL.TalentTitle'),
'system.bonuses.attack.damage.all': i18n('DL.TalentExtraDamage') + ' - ' + i18n('DL.AllTitle'),
'system.bonuses.attack.plus20Damage.spell': i18n('DL.TalentExtraDamage20plus') + ' - ' + i18n('DL.MagicSpellsTitle'),
'system.bonuses.attack.plus20Damage.weapon': i18n('DL.TalentExtraDamage20plus') + ' - ' + i18n('DL.WeaponTitle'),
'system.bonuses.attack.plus20Damage.talent': i18n('DL.TalentExtraDamage20plus') + ' - ' + i18n('DL.TalentTitle'),
'system.bonuses.attack.plus20Damage.all': i18n('DL.TalentExtraDamage20plus') + ' - ' + i18n('DL.AllTitle'),
'system.bonuses.attack.extraEffect': i18n('DL.TalentExtraEffect'),
// Challenge bonuses
'system.bonuses.challenge.boons.strength': i18n('DL.TalentChallengeBoonsBanes') + ' - ' + i18n('DL.AttributeStrength'),
Expand Down
6 changes: 3 additions & 3 deletions src/module/actor/sheets/character-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ export default class DLCharacterSheet extends DLBaseActorSheet {
launchRestDialog(game.i18n.localize('DL.DialogRestTitle'), (dHtml, restTime) => {
this.actor.restActor(
restTime,
!dHtml.find("input[id='noMagicRecovery']")[0].checked,
!dHtml.find("input[id='noTalentRecovery']")[0].checked,
!dHtml.find("input[id='noHealing']")[0].checked,
!dHtml.currentTarget.querySelector("input[id='noMagicRecovery']").checked,
!dHtml.currentTarget.querySelector("input[id='noTalentRecovery']").checked,
!dHtml.currentTarget.querySelector("input[id='noHealing']").checked,
)
}),
)
Expand Down
23 changes: 14 additions & 9 deletions src/module/dialog/rest-dialog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { DialogV2 } = foundry.applications.api

export default function launchRestDialog(dialogTitle, callback) {
const d = new Dialog({
title: dialogTitle,
const d = new DialogV2({
window: { title: dialogTitle },
content: `
<div class="restdialog">
<div class="inputContainer">
Expand All @@ -17,22 +19,25 @@ export default function launchRestDialog(dialogTitle, callback) {
</div>
</div>
`,
buttons: {
rest8h: {
buttons: [
{
action: 'rest8h',
label: game.i18n.localize('DL.DialogRest8hrs'),
//default: true,
callback: html => callback(html, 8),
},
rest24h: {
{
action: 'rest24h',
label: game.i18n.localize('DL.DialogRest24hrs'),
callback: html => callback(html, 24),
},
cancel: {
icon: '<i class="fas fa-times"></i>',
{
action: 'cancel',
icon: 'fas fa-times',
label: game.i18n.localize('DL.DialogCancel'),
callback: () => {},
},
},
default: 'rest8h',
],
close: () => {},
})
d.render(true)
Expand Down
122 changes: 69 additions & 53 deletions src/module/dialog/stat-editor.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,96 @@
import { capitalize } from "../utils/utils"

export class DLStatEditor extends FormApplication {
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api

constructor(object, options) {
super(options)
this.ancestry = object.ancestry
this.statType = object.statType
this.statName = object.statName
}

/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
classes: ['charactergenerator', 'sheet', 'actor'],
export class DLStatEditor extends HandlebarsApplicationMixin(ApplicationV2) {
static DEFAULT_OPTIONS = {
tag: 'form',
form: {
handler: this.onSubmit,
submitOnChange: false,
closeOnSubmit: true
},
classes: ['sheet', 'actor', 'stat-editor'],
actions: {
rollStat: this.rollStat
},
position: {
width: 300,
height: 208,
})
height: 230,
}
}

/** @override */
get template() {
return 'systems/demonlord/templates/dialogs/stat-editor.hbs'
static PARTS = {
form: {
template: 'systems/demonlord/templates/dialogs/stat-editor.hbs'
}
}

/* -------------------------------------------- */
/**
* Add the Entity name into the window title
* @type {String}
*/
/** @inheritDoc */
get title() {
return `${game.i18n.localize('DL.StatEditor')}: ${capitalize(this.statName)}`
}

/**
* Construct and return the data object used to render the HTML template for this form application.
* @return {Object}
*/
getData() {
/**
* Prepare application rendering context data for a given render request.
* @param {RenderOptions} options Options which configure application rendering behavior
* @returns {Promise<ApplicationRenderContext>} Context data for the render operation
* @protected
*/
async _prepareContext(options) { // eslint-disable-line no-unused-vars
return this.ancestry.system[this.statType][this.statName]
}

/** @override */
activateListeners(html) {
super.activateListeners(html)

// Enable roll formula
html.find('.stat-editor-roll-button').click(async ev => {
const div = ev.currentTarget
const target = div.parentElement.parentElement.firstElementChild
const formula = div.previousElementSibling.value
const roll = new Roll(formula, this.system)
await roll.evaluate()
target.value = roll.total
})
}

/**
* This method is called upon form submission after form data is validated
* @param event {Event} The initial triggering submission event
* @param formData {Object} The object of validated form data with which to update the object
* @private
*/
async _updateObject(event, formData) {
/**
* Process form submission for the sheet
* @this {MyApplication} The handler is called with the application as its bound scope
* @param {SubmitEvent} event The originating form submission event
* @param {HTMLFormElement} form The form element that was submitted
* @param {FormDataExtended} formData Processed data for the submitted form
* @returns {Promise<void>}
*/
static async onSubmit(event, form, formData) {
console.log(this.ancestry)
await this.ancestry.update({
system: {
[this.statType]: {
[this.statName]: {
value: formData.value,
formula: formData.formula,
immune: formData.immune
value: formData.object.value,
formula: formData.object.formula,
immune: formData.object.immune
}
}
}
})

this.ancestry.sheet.render(true)
}
}

/**
*
* @param {SubmitEvent} event
* @param {HtmlElement} target
*/
static async rollStat(event, target) { // eslint-disable-line no-unused-vars
const divTarget = document.getElementById('stat-editor-roll-target')
const formula = document.getElementById('stat-editor-roll-formula').value
const roll = new Roll(formula, this.ancestry.system)
await roll.evaluate()
divTarget.value = roll.total
}

constructor(object, options) {
super(options)
this.ancestry = object.ancestry
this.statType = object.statType
this.statName = object.statName
}

// /**
// * Construct and return the data object used to render the HTML template for this form application.
// * @return {Object}
// */
// getData() {
// return this.ancestry.system[this.statType][this.statName]
// }
}
Loading

0 comments on commit e814706

Please sign in to comment.