Working on 0.8.x
- entities -> contents - RnK button black if no action left
This commit is contained in:
@@ -42,7 +42,7 @@ export class CombatL5r5e extends Combat {
|
||||
// Get score for each combatant
|
||||
const updatedCombatants = [];
|
||||
for (const combatantId of ids) {
|
||||
const combatant = game.combat.combatants.find((c) => c._id === combatantId);
|
||||
const combatant = game.combat.combatants.find((c) => c.id === combatantId);
|
||||
|
||||
// Skip if combatant already have a initiative value
|
||||
if (!messageOptions.rerollInitiative && (!combatant || !combatant.actor)) {
|
||||
@@ -124,13 +124,13 @@ export class CombatL5r5e extends Combat {
|
||||
}
|
||||
|
||||
updatedCombatants.push({
|
||||
_id: combatant._id,
|
||||
_id: combatant.id,
|
||||
initiative: initiative,
|
||||
});
|
||||
}
|
||||
|
||||
// Update all combatants at once
|
||||
await this.updateEmbeddedEntity("Combatant", updatedCombatants);
|
||||
await this.updateEmbeddedDocuments("Combatant", updatedCombatants);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ export class DicePickerDialog extends FormApplication {
|
||||
|
||||
let command = `new game.l5r5e.DicePickerDialog(${JSON.stringify(params)}).render(true);`;
|
||||
|
||||
let macro = game.macros.entities.find((m) => m.data.name === name && m.data.command === command);
|
||||
let macro = game.macros.contents.find((m) => m.data.name === name && m.data.command === command);
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: name,
|
||||
@@ -540,18 +540,6 @@ export class DicePickerDialog extends FormApplication {
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for slot (Fix for FVTT, will be fixed)
|
||||
// slot = false will normally do the 1st available, but always return 0
|
||||
// TODO see when issue is closed to remove these lines and use "assignHotbarMacro(macro, false)"
|
||||
// https://gitlab.com/foundrynet/foundryvtt/-/issues/4382
|
||||
const slot = Array.fromRange(50).find((i) => {
|
||||
if (i < 1) {
|
||||
return false;
|
||||
}
|
||||
return !(i in game.user.data.hotbar);
|
||||
});
|
||||
|
||||
// return game.user.assignHotbarMacro(macro, false); // 1st available
|
||||
return game.user.assignHotbarMacro(macro, slot);
|
||||
return game.user.assignHotbarMacro(macro, "auto"); // 1st available
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export class GmToolsDialog extends FormApplication {
|
||||
* Do not close this dialog
|
||||
* @override
|
||||
*/
|
||||
close() {
|
||||
async close(options = {}) {
|
||||
// TODO better implementation needed : see KeyboardManager._onEscape(event, up, modifiers)
|
||||
// This windows is always open, so esc key si stuck at step 2 : Object.keys(ui.windows).length > 0
|
||||
// Case 3 (GM) - release controlled objects
|
||||
@@ -180,7 +180,7 @@ export class GmToolsDialog extends FormApplication {
|
||||
return;
|
||||
}
|
||||
|
||||
game.actors.entities.forEach((actor) => {
|
||||
game.actors.contents.forEach((actor) => {
|
||||
switch (type) {
|
||||
case "sleep":
|
||||
// Remove 'water x2' fatigue points
|
||||
|
||||
@@ -107,11 +107,11 @@ export class RollnKeepDialog extends FormApplication {
|
||||
/**
|
||||
* Render
|
||||
* @param {boolean} force
|
||||
* @param {RenderOptions} options
|
||||
* @param {{left?: number, top?: number, width?: number, height?: number, scale?: number, focus?: boolean, renderContext?: string, renderData?: Object}} options
|
||||
* @returns {Application}
|
||||
* @override
|
||||
*/
|
||||
render(force = null, options = {}) {
|
||||
render(force = false, options = {}) {
|
||||
if (!this._message) {
|
||||
return;
|
||||
}
|
||||
@@ -572,6 +572,7 @@ export class RollnKeepDialog extends FormApplication {
|
||||
roll.l5r5e = {
|
||||
...this.roll.l5r5e,
|
||||
summary: roll.l5r5e.summary,
|
||||
history: this.object.dicesList,
|
||||
};
|
||||
|
||||
// Fill the data
|
||||
@@ -600,7 +601,6 @@ export class RollnKeepDialog extends FormApplication {
|
||||
|
||||
// Add roll & history to message
|
||||
this.roll = roll;
|
||||
this.roll.l5r5e.history = this.object.dicesList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ export class RollL5r5e extends Roll {
|
||||
strife: 0,
|
||||
},
|
||||
history: null,
|
||||
rnkEnded: false,
|
||||
};
|
||||
|
||||
// Parse flavor for stance and skillId
|
||||
@@ -126,6 +127,13 @@ export class RollL5r5e extends Roll {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// RnK Can do some action ?
|
||||
if (this.l5r5e.history) {
|
||||
this.l5r5e.rnkEnded = !this.l5r5e.history[this.l5r5e.history.length - 1].some(
|
||||
(e) => !!e && e.choice === null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,8 +331,6 @@ export class RollL5r5e extends Roll {
|
||||
);
|
||||
messageData.roll = this;
|
||||
|
||||
// TODO Bug on non link pnj : infinity deepClone recursion
|
||||
|
||||
// Either create the message or just return the chat data
|
||||
const message = await ChatMessage.implementation.create(messageData, { rollMode: rMode, temporary: !create });
|
||||
return create ? message : message.data;
|
||||
|
||||
@@ -33,7 +33,7 @@ export class MigrationL5r5e {
|
||||
);
|
||||
|
||||
// Migrate World Actors
|
||||
for (let a of game.actors.entities) {
|
||||
for (let a of game.actors.contents) {
|
||||
try {
|
||||
const updateData = MigrationL5r5e._migrateActorData(a.data);
|
||||
if (!isObjectEmpty(updateData)) {
|
||||
@@ -47,7 +47,7 @@ export class MigrationL5r5e {
|
||||
}
|
||||
|
||||
// Migrate World Items
|
||||
for (let i of game.items.entities) {
|
||||
for (let i of game.items.contents) {
|
||||
try {
|
||||
const updateData = MigrationL5r5e._migrateItemData(i.data);
|
||||
if (!isObjectEmpty(updateData)) {
|
||||
@@ -61,7 +61,7 @@ export class MigrationL5r5e {
|
||||
}
|
||||
|
||||
// Migrate Actor Override Tokens
|
||||
for (let s of game.scenes.entities) {
|
||||
for (let s of game.scenes.contents) {
|
||||
try {
|
||||
const updateData = MigrationL5r5e._migrateSceneData(s.data);
|
||||
if (!isObjectEmpty(updateData)) {
|
||||
@@ -143,7 +143,7 @@ export class MigrationL5r5e {
|
||||
|
||||
// Apply the original locked status for the pack
|
||||
pack.configure({ locked: wasLocked });
|
||||
console.log(`Migrated all ${entity} entities from Compendium ${pack.collection}`);
|
||||
console.log(`Migrated all ${entity} contents from Compendium ${pack.collection}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user