Added armies in GM monitor
This commit is contained in:
@@ -143,6 +143,7 @@
|
||||
},
|
||||
"gm_monitor": {
|
||||
"title": "GM Monitor",
|
||||
"switch_view": "Switch View",
|
||||
"honor_glory_status": "H/G/S",
|
||||
"focus_vigilance": "Foc./Vig."
|
||||
},
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
},
|
||||
"gm_monitor": {
|
||||
"title": "GM Monitor",
|
||||
"switch_view": "Switch View",
|
||||
"honor_glory_status": "H/G/S",
|
||||
"focus_vigilance": "Foc./Vig."
|
||||
},
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
},
|
||||
"gm_monitor": {
|
||||
"title": "GM Monitor",
|
||||
"switch_view": "Switch View",
|
||||
"honor_glory_status": "H/G/S",
|
||||
"focus_vigilance": "Att./Vig."
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@ export class GmMonitor extends FormApplication {
|
||||
* Settings
|
||||
*/
|
||||
object = {
|
||||
view: "characters", // characters|armies
|
||||
actors: [],
|
||||
};
|
||||
|
||||
@@ -30,6 +31,33 @@ export class GmMonitor extends FormApplication {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Switch View button on top of sheet
|
||||
* @override
|
||||
*/
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
|
||||
// Send To Chat
|
||||
buttons.unshift({
|
||||
label: game.i18n.localize("l5r5e.gm_monitor.switch_view"),
|
||||
class: "switch-view",
|
||||
icon: "fas fa-users",
|
||||
onclick: () =>
|
||||
game.l5r5e.HelpersL5r5e.debounce(
|
||||
"SwitchView-" + this.object.id,
|
||||
() => {
|
||||
this.object.view = this.object.view === "armies" ? "characters" : "armies";
|
||||
this.render(false);
|
||||
},
|
||||
1000,
|
||||
true
|
||||
)(),
|
||||
});
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param {ApplicationOptions} options
|
||||
@@ -72,9 +100,7 @@ export class GmMonitor extends FormApplication {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
this.object = {
|
||||
actors,
|
||||
};
|
||||
this.object.actors = actors;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +123,12 @@ export class GmMonitor extends FormApplication {
|
||||
getData(options = null) {
|
||||
return {
|
||||
...super.getData(options),
|
||||
data: this.object,
|
||||
data: {
|
||||
...this.object,
|
||||
actors: this.object.actors.filter((e) =>
|
||||
this.object.view === "armies" ? e.type === "army" : e.type !== "army"
|
||||
),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -140,11 +171,11 @@ export class GmMonitor extends FormApplication {
|
||||
|
||||
switch (type) {
|
||||
case "armors":
|
||||
return await this._getTooltipArmors(actor);
|
||||
return this._getTooltipArmors(actor);
|
||||
case "weapons":
|
||||
return await this._getTooltipWeapons(actor);
|
||||
return this._getTooltipWeapons(actor);
|
||||
case "global":
|
||||
return await this._getTooltipGlobal(actor);
|
||||
return actor.type === "army" ? this._getTooltipArmiesGlobal(actor) : this._getTooltipGlobal(actor);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -173,12 +204,6 @@ export class GmMonitor extends FormApplication {
|
||||
return;
|
||||
}
|
||||
|
||||
// No armies allowed !
|
||||
if (actor.data.type === "army") {
|
||||
console.log(`L5R5E | Armies are not supported !`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.object.actors.push(actor);
|
||||
|
||||
return this._saveActorsIds();
|
||||
@@ -236,7 +261,7 @@ export class GmMonitor extends FormApplication {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tooltips informations for this actor
|
||||
* Get tooltips informations for this character
|
||||
* @param {BaseSheetL5r5e} actor
|
||||
* @return {string}
|
||||
* @private
|
||||
@@ -263,6 +288,21 @@ export class GmMonitor extends FormApplication {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tooltips informations for this army
|
||||
* @param {BaseSheetL5r5e} actor
|
||||
* @return {string}
|
||||
* @private
|
||||
*/
|
||||
async _getTooltipArmiesGlobal(actor) {
|
||||
const data = actor.data.data;
|
||||
|
||||
// *** Template ***
|
||||
return renderTemplate(`${CONFIG.l5r5e.paths.templates}gm/monitor-tooltips/global-armies.html`, {
|
||||
actorData: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get weapons informations for this actor
|
||||
* @param {BaseSheetL5r5e} actor
|
||||
|
||||
@@ -80,16 +80,16 @@ export const RegisterHandlebars = function () {
|
||||
result = a !== b;
|
||||
break;
|
||||
case "<":
|
||||
result = a < b;
|
||||
result = +a < +b;
|
||||
break;
|
||||
case "<=":
|
||||
result = a <= b;
|
||||
result = +a <= +b;
|
||||
break;
|
||||
case ">":
|
||||
result = a > b;
|
||||
result = +a > +b;
|
||||
break;
|
||||
case ">=":
|
||||
result = a >= b;
|
||||
result = +a >= +b;
|
||||
break;
|
||||
case "&&":
|
||||
result = a && b;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -784,6 +784,8 @@ button {
|
||||
}
|
||||
img {
|
||||
border: none;
|
||||
min-width: 16px;
|
||||
min-height: 16px;
|
||||
max-width: 28px;
|
||||
max-height: 28px;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<form class="l5r5e gm-monitor" autocomplete="off">
|
||||
{{#ifCond data.view "==" "characters"}}
|
||||
{{!-- Characters & Npcs --}}
|
||||
<table>
|
||||
<thead>
|
||||
<th class="img"></th>
|
||||
@@ -73,4 +75,44 @@
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
{{!-- Armies --}}
|
||||
<table>
|
||||
<thead>
|
||||
<th class="img"></th>
|
||||
<th class="name">{{localize 'l5r5e.name'}}</th>
|
||||
<th class="warlord">{{localize 'l5r5e.army.warlord'}}</th>
|
||||
<th class="casualties">{{localize 'l5r5e.army.battle_readiness.casualties'}} / {{localize 'l5r5e.army.battle_readiness.strength'}}</th>
|
||||
<th class="panic">{{localize 'l5r5e.army.battle_readiness.panic'}} / {{localize 'l5r5e.army.battle_readiness.discipline'}}</th>
|
||||
<th class="commander">{{localize 'l5r5e.army.commander'}} {{localize 'l5r5e.gm_monitor.honor_glory_status'}}</th>
|
||||
<th class=""></th>
|
||||
<th class=""></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data.actors as |actor|}}
|
||||
<tr>
|
||||
<td><img class="profile actor-profile" title="{{actor.name}}" src="{{actor.img}}"></td>
|
||||
<td><a data-actor-id="{{actor.id}}" class="actor-sheet-control">{{actor.name}}</a></td>
|
||||
<td>{{actor.data.data.warlord}}</td>
|
||||
<td>
|
||||
<span class="{{#ifCond actor.data.data.battle_readiness.casualties_strength.value '>' actor.data.data.battle_readiness.casualties_strength.max}}badvalue{{/ifCond}}">{{actor.data.data.battle_readiness.casualties_strength.value}}</span>
|
||||
/ {{actor.data.data.battle_readiness.casualties_strength.max}}
|
||||
</td>
|
||||
<td>
|
||||
<span class="{{#ifCond actor.data.data.battle_readiness.panic_discipline.value '>' actor.data.data.battle_readiness.panic_discipline.max}}badvalue{{/ifCond}}">{{actor.data.data.battle_readiness.panic_discipline.value}}</span>
|
||||
/ {{actor.data.data.battle_readiness.panic_discipline.max}}
|
||||
</td>
|
||||
<td>
|
||||
{{actor.data.data.commander}}<br>
|
||||
<span class="{{#ifCond actor.data.data.commander_standing.honor '>' 64}}goodvalue{{/ifCond}}{{#ifCond actor.data.data.commander_standing.honor '<' 30}}badvalue{{/ifCond}}">{{actor.data.data.commander_standing.honor}}</span>
|
||||
/ <span class="{{#ifCond actor.data.data.commander_standing.glory '>' 64}}goodvalue{{/ifCond}}{{#ifCond actor.data.data.commander_standing.glory '<' 20}}badvalue{{/ifCond}}">{{actor.data.data.commander_standing.glory}}</span>
|
||||
/ {{actor.data.data.commander_standing.status}}
|
||||
</td>
|
||||
<td><i data-actor-id="{{actor.id}}" data-type="global" class="fas fa-question-circle actor-infos-control"></i></td>
|
||||
<td><span data-actor-id="{{actor.id}}" class="actor-remove-control pointer" title="{{localize 'Delete'}}"><i class="fas fa-trash"></i></span></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/ifCond}}
|
||||
</form>
|
||||
12
system/templates/gm/monitor-tooltips/global-armies.html
Normal file
12
system/templates/gm/monitor-tooltips/global-armies.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<section>
|
||||
<ul>
|
||||
{{!-- warlord --}}
|
||||
<li><b>{{localize 'l5r5e.army.allies_backers'}}</b> : {{actorData.allies_backers}}</li>
|
||||
<li><b>{{localize 'l5r5e.army.purpose_mustering'}}</b> : {{actorData.purpose_mustering}}</li>
|
||||
|
||||
{{!-- commander --}}
|
||||
<li><b>{{localize 'l5r5e.army.commander_abilities'}}</b> : {{actorData.commander_abilities}}</li>
|
||||
<li><b>{{localize 'l5r5e.army.army_abilities'}}</b> : {{actorData.army_abilities}}</li>
|
||||
</ul>
|
||||
<p>{{{actorData.description}}}</p>
|
||||
</section>
|
||||
Reference in New Issue
Block a user