v9 support
This commit is contained in:
parent
37b32fdd30
commit
842ebe68a2
@ -139,13 +139,18 @@ export class Misc {
|
||||
}
|
||||
|
||||
static firstConnectedGM() {
|
||||
return game.users.entities.sort(Misc.ascending(u => u.id)).find(u => u.isGM && u.active);
|
||||
if (game.version){
|
||||
return game.users.filter(u => u.isGM && u.active)[0];
|
||||
} else {
|
||||
return game.users.entities.sort(Misc.ascending(u => u.id)).find(u => u.isGM && u.active);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns true pour un seul utilisateur: le premier GM connecté par ordre d'id
|
||||
*/
|
||||
static isUniqueConnectedGM() {
|
||||
console.log(game.user.id, Misc.firstConnectedGM()?.id)
|
||||
return game.user.id == Misc.firstConnectedGM()?.id;
|
||||
}
|
||||
|
||||
|
@ -504,6 +504,7 @@ export class RdDCalendrier extends Application {
|
||||
async showAstrologieEditor() {
|
||||
let calendrierData = duplicate(this.fillCalendrierData());
|
||||
let astrologieArray = [];
|
||||
this.listeNombreAstral = this.listeNombreAstral || [];
|
||||
for (let astralData of this.listeNombreAstral) {
|
||||
astralData.humanDate = this.getDateFromIndex(astralData.index);
|
||||
for (let vf of astralData.valeursFausses) {
|
||||
|
@ -83,7 +83,7 @@ export class RdDCombatManager extends Combat {
|
||||
const currentId = this.combatant._id;
|
||||
// calculate initiative
|
||||
for (let cId = 0; cId < ids.length; cId++) {
|
||||
const combatant = this.getCombatant(ids[cId]);
|
||||
const combatant = this.combatants.get(ids[cId]);
|
||||
//if (!c) return results;
|
||||
|
||||
let rollFormula = formula; // Init per default
|
||||
@ -110,9 +110,13 @@ export class RdDCombatManager extends Combat {
|
||||
}
|
||||
//console.log("Combatat", c);
|
||||
const roll = combatant.getInitiativeRoll(rollFormula);
|
||||
if ( !roll.total) {
|
||||
roll.evaluate( {async: false});
|
||||
}
|
||||
if (roll.total <= 0) roll.total = 0.00;
|
||||
console.log("Compute init for", rollFormula, roll.total);
|
||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: combatant._id, initiative: roll.total }]);
|
||||
console.log("Compute init for", rollFormula, roll.total, combatant);
|
||||
let id = combatant._id || combatant.id;
|
||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: roll.total }]);
|
||||
|
||||
// Send a chat message
|
||||
let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");
|
||||
@ -253,7 +257,7 @@ export class RdDCombatManager extends Combat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static incDecInit(combatantId, incDecValue) {
|
||||
const combatant = game.combat.getCombatant(combatantId);
|
||||
const combatant = game.combat.combatants.get(combatantId);
|
||||
let initValue = combatant.initiative + incDecValue;
|
||||
game.combat.setInitiative(combatantId, initValue);
|
||||
}
|
||||
@ -278,7 +282,7 @@ export class RdDCombatManager extends Combat {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static rollInitiativeCompetence(combatantId, arme) {
|
||||
const combatant = game.combat.getCombatant(combatantId);
|
||||
const combatant = game.combat.combatants.get(combatantId);
|
||||
if (combatant.actor == undefined) {
|
||||
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`)
|
||||
return [];
|
||||
@ -344,7 +348,7 @@ export class RdDCombatManager extends Combat {
|
||||
/* -------------------------------------------- */
|
||||
static displayInitiativeMenu(html, combatantId) {
|
||||
console.log("Combatant ; ", combatantId);
|
||||
const combatant = game.combat.getCombatant(combatantId);
|
||||
const combatant = game.combat.combatants.get(combatantId);
|
||||
let armesList = RdDCombatManager.buildListeActionsCombat(combatant);
|
||||
|
||||
// Build the relevant submenu
|
||||
|
@ -1062,6 +1062,7 @@ ul, li {
|
||||
/* Sidebar CSS */
|
||||
#sidebar {
|
||||
font-size: 1rem;
|
||||
width:min-content;
|
||||
background: rgb(105,85,65) url(img/bg_sid_dark.webp) no-repeat right bottom;
|
||||
background-position: 100%;
|
||||
color: rgba(220,220,220,0.75);
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "1.5.48",
|
||||
"version": "1.5.49",
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"minimumCoreVersion": "0.8.0",
|
||||
"compatibleCoreVersion": "0.8.9",
|
||||
|
Loading…
Reference in New Issue
Block a user