This commit is contained in:
2022-09-06 23:52:21 +02:00
parent e257b6fbee
commit 59613c3bf8
39 changed files with 228 additions and 220 deletions

View File

@ -76,12 +76,14 @@ export class RdDActorSheet extends ActorSheet {
surEncombrementMessage: this.actor.getMessageSurEncombrement()
};
/* TODO - TO FIX for v10
formData.competences.forEach(item => {
console.log("ITEM1", item)
item.visible = this.options.recherche
? RdDItemCompetence.nomContientTexte(item, this.options.recherche.text)
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value);
});
});*/
Object.values(formData.data.carac).forEach(c => {
RdDCarac.levelUp(c);
@ -130,9 +132,9 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */
async _onDropActor(event, dragData) {
console.log("_onDropActor", this.actor.id, dragData);
this.actor.addSubActeur(dragData.id || dragData.data._id);
super._onDropActor(event, dragData);
console.log("_onDropActor", this.actor.id, dragData)
this.actor.addSubActeur(dragData.id || dragData.data._id)
super._onDropActor(event, dragData)
}
/* -------------------------------------------- */

View File

@ -155,14 +155,14 @@ export class RdDCombatManager extends Combat {
// Gestion des armes 1/2 mains
let actionsArme = [];
for (const arme of armes) {
let action = duplicate(Misc.data(arme));
let action = duplicate(arme)
if (action.system.equipe) {
let compData = competences.find(c => c.name == action.system.competence)
actionsArme.push(action);
action.action = 'attaque';
action.system.dommagesReels = Number(action.system.dommages);
action.system.niveau = compData.data.niveau;
action.system.niveau = compData.system.niveau;
action.system.initiative = RdDCombatManager.calculInitiative(compData.system.niveau, carac[compData.system.defaut_carac].value);
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
if (action.system.unemain && !action.system.deuxmains) {

View File

@ -11,11 +11,18 @@ export class RdDHotbar {
static initDropbar( ) {
Hooks.on("hotbarDrop", async (bar, documentData, slot) => {
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
if (documentData.type == "Item") {
if (documentData.data.type != "arme" && documentData.data.type != "competence" )
let item = fromUuidSync(documentData.uuid)
if (item == undefined) {
item = this.actor.items.get( documentData.uuid )
}
console.log( "DROP", documentData, item)
if (!item || (item.type != "arme" && item.type != "competence" ) ) {
return
let item = documentData.data
}
let command = `game.system.rdd.RdDHotbar.rollMacro("${item.name}", "${item.type}");`;
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command));
if (!macro) {
@ -28,6 +35,7 @@ export class RdDHotbar {
}
game.user.assignHotbarMacro(macro, slot);
}
// Create a macro to open the actor sheet of the actor dropped on the hotbar
else if (documentData.type == "Actor") {
let actor = game.actors.get(documentData.id);
@ -35,7 +43,7 @@ export class RdDHotbar {
let macro = game.macros.contents.find(m => (m.name === actor.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: actor.data.name,
name: actor.name,
type: "script",
img: actor.data.img,
command: command
@ -45,12 +53,12 @@ export class RdDHotbar {
}
// Create a macro to open the journal sheet of the journal dropped on the hotbar
else if (documentData.type == "JournalEntry") {
let journal = game.journal.get(documentData.id);
let journal = fromUuidSync(documentData.uuid)
let command = `game.journal.get("${documentData.id}").sheet.render(true)`
let macro = game.macros.contents.find(m => (m.name === journal.name) && (m.command === command));
if (!macro) {
macro = await Macro.create({
name: journal.data.name,
name: journal.name,
type: "script",
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp",
command: command

View File

@ -248,7 +248,7 @@ export class RdDUtility {
if (b.name.includes("Extérieur")) return 1;
return a.name.localeCompare(b.name);
}
if (a.data.categorie.startsWith("melee") && b.data.categorie.startsWith("melee")) {
if (a.system.categorie.startsWith("melee") && b.system.categorie.startsWith("melee")) {
if (a.name.includes("Corps")) return -1;
if (b.name.includes("Corps")) return 1;
if (a.name.includes("Dague")) return -1;
@ -475,7 +475,7 @@ export class RdDUtility {
objet.niveau = profondeur;
const isConteneur = objet.type == 'conteneur';
const isOuvert = isConteneur && this.getAfficheContenu(objet._id);
const isVide = isConteneur && Misc.templateData(objet).contenu.length == 0;
const isVide = isConteneur && objet.system.contenu.length == 0;
const conteneur = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-item.html']({
item: objet,
vide: isVide,