Added armies in GM monitor

This commit is contained in:
Vlyan
2021-11-19 22:41:53 +01:00
parent 37237d9deb
commit e95a938853
10 changed files with 121 additions and 21 deletions

View File

@@ -2,10 +2,9 @@
## 1.4.0 - Armies & French PoW ## 1.4.0 - Armies & French PoW
- Added Army, Cohort and Fortification sheets. - Added Army, Cohort and Fortification sheets.
- Added Army's view in GM monitor
- Added real icons for Inversion and Mantra. - Added real icons for Inversion and Mantra.
- Added Mantra technique type. - Added Mantra technique type.
- Standardization of "great-clans-presentation" pack name to "core-journal-great-clans-presentation".
- SendToChat now check links validity before adding them.
- Compendiums : - Compendiums :
- PoW: - PoW:
- Updated all French compendiums from official French translation. - Updated all French compendiums from official French translation.
@@ -14,6 +13,8 @@
- Fixed : "Flowering Deceptions" from "Kata" to "Shuji" type. - Fixed : "Flowering Deceptions" from "Kata" to "Shuji" type.
- Added two tables to draw japanese names (1500 males names & 530 females names). - Added two tables to draw japanese names (1500 males names & 530 females names).
- Added some Macros. - Added some Macros.
- Standardization of "great-clans-presentation" pack name to "core-journal-great-clans-presentation".
- SendToChat now check links validity before adding them.
- New NPC changed from "minion" to "adversary" by default. - New NPC changed from "minion" to "adversary" by default.
- 20Q : Fixed line break in techniques label list. - 20Q : Fixed line break in techniques label list.

View File

@@ -143,6 +143,7 @@
}, },
"gm_monitor": { "gm_monitor": {
"title": "GM Monitor", "title": "GM Monitor",
"switch_view": "Switch View",
"honor_glory_status": "H/G/S", "honor_glory_status": "H/G/S",
"focus_vigilance": "Foc./Vig." "focus_vigilance": "Foc./Vig."
}, },

View File

@@ -143,6 +143,7 @@
}, },
"gm_monitor": { "gm_monitor": {
"title": "GM Monitor", "title": "GM Monitor",
"switch_view": "Switch View",
"honor_glory_status": "H/G/S", "honor_glory_status": "H/G/S",
"focus_vigilance": "Foc./Vig." "focus_vigilance": "Foc./Vig."
}, },

View File

@@ -143,6 +143,7 @@
}, },
"gm_monitor": { "gm_monitor": {
"title": "GM Monitor", "title": "GM Monitor",
"switch_view": "Switch View",
"honor_glory_status": "H/G/S", "honor_glory_status": "H/G/S",
"focus_vigilance": "Att./Vig." "focus_vigilance": "Att./Vig."
}, },

View File

@@ -7,6 +7,7 @@ export class GmMonitor extends FormApplication {
* Settings * Settings
*/ */
object = { object = {
view: "characters", // characters|armies
actors: [], 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 * Constructor
* @param {ApplicationOptions} options * @param {ApplicationOptions} options
@@ -72,9 +100,7 @@ export class GmMonitor extends FormApplication {
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
}); });
this.object = { this.object.actors = actors;
actors,
};
} }
/** /**
@@ -97,7 +123,12 @@ export class GmMonitor extends FormApplication {
getData(options = null) { getData(options = null) {
return { return {
...super.getData(options), ...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) { switch (type) {
case "armors": case "armors":
return await this._getTooltipArmors(actor); return this._getTooltipArmors(actor);
case "weapons": case "weapons":
return await this._getTooltipWeapons(actor); return this._getTooltipWeapons(actor);
case "global": 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; return;
} }
// No armies allowed !
if (actor.data.type === "army") {
console.log(`L5R5E | Armies are not supported !`);
return;
}
this.object.actors.push(actor); this.object.actors.push(actor);
return this._saveActorsIds(); 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 * @param {BaseSheetL5r5e} actor
* @return {string} * @return {string}
* @private * @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 * Get weapons informations for this actor
* @param {BaseSheetL5r5e} actor * @param {BaseSheetL5r5e} actor

View File

@@ -80,16 +80,16 @@ export const RegisterHandlebars = function () {
result = a !== b; result = a !== b;
break; break;
case "<": case "<":
result = a < b; result = +a < +b;
break; break;
case "<=": case "<=":
result = a <= b; result = +a <= +b;
break; break;
case ">": case ">":
result = a > b; result = +a > +b;
break; break;
case ">=": case ">=":
result = a >= b; result = +a >= +b;
break; break;
case "&&": case "&&":
result = a && b; result = a && b;

File diff suppressed because one or more lines are too long

View File

@@ -784,6 +784,8 @@ button {
} }
img { img {
border: none; border: none;
min-width: 16px;
min-height: 16px;
max-width: 28px; max-width: 28px;
max-height: 28px; max-height: 28px;
} }

View File

@@ -1,4 +1,6 @@
<form class="l5r5e gm-monitor" autocomplete="off"> <form class="l5r5e gm-monitor" autocomplete="off">
{{#ifCond data.view "==" "characters"}}
{{!-- Characters & Npcs --}}
<table> <table>
<thead> <thead>
<th class="img"></th> <th class="img"></th>
@@ -73,4 +75,44 @@
{{/each}} {{/each}}
</tbody> </tbody>
</table> </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> </form>

View 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>