Working on 0.8.x

- entities -> contents
- RnK button black if no action left
This commit is contained in:
Vlyan
2021-05-03 19:34:30 +02:00
parent 93cfe5bb86
commit c2d2dbb9fe
12 changed files with 37 additions and 35 deletions

View File

@@ -2,6 +2,7 @@
## 1.3.0 - Foundry 0.8.x compatibility ## 1.3.0 - Foundry 0.8.x compatibility
- Updated the System to the new version of Foundry VTT (a lot of things broke) - Updated the System to the new version of Foundry VTT (a lot of things broke)
- RnK button is now black in chat if no actions left in roll.
## 1.2.2 - Before the Change ## 1.2.2 - Before the Change
- Added some custom technique's types by request: Link & Specificity - Added some custom technique's types by request: Link & Specificity

View File

@@ -42,7 +42,7 @@ export class CombatL5r5e extends Combat {
// Get score for each combatant // Get score for each combatant
const updatedCombatants = []; const updatedCombatants = [];
for (const combatantId of ids) { 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 // Skip if combatant already have a initiative value
if (!messageOptions.rerollInitiative && (!combatant || !combatant.actor)) { if (!messageOptions.rerollInitiative && (!combatant || !combatant.actor)) {
@@ -124,13 +124,13 @@ export class CombatL5r5e extends Combat {
} }
updatedCombatants.push({ updatedCombatants.push({
_id: combatant._id, _id: combatant.id,
initiative: initiative, initiative: initiative,
}); });
} }
// Update all combatants at once // Update all combatants at once
await this.updateEmbeddedEntity("Combatant", updatedCombatants); await this.updateEmbeddedDocuments("Combatant", updatedCombatants);
return this; return this;
} }

View File

@@ -524,7 +524,7 @@ export class DicePickerDialog extends FormApplication {
let command = `new game.l5r5e.DicePickerDialog(${JSON.stringify(params)}).render(true);`; 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) { if (!macro) {
macro = await Macro.create({ macro = await Macro.create({
name: name, name: name,
@@ -540,18 +540,6 @@ export class DicePickerDialog extends FormApplication {
return; return;
} }
// Search for slot (Fix for FVTT, will be fixed) return game.user.assignHotbarMacro(macro, "auto"); // 1st available
// 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);
} }
} }

View File

@@ -63,7 +63,7 @@ export class GmToolsDialog extends FormApplication {
* Do not close this dialog * Do not close this dialog
* @override * @override
*/ */
close() { async close(options = {}) {
// TODO better implementation needed : see KeyboardManager._onEscape(event, up, modifiers) // 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 // 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 // Case 3 (GM) - release controlled objects
@@ -180,7 +180,7 @@ export class GmToolsDialog extends FormApplication {
return; return;
} }
game.actors.entities.forEach((actor) => { game.actors.contents.forEach((actor) => {
switch (type) { switch (type) {
case "sleep": case "sleep":
// Remove 'water x2' fatigue points // Remove 'water x2' fatigue points

View File

@@ -107,11 +107,11 @@ export class RollnKeepDialog extends FormApplication {
/** /**
* Render * Render
* @param {boolean} force * @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} * @returns {Application}
* @override * @override
*/ */
render(force = null, options = {}) { render(force = false, options = {}) {
if (!this._message) { if (!this._message) {
return; return;
} }
@@ -572,6 +572,7 @@ export class RollnKeepDialog extends FormApplication {
roll.l5r5e = { roll.l5r5e = {
...this.roll.l5r5e, ...this.roll.l5r5e,
summary: roll.l5r5e.summary, summary: roll.l5r5e.summary,
history: this.object.dicesList,
}; };
// Fill the data // Fill the data
@@ -600,7 +601,6 @@ export class RollnKeepDialog extends FormApplication {
// Add roll & history to message // Add roll & history to message
this.roll = roll; this.roll = roll;
this.roll.l5r5e.history = this.object.dicesList;
} }
/** /**

View File

@@ -33,6 +33,7 @@ export class RollL5r5e extends Roll {
strife: 0, strife: 0,
}, },
history: null, history: null,
rnkEnded: false,
}; };
// Parse flavor for stance and skillId // 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; messageData.roll = this;
// TODO Bug on non link pnj : infinity deepClone recursion
// Either create the message or just return the chat data // Either create the message or just return the chat data
const message = await ChatMessage.implementation.create(messageData, { rollMode: rMode, temporary: !create }); const message = await ChatMessage.implementation.create(messageData, { rollMode: rMode, temporary: !create });
return create ? message : message.data; return create ? message : message.data;

View File

@@ -33,7 +33,7 @@ export class MigrationL5r5e {
); );
// Migrate World Actors // Migrate World Actors
for (let a of game.actors.entities) { for (let a of game.actors.contents) {
try { try {
const updateData = MigrationL5r5e._migrateActorData(a.data); const updateData = MigrationL5r5e._migrateActorData(a.data);
if (!isObjectEmpty(updateData)) { if (!isObjectEmpty(updateData)) {
@@ -47,7 +47,7 @@ export class MigrationL5r5e {
} }
// Migrate World Items // Migrate World Items
for (let i of game.items.entities) { for (let i of game.items.contents) {
try { try {
const updateData = MigrationL5r5e._migrateItemData(i.data); const updateData = MigrationL5r5e._migrateItemData(i.data);
if (!isObjectEmpty(updateData)) { if (!isObjectEmpty(updateData)) {
@@ -61,7 +61,7 @@ export class MigrationL5r5e {
} }
// Migrate Actor Override Tokens // Migrate Actor Override Tokens
for (let s of game.scenes.entities) { for (let s of game.scenes.contents) {
try { try {
const updateData = MigrationL5r5e._migrateSceneData(s.data); const updateData = MigrationL5r5e._migrateSceneData(s.data);
if (!isObjectEmpty(updateData)) { if (!isObjectEmpty(updateData)) {
@@ -143,7 +143,7 @@ export class MigrationL5r5e {
// Apply the original locked status for the pack // Apply the original locked status for the pack
pack.configure({ locked: wasLocked }); pack.configure({ locked: wasLocked });
console.log(`Migrated all ${entity} entities from Compendium ${pack.collection}`); console.log(`Migrated all ${entity} contents from Compendium ${pack.collection}`);
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@@ -16,7 +16,7 @@
} }
button { button {
&.chat-dice-rnk { &.chat-dice-rnk {
cursor: default; cursor: url("../assets/cursors/pointer.webp"), pointer;
color: $white; color: $white;
background: linear-gradient( background: linear-gradient(
$l5r5e-linear-gradient-third, $l5r5e-linear-gradient-third,
@@ -36,6 +36,13 @@
); );
} }
} }
&.chat-dice-rnk-ended {
background: linear-gradient(
$l5r5e-linear-gradient-second,
$l5r5e-linear-gradient-second-dark,
$l5r5e-linear-gradient-second
);
}
} }
.dice-result-rnk { .dice-result-rnk {
background: rgba(0, 0, 255, 0.1); background: rgba(0, 0, 255, 0.1);

View File

@@ -6,8 +6,8 @@
"manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json", "manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json",
"download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.3.0/raw/l5r5e.zip?job=build", "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.3.0/raw/l5r5e.zip?job=build",
"version": "1.3.0", "version": "1.3.0",
"minimumCoreVersion": "0.8.1", "minimumCoreVersion": "0.8.2",
"compatibleCoreVersion": "0.8.1", "compatibleCoreVersion": "0.8.2",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"socket": true, "socket": true,
"author": "Team L5R", "author": "Team L5R",

View File

@@ -21,7 +21,7 @@
{{!-- Strength --}} {{!-- Strength --}}
<select class="attribute-dtype" name="data.rings_affinities.strength.ring"> <select class="attribute-dtype" name="data.rings_affinities.strength.ring">
{{#select data.data.rings_affinities.strength.ring}} {{#select data.data.rings_affinities.strength.ring}}
{{#each data.data.stances as |stance|}} {{#each data.stances as |stance|}}
<option value="{{stance}}">{{localizeRing stance}}</option> <option value="{{stance}}">{{localizeRing stance}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}
@@ -30,7 +30,7 @@
{{!-- Weakness --}} {{!-- Weakness --}}
<select class="attribute-dtype" name="data.rings_affinities.weakness.ring"> <select class="attribute-dtype" name="data.rings_affinities.weakness.ring">
{{#select data.data.rings_affinities.weakness.ring}} {{#select data.data.rings_affinities.weakness.ring}}
{{#each data.data.stances as |stance|}} {{#each data.stances as |stance|}}
<option value="{{stance}}">{{localizeRing stance}}</option> <option value="{{stance}}">{{localizeRing stance}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}

View File

@@ -54,7 +54,7 @@
{{!-- Roll & Keep Button --}} {{!-- Roll & Keep Button --}}
{{^if l5r5e.dicesTypes.std}} {{^if l5r5e.dicesTypes.std}}
<button class="l5r5e chat-dice-rnk">{{localize "l5r5e.chatdices.roll_n_keep"}}</button> <button class="l5r5e chat-dice-rnk {{#if this.l5r5e.rnkEnded}}chat-dice-rnk-ended{{/if}}">{{localize "l5r5e.chatdices.roll_n_keep"}}</button>
{{/if}} {{/if}}
{{#l5r5e.summary}} {{#l5r5e.summary}}