Fix: Move static methods outside of init() function to class level
The static methods calculateItemValueSC and getItemValueSC were incorrectly placed inside the init() method, causing a SyntaxError in strict mode. This moves them to the class level where they belong. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -12,6 +12,26 @@ const __tailleCible = { normal: 0, main: 10, enfant: 3, maison: -10 }
|
||||
export class MournbladeCYD2Utility {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Helper pour calculer la valeur totale d'un item en SC (Sous de Cuivre / Pièces de Bronze)
|
||||
// Conversion selon le lore Mournblade :
|
||||
// 1 SA (Sou d'Argent / Pièce d'Argent) = 10 PB (Pièces de Bronze / Sous de Cuivre)
|
||||
// 1 PO (Pièce d'Or) = 10 SA = 100 PB
|
||||
// Donc : 1 PA (Pièce d'Argent) = 10 SC, 1 PO (Pièce d'Or) = 100 SC
|
||||
static calculateItemValueSC(prixpo, prixca, prixsc) {
|
||||
const po = parseInt(prixpo) || 0;
|
||||
const ca = parseInt(prixca) || 0;
|
||||
const sc = parseInt(prixsc) || 0;
|
||||
return po * 100 + ca * 10 + sc;
|
||||
}
|
||||
|
||||
// Helper pour calculer la valeur SC d'un item avec quantité
|
||||
static getItemValueSC(item) {
|
||||
const value = this.calculateItemValueSC(item.system?.prixpo, item.system?.prixca, item.system?.prixsc);
|
||||
const quantity = item.system?.quantite || 1;
|
||||
return value * quantity;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async init() {
|
||||
Hooks.on('renderChatLog', (log, html, data) => MournbladeCYD2Utility.chatListeners(html))
|
||||
@@ -49,18 +69,6 @@ export class MournbladeCYD2Utility {
|
||||
Handlebars.registerHelper('subtract', function (a, b) {
|
||||
return parseInt(a) - parseInt(b);
|
||||
})
|
||||
|
||||
// Helper pour calculer la valeur totale d'un item en SC (Sous de Cuivre / Pièces de Bronze)
|
||||
// Conversion selon le lore Mournblade :
|
||||
// 1 SA (Sou d'Argent / Pièce d'Argent) = 10 PB (Pièces de Bronze / Sous de Cuivre)
|
||||
// 1 PO (Pièce d'Or) = 10 SA = 100 PB
|
||||
// Donc : 1 PA (Pièce d'Argent) = 10 SC, 1 PO (Pièce d'Or) = 100 SC
|
||||
static calculateItemValueSC(prixpo, prixca, prixsc) {
|
||||
const po = parseInt(prixpo) || 0;
|
||||
const ca = parseInt(prixca) || 0;
|
||||
const sc = parseInt(prixsc) || 0;
|
||||
return po * 100 + ca * 10 + sc;
|
||||
}
|
||||
|
||||
// Helper Handlebars pour les templates
|
||||
Handlebars.registerHelper('calculateItemValueSC', function (prixpo, prixca, prixsc) {
|
||||
|
||||
Reference in New Issue
Block a user