diff --git a/languages/en.json b/languages/en.json index 0565542..78c64f5 100644 --- a/languages/en.json +++ b/languages/en.json @@ -17,5 +17,11 @@ "bossbar.settings.cameraPan.hint":"When enabling the healthbars pan the camera to the token. When selecting multiple tokens the last one will be the one the camera pans to", "bossbar.settings.tempBarColor.name":"Temporary healthbar color", "bossbar.settings.tempBarColor.hint":"Set color for the temporary healthbar that shows when damage is taken", - "bossbar.settings.tempBarColor.label":"Color Picker" + "bossbar.settings.tempBarColor.label":"Color Picker", + "bossbar.settings.position.name":"Position", + "bossbar.settings.position.hint":"Position of the boss bars. Webcam positioning options require webcams to be active.", + "bossbar.settings.position.opt0":"Top (default)", + "bossbar.settings.position.opt1":"Bottom (above webcams)", + "bossbar.settings.position.opt2":"Bottom (below webcams)", + "bossbar.settings.position.opt3":"In player List" } \ No newline at end of file diff --git a/scripts/BossBar.js b/scripts/BossBar.js index b5da9b2..258d9fa 100644 --- a/scripts/BossBar.js +++ b/scripts/BossBar.js @@ -4,23 +4,28 @@ class BossBar { this.token; this.bgPath = game.settings.get("bossbar", "backgroundPath"); this.fgPath = game.settings.get("bossbar", "foregroundPath"); - this.tempBarColor = game.settings.get("bossbar", "tempBarColor") - this.textSize = game.settings.get("bossbar", "textSize") + this.tempBarColor = game.settings.get("bossbar", "tempBarColor"); + this.textSize = game.settings.get("bossbar", "textSize"); + this.position = game.settings.get("bossbar", "position"); } - static async create(token,render = true) { + static async create(token, render = true) { let instance = new BossBar(); instance.actor = token.actor; - instance.token = token - let bgFlag = token.document.getFlag("bossbar", "bgTex") - let fgFlag = token.document.getFlag("bossbar", "fgTex") - if(bgFlag) instance.bgPath = bgFlag - if(fgFlag) instance.fgPath = fgFlag - this.addBossBar(instance) + instance.token = token; + let bgFlag = token.document.getFlag("bossbar", "bgTex"); + let fgFlag = token.document.getFlag("bossbar", "fgTex"); + if (bgFlag) instance.bgPath = bgFlag; + if (fgFlag) instance.fgPath = fgFlag; + this.addBossBar(instance); if (render) instance.draw(game.settings.get("bossbar", "barHeight")); - if (game.user.isGM){ - let oldBars = canvas.scene.getFlag("bossbar", "bossBarActive") - if(Array.isArray(oldBars)){oldBars.push(token.id)}else{oldBars=[token.id]} + if (game.user.isGM) { + let oldBars = canvas.scene.getFlag("bossbar", "bossBarActive"); + if (Array.isArray(oldBars)) { + oldBars.push(token.id); + } else { + oldBars = [token.id]; + } await canvas.scene.setFlag("bossbar", "bossBarActive", oldBars); } this.hookId = Hooks.on("updateActor", (actor, updates) => { @@ -35,19 +40,49 @@ class BossBar { } draw(h) { - if($("body").find(`div[id="bossBar-${this.id}"]`).length > 0) return - $("#navigation").append( - `