Commit 9bc76817 authored by Brunhine's avatar Brunhine
Browse files

v2.6.1

Fixes #12
Fixes #13
parent 6ec88eb6
Pipeline #149884252 passed with stage
in 54 seconds
# 2.6.1
- Now properly integrates with Combat Utility Belt's 'Hide NPC Names' option
- Fix for multiple turn change messages when a combatant is removed from combat
# 2.6.0
- Now supports hex grids properly
- New feature: Setting to announce turn changes with a chat message
......
......@@ -3,7 +3,7 @@
"title": "Turn Marker",
"description": "Displays a (optionally animated) marker on the token who's active turn it is.",
"author": "Brunhine",
"version": "2.6.0",
"version": "2.6.1",
"minimumCoreVersion": "0.5.6",
"compatibleCoreVersion": "0.6.0",
"esmodules": [
......@@ -12,5 +12,5 @@
"scripts": [],
"url": "https://gitlab.com/brunhine/foundry-turnmarker",
"manifest": "https://gitlab.com/brunhine/foundry-turnmarker/raw/master/turnmarker/module.json",
"download": "https://gitlab.com/brunhine/foundry-turnmarker/-/jobs/artifacts/2.6.0/raw/turnmarker.zip?job=build"
"download": "https://gitlab.com/brunhine/foundry-turnmarker/-/jobs/artifacts/2.6.1/raw/turnmarker.zip?job=build"
}
\ No newline at end of file
export class Chatter {
static sendTurnMessage(combatant) {
let players = [];
combatant.players.forEach(player => {
players.push(player.name);
});
if (players.length == 0) players.push("GM");
ChatMessage.create({
speaker: { actor: combatant.actor },
//speaker: { actor: {}, alias: 'Turn Marker' },
content:
`<div class="flexrow"><div style="flex:3;">
<img src="${combatant.img}" style="border: none;">
</div>
<div style="flex: 12;">
<h2>${combatant.name}'s Turn</h2>
<p>${players.join(' - ')}</p>
</div>
</div><em>Turn Marker</em>`
});
}
}
\ No newline at end of file
......@@ -2,9 +2,11 @@ import { Settings } from './module/settings.js';
import { Marker } from './module/marker.js';
import { MarkerAnimation } from './module/markeranimation.js';
import { firstGM } from './module/utils.js';
import { Chatter } from './module/chatter.js';
let animator;
let markerId;
let lastTurn = '';
Hooks.on('ready', async () => {
Settings.registerSettings();
......@@ -33,29 +35,15 @@ Hooks.on('createTile', (scene, tile) => {
});
Hooks.on('updateCombat', async (combat, update) => {
if (update && game.user.isGM && game.userId == firstGM()) {
if (update && lastTurn != combat.combatant._id && game.user.isGM && game.userId == firstGM()) {
lastTurn = combat.combatant._id;
if (combat && combat.combatant) {
let tile = canvas.tiles.placeables.find(t => t.data.flags.turnMarker == true);
let result = await Marker.placeMarker(combat.combatant.token._id, (tile && tile.id) || undefined);
markerId = result.markerId;
animator = result.animator;
if (Settings.shouldAnnounceTurns() && !combat.combatant.hidden) {
let players = [];
combat.combatant.players.forEach(player => {
players.push(player.name);
});
if (players.length == 0) players.push("GM");
ChatMessage.create({
content:
`<div class="flexrow"><div style="flex:3;">
<img src="${combat.combatant.img}" style="border: none;">
</div>
<div style="flex: 12;">
<h2>${combat.combatant.name}'s Turn</h2>
<p>${players.join(' - ')}</p>
</div>
</div><em>Turn Marker</em>`
});
Chatter.sendTurnMessage(combat.combatant);
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment