ajout item sur cellule + augmentation bonus et difficultés

This commit is contained in:
2024-08-22 14:39:30 +02:00
parent 4eece5aaf4
commit 8a4487c833
71 changed files with 484 additions and 325 deletions

View File

@@ -7,7 +7,7 @@ import { HawkmoonUtility } from "./hawkmoon-utility.js";
import { HawkmoonAutomation } from "./hawkmoon-automation.js";
/* -------------------------------------------- */
const __ALLOWED_ITEM_CELLULE = { "talent": 1, "ressource": 1, "contact": 1}
const __ALLOWED_ITEM_CELLULE = { "talent": 1, "ressource": 1, "contact": 1, "equipement": 1, "protection": 1, "artefact": 1, "arme": 1, "monnaie": 1 }
/* -------------------------------------------- */
export class HawkmoonCelluleSheet extends ActorSheet {
@@ -45,6 +45,13 @@ export class HawkmoonCelluleSheet extends ActorSheet {
ressources: foundry.utils.duplicate(this.actor.getRessources()),
contacts: foundry.utils.duplicate(this.actor.getContacts()),
members: this.getMembers(),
equipements: foundry.utils.duplicate(this.actor.getEquipments()),
artefacts: foundry.utils.duplicate(this.actor.getArtefacts()),
armes: foundry.utils.duplicate(this.actor.getWeapons()),
monnaies: foundry.utils.duplicate(this.actor.getMonnaies()),
protections: foundry.utils.duplicate(this.actor.getArmors()),
richesse: this.actor.computeRichesse(),
valeurEquipement: this.actor.computeValeurEquipement(),
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
options: this.options,
owner: this.document.isOwner,
@@ -110,15 +117,15 @@ export class HawkmoonCelluleSheet extends ActorSheet {
let value = ev.currentTarget.value
this.actor.editItemField(itemId, itemType, itemField, dataType, value)
})
html.find('.quantity-minus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity(li.data("item-id"), -1);
});
html.find('.quantity-plus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity(li.data("item-id"), +1);
});
html.find('.quantity-modify').click(event => {
const li = $(event.currentTarget).parents(".item")
const value = Number($(event.currentTarget).data("quantite-value"))
this.actor.incDecQuantity( li.data("item-id"), value );
})
html.find('.item-add').click((event) => {
const itemType = $(event.currentTarget).data("type")
this.actor.createEmbeddedDocuments('Item', [{ name: `Nouveau ${itemType}`, type: itemType }], { renderSheet: true })
})
html.find('.lock-unlock-sheet').click((event) => {
this.options.editScore = !this.options.editScore;
@@ -149,7 +156,7 @@ export class HawkmoonCelluleSheet extends ActorSheet {
super._onDropItem(event, dragData)
return
}
ui.notifications("Ce type d'item n'est pas autorisé sur une Cellule.")
ui.notification.info("Ce type d'item n'est pas autorisé sur une Cellule.")
}