Bug/153 undeploy jquery (#270)

* REFACTOR: remove unnecessary handlebars

* REFACTOR: add jsdoc to DHContextMenu class

* remove jquery cont ChatLog class

* FIX error on create weapons

* REFACTOR:make more legible  _preCreate

---------

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-07-05 15:10:49 -03:00 committed by GitHub
parent 41181f19f1
commit eac58c1386
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 154 additions and 135 deletions

View file

@ -1,4 +1,4 @@
// import { actionsTypes } from '../action/_module.mjs';
import { actionsTypes } from '../action/_module.mjs';
/**
* Describes metadata about the item data model type
@ -55,24 +55,28 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
return data;
}
/**@inheritdoc */
async _preCreate(data, options, user) {
// Skip if no initial action is required or actions already exist
if (!this.constructor.metadata.hasInitialAction || !foundry.utils.isEmpty(this.actions)) return;
const actionType = {
weapon: 'attack'
}[this.constructor.metadata.type],
cls = game.system.api.models.actionsTypes[actionType],
// cls = actionsTypes.attack,
action = new cls(
{
_id: foundry.utils.randomID(),
type: actionType,
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
...cls.getSourceConfig(this.parent)
},
{
parent: this.parent
}
);
const metadataType = this.constructor.metadata.type;
const actionType = { weapon: "attack" }[metadataType];
const ActionClass = actionsTypes[actionType];
const action = new ActionClass(
{
_id: foundry.utils.randomID(),
type: actionType,
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
...ActionClass.getSourceConfig(this.parent)
},
{
parent: this.parent
}
);
this.updateSource({ actions: [action] });
}
}