added prepared statut and it's sync
This commit is contained in:
@@ -234,7 +234,9 @@
|
|||||||
"bonds": "Bonds",
|
"bonds": "Bonds",
|
||||||
"npc": {
|
"npc": {
|
||||||
"advantages": "Advantages",
|
"advantages": "Advantages",
|
||||||
"disadvantages": "Disadvantages"
|
"disadvantages": "Disadvantages",
|
||||||
|
"combat": "Combat",
|
||||||
|
"intrigue": "Intrigue"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"skills": {
|
"skills": {
|
||||||
|
|||||||
@@ -234,7 +234,9 @@
|
|||||||
"bonds": "Bonds",
|
"bonds": "Bonds",
|
||||||
"npc": {
|
"npc": {
|
||||||
"advantages": "Ventajas",
|
"advantages": "Ventajas",
|
||||||
"disadvantages": "Desventajas"
|
"disadvantages": "Desventajas",
|
||||||
|
"combat": "Combate",
|
||||||
|
"intrigue": "Intriga"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"skills": {
|
"skills": {
|
||||||
|
|||||||
@@ -234,7 +234,9 @@
|
|||||||
"bonds": "Liens",
|
"bonds": "Liens",
|
||||||
"npc": {
|
"npc": {
|
||||||
"advantages": "Avantages",
|
"advantages": "Avantages",
|
||||||
"disadvantages": "Désavantages"
|
"disadvantages": "Désavantages",
|
||||||
|
"combat": "Combat",
|
||||||
|
"intrigue": "Intrigue"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"skills": {
|
"skills": {
|
||||||
|
|||||||
@@ -99,12 +99,7 @@ export class ActorL5r5e extends Actor {
|
|||||||
return Actor.updateDocuments([data], context).then(() => {
|
return Actor.updateDocuments([data], context).then(() => {
|
||||||
// Notify the "Gm Monitor" if this actor is watched
|
// Notify the "Gm Monitor" if this actor is watched
|
||||||
if (game.settings.get("l5r5e", "gm-monitor-actors").find((e) => e === this.id)) {
|
if (game.settings.get("l5r5e", "gm-monitor-actors").find((e) => e === this.id)) {
|
||||||
game.l5r5e.sockets.refreshAppId("l5r5e-gm-monitor");
|
game.l5r5e.HelpersL5r5e.refreshLocalAndSocket("l5r5e-gm-monitor");
|
||||||
if (game.user.isGM) {
|
|
||||||
Object.values(ui.windows)
|
|
||||||
.find((e) => e.id === "l5r5e-gm-monitor")
|
|
||||||
?.refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -216,7 +211,7 @@ export class ActorL5r5e extends Actor {
|
|||||||
* Return true if a weapon is equipped
|
* Return true if a weapon is equipped
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
haveWeaponEquipped() {
|
get haveWeaponEquipped() {
|
||||||
return this.items.some((e) => e.type === "weapon" && !!e.data.data.equipped);
|
return this.items.some((e) => e.type === "weapon" && !!e.data.data.equipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +219,7 @@ export class ActorL5r5e extends Actor {
|
|||||||
* Return true if a weapon is readied
|
* Return true if a weapon is readied
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
haveWeaponReadied() {
|
get haveWeaponReadied() {
|
||||||
return this.items.some((e) => e.type === "weapon" && !!e.data.data.equipped && !!e.data.data.readied);
|
return this.items.some((e) => e.type === "weapon" && !!e.data.data.equipped && !!e.data.data.readied);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +227,27 @@ export class ActorL5r5e extends Actor {
|
|||||||
* Return true if a armor is equipped
|
* Return true if a armor is equipped
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
haveArmorEquipped() {
|
get haveArmorEquipped() {
|
||||||
return this.items.some((e) => e.type === "armor" && !!e.data.data.equipped);
|
return this.items.some((e) => e.type === "armor" && !!e.data.data.equipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if this actor is prepared (overridden by global)
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
get isPrepared() {
|
||||||
|
const cfg = {
|
||||||
|
character: game.settings.get("l5r5e", "initiative-prepared-character"),
|
||||||
|
adversary: game.settings.get("l5r5e", "initiative-prepared-adversary"),
|
||||||
|
minion: game.settings.get("l5r5e", "initiative-prepared-minion"),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prepared is a boolean or if null we get the info in the actor
|
||||||
|
let isPrepared = this.data.type === "character" ? cfg.character : cfg[this.data.data.type];
|
||||||
|
if (isPrepared === "null") {
|
||||||
|
isPrepared = this.data.data.prepared ? "true" : "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
return isPrepared;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,6 @@ export class CombatL5r5e extends Combat {
|
|||||||
const cfg = {
|
const cfg = {
|
||||||
difficulty: game.settings.get("l5r5e", "initiative-difficulty-value"),
|
difficulty: game.settings.get("l5r5e", "initiative-difficulty-value"),
|
||||||
difficultyHidden: game.settings.get("l5r5e", "initiative-difficulty-hidden"),
|
difficultyHidden: game.settings.get("l5r5e", "initiative-difficulty-hidden"),
|
||||||
prepared: {
|
|
||||||
character: game.settings.get("l5r5e", "initiative-prepared-character"),
|
|
||||||
adversary: game.settings.get("l5r5e", "initiative-prepared-adversary"),
|
|
||||||
minion: game.settings.get("l5r5e", "initiative-prepared-minion"),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// SkillId from DicePicker or global
|
// SkillId from DicePicker or global
|
||||||
@@ -54,10 +49,7 @@ export class CombatL5r5e extends Combat {
|
|||||||
|
|
||||||
// Prepared is a boolean or if null we get the info in the actor sheet
|
// Prepared is a boolean or if null we get the info in the actor sheet
|
||||||
const isPc = combatant.actor.data.type === "character";
|
const isPc = combatant.actor.data.type === "character";
|
||||||
let isPrepared = isPc ? cfg.prepared.character : cfg.prepared[data.type];
|
const isPrepared = combatant.isPrepared;
|
||||||
if (isPrepared === "null") {
|
|
||||||
isPrepared = data.prepared ? "true" : "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
// A character’s initiative value is based on their state of preparedness when the conflict began.
|
// A character’s initiative value is based on their state of preparedness when the conflict began.
|
||||||
// If the character was ready for the conflict, their base initiative value is their focus attribute.
|
// If the character was ready for the conflict, their base initiative value is their focus attribute.
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class GmMonitor extends FormApplication {
|
|||||||
classes: ["l5r5e", "gm-monitor"],
|
classes: ["l5r5e", "gm-monitor"],
|
||||||
template: CONFIG.l5r5e.paths.templates + "gm/gm-monitor.html",
|
template: CONFIG.l5r5e.paths.templates + "gm/gm-monitor.html",
|
||||||
title: game.i18n.localize("l5r5e.gm_monitor.title"),
|
title: game.i18n.localize("l5r5e.gm_monitor.title"),
|
||||||
width: 700,
|
width: 800,
|
||||||
height: 300,
|
height: 300,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
closeOnSubmit: false,
|
closeOnSubmit: false,
|
||||||
@@ -175,8 +175,7 @@ export class GmMonitor extends FormApplication {
|
|||||||
|
|
||||||
this.object.actors.push(actor[0]);
|
this.object.actors.push(actor[0]);
|
||||||
|
|
||||||
await this._saveActorsIds();
|
return this._saveActorsIds();
|
||||||
return this.refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -227,8 +226,7 @@ export class GmMonitor extends FormApplication {
|
|||||||
|
|
||||||
this.object.actors = this.object.actors.filter((e) => e.id !== id);
|
this.object.actors = this.object.actors.filter((e) => e.id !== id);
|
||||||
|
|
||||||
await this._saveActorsIds();
|
return this._saveActorsIds();
|
||||||
return this.refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -353,6 +353,17 @@ export class HelpersL5r5e {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a refresh to socket, and on local windows app
|
||||||
|
* @param {String} appId Application name
|
||||||
|
*/
|
||||||
|
static refreshLocalAndSocket(appId) {
|
||||||
|
game.l5r5e.sockets.refreshAppId(appId);
|
||||||
|
Object.values(ui.windows)
|
||||||
|
.find((e) => e.id === appId)
|
||||||
|
?.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the Xp cost for cursus and total
|
* Compute the Xp cost for cursus and total
|
||||||
* @param {ItemL5r5e|ItemL5r5e[]} itemsList Item Data
|
* @param {ItemL5r5e|ItemL5r5e[]} itemsList Item Data
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ export const RegisterSettings = function () {
|
|||||||
config: false,
|
config: false,
|
||||||
type: String,
|
type: String,
|
||||||
default: "null",
|
default: "null",
|
||||||
|
onChange: () => game.l5r5e.HelpersL5r5e.refreshLocalAndSocket("l5r5e-gm-monitor"),
|
||||||
});
|
});
|
||||||
game.settings.register("l5r5e", "initiative-prepared-adversary", {
|
game.settings.register("l5r5e", "initiative-prepared-adversary", {
|
||||||
name: "Initiative NPC adversary are prepared or not",
|
name: "Initiative NPC adversary are prepared or not",
|
||||||
@@ -92,6 +93,7 @@ export const RegisterSettings = function () {
|
|||||||
config: false,
|
config: false,
|
||||||
type: String,
|
type: String,
|
||||||
default: "null",
|
default: "null",
|
||||||
|
onChange: () => game.l5r5e.HelpersL5r5e.refreshLocalAndSocket("l5r5e-gm-monitor"),
|
||||||
});
|
});
|
||||||
game.settings.register("l5r5e", "initiative-prepared-minion", {
|
game.settings.register("l5r5e", "initiative-prepared-minion", {
|
||||||
name: "Initiative NPC minion are prepared or not",
|
name: "Initiative NPC minion are prepared or not",
|
||||||
@@ -99,6 +101,7 @@ export const RegisterSettings = function () {
|
|||||||
config: false,
|
config: false,
|
||||||
type: String,
|
type: String,
|
||||||
default: "null",
|
default: "null",
|
||||||
|
onChange: () => game.l5r5e.HelpersL5r5e.refreshLocalAndSocket("l5r5e-gm-monitor"),
|
||||||
});
|
});
|
||||||
|
|
||||||
/* ------------------------------------ */
|
/* ------------------------------------ */
|
||||||
@@ -106,10 +109,10 @@ export const RegisterSettings = function () {
|
|||||||
/* ------------------------------------ */
|
/* ------------------------------------ */
|
||||||
game.settings.register("l5r5e", "gm-monitor-actors", {
|
game.settings.register("l5r5e", "gm-monitor-actors", {
|
||||||
name: "Gm Monitor",
|
name: "Gm Monitor",
|
||||||
scope: "world", // for sync between gm
|
scope: "world",
|
||||||
config: false,
|
config: false,
|
||||||
type: Array,
|
type: Array,
|
||||||
default: [],
|
default: [],
|
||||||
onChange: () => game.l5r5e.sockets.refreshAppId("l5r5e-gm-monitor"),
|
onChange: () => game.l5r5e.HelpersL5r5e.refreshLocalAndSocket("l5r5e-gm-monitor"),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -782,10 +782,10 @@ button {
|
|||||||
max-height: 28px;
|
max-height: 28px;
|
||||||
}
|
}
|
||||||
.goodvalue {
|
.goodvalue {
|
||||||
color: rgba(0, 128, 0, 0.75);
|
color: #4e8c69;
|
||||||
}
|
}
|
||||||
.badvalue {
|
.badvalue {
|
||||||
color: $red-dice;
|
color: #ab2a00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// hide "search anywhere" draggable icon
|
// hide "search anywhere" draggable icon
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
</li>
|
</li>
|
||||||
{{!-- Martial --}}
|
{{!-- Martial --}}
|
||||||
<li>
|
<li>
|
||||||
<i class="i_bushi"></i>
|
<i class="i_bushi" title="{{localize 'l5r5e.social.npc.combat'}}"></i>
|
||||||
<input class="centered-input select-on-focus" type="number" name="data.conflict_rank.martial" value="{{data.data.conflict_rank.martial}}" data-dtype="Number" min="0" placeholder="0"/>
|
<input class="centered-input select-on-focus" type="number" name="data.conflict_rank.martial" value="{{data.data.conflict_rank.martial}}" data-dtype="Number" min="0" placeholder="0"/>
|
||||||
</li>
|
</li>
|
||||||
{{!-- Social --}}
|
{{!-- Social --}}
|
||||||
<li>
|
<li>
|
||||||
<i class="i_courtier"></i>
|
<i class="i_courtier" title="{{localize 'l5r5e.social.npc.intrigue'}}"></i>
|
||||||
<input class="centered-input select-on-focus" type="number" name="data.conflict_rank.social" value="{{data.data.conflict_rank.social}}" data-dtype="Number" min="0" placeholder="0"/>
|
<input class="centered-input select-on-focus" type="number" name="data.conflict_rank.social" value="{{data.data.conflict_rank.social}}" data-dtype="Number" min="0" placeholder="0"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -4,9 +4,10 @@
|
|||||||
<th class="img"></th>
|
<th class="img"></th>
|
||||||
<th class="name">{{localize 'l5r5e.name'}}</th>
|
<th class="name">{{localize 'l5r5e.name'}}</th>
|
||||||
<th class="stance"><i class="i_earth"></i></th>
|
<th class="stance"><i class="i_earth"></i></th>
|
||||||
|
<th class="prepared"><i class="fas prepared-icon-true"></i></th>
|
||||||
<th class="weapon"><i class="fas fa-fan"></i></th>
|
<th class="weapon"><i class="fas fa-fan"></i></th>
|
||||||
<th class="armor"><i class="fas fa-user-shield"></i></th>
|
<th class="armor"><i class="fas fa-user-shield"></i></th>
|
||||||
<th class="rank"><i class="i_bushi"></i> / <i class="i_courtier"></i></th>
|
<th class="rank">{{localize 'l5r5e.rank'}}</th>
|
||||||
<th class="social">{{localize 'l5r5e.gm_monitor.honor_glory_status'}}</th>
|
<th class="social">{{localize 'l5r5e.gm_monitor.honor_glory_status'}}</th>
|
||||||
<th class="fatigue">{{localize 'l5r5e.attributes.fatigue'}}</th>
|
<th class="fatigue">{{localize 'l5r5e.attributes.fatigue'}}</th>
|
||||||
<th class="strife">{{localize 'l5r5e.attributes.strife'}}</th>
|
<th class="strife">{{localize 'l5r5e.attributes.strife'}}</th>
|
||||||
@@ -21,17 +22,29 @@
|
|||||||
<td><img class="profile actor-profile" title="{{actor.name}}" src="{{actor.img}}"></td>
|
<td><img class="profile actor-profile" title="{{actor.name}}" src="{{actor.img}}"></td>
|
||||||
<td>
|
<td>
|
||||||
<a data-actor-id="{{actor.id}}" class="actor-sheet-control">{{actor.name}}</a>
|
<a data-actor-id="{{actor.id}}" class="actor-sheet-control">{{actor.name}}</a>
|
||||||
{{#if actor.data.data.attitude}}<br>({{actor.data.data.attitude}}){{/if}}
|
{{#if actor.data.data.attitude}}<p>({{actor.data.data.attitude}})</p>{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td><i data-type="text" data-text="<h2>{{localize 'l5r5e.conflict.stance'}} ({{localizeRing actor.data.data.stance}})</h2>{{localizeStanceTip actor.data.data.stance}}" class="i_{{actor.data.data.stance}} actor-infos-control"></i></td>
|
<td><i data-type="text" data-text="<h2>{{localize 'l5r5e.conflict.stance'}} ({{localizeRing actor.data.data.stance}})</h2>{{localizeStanceTip actor.data.data.stance}}" class="i_{{actor.data.data.stance}} actor-infos-control"></i></td>
|
||||||
|
<td><i class="fa fas prepared-icon-{{actor.isPrepared}} {{#ifCond actor.isPrepared '==' 'false'}}badvalue{{/ifCond}}" title="{{localize (localize 'l5r5e.conflict.initiative.prepared_{value}' value=actor.isPrepared)}}"></i></td>
|
||||||
<td>{{#if actor.haveWeaponEquipped}}<i data-type="weapons" data-actor-id="{{actor.id}}" class="fas fa-fan actor-infos-control {{#if actor.haveWeaponReadied}}badvalue{{/if}}"></i>{{/if}}</td>
|
<td>{{#if actor.haveWeaponEquipped}}<i data-type="weapons" data-actor-id="{{actor.id}}" class="fas fa-fan actor-infos-control {{#if actor.haveWeaponReadied}}badvalue{{/if}}"></i>{{/if}}</td>
|
||||||
<td>{{#if actor.haveArmorEquipped}}<i data-type="armors" data-actor-id="{{actor.id}}" class="fas fa-user-shield actor-infos-control"></i>{{/if}}</td>
|
<td>{{#if actor.haveArmorEquipped}}<i data-type="armors" data-actor-id="{{actor.id}}" class="fas fa-user-shield actor-infos-control"></i>{{/if}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
<p>
|
||||||
{{#if actor.data.data.identity.school_rank}}
|
{{#if actor.data.data.identity.school_rank}}
|
||||||
{{actor.data.data.identity.school_rank}}
|
{{actor.data.data.identity.school_rank}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{actor.data.data.conflict_rank.martial}} / {{actor.data.data.conflict_rank.social}}
|
<i class="i_bushi" title="{{localize 'l5r5e.social.npc.combat'}}"></i> {{actor.data.data.conflict_rank.martial}} <i class="i_courtier" title="{{localize 'l5r5e.social.npc.intrigue'}}"></i> {{actor.data.data.conflict_rank.social}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{#if actor.data.data.rings_affinities}}
|
||||||
|
{{#each actor.data.data.rings_affinities as |ringValue ringId|}}
|
||||||
|
{{#if ringValue}}
|
||||||
|
<i class="i_{{ringId}}" title="{{localizeRing ringId}}"></i> {{ringValue}}
|
||||||
|
{{/if}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="{{#ifCond actor.data.data.social.honor '>' 64}}goodvalue{{/ifCond}}{{#ifCond actor.data.data.social.honor '<' 30}}badvalue{{/ifCond}}">{{actor.data.data.social.honor}}</span>
|
<span class="{{#ifCond actor.data.data.social.honor '>' 64}}goodvalue{{/ifCond}}{{#ifCond actor.data.data.social.honor '<' 30}}badvalue{{/ifCond}}">{{actor.data.data.social.honor}}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user