add panic die theme + custom themes
This commit is contained in:
+13
-11
@@ -687,30 +687,36 @@ export class MothershipActor extends Actor {
|
||||
//central table rolling function | TAKES 'W36WFIpCfMknKgHy','1d10','low',true,true,41,'<' | RETURNS chat message showing roll table result
|
||||
async rollTable(tableId,rollString,aimFor,zeroBased,checkCrit,rollAgainst,comparison) {
|
||||
//init vars
|
||||
let tableData = null;
|
||||
let currentLocation = '';
|
||||
let tableLocation = '';
|
||||
let messageTemplate = ``;
|
||||
let messageContent = ``;
|
||||
let msgDesc = ``;
|
||||
let flavorText = ``;
|
||||
let chatId = randomID();
|
||||
let rollTarget = null;
|
||||
let valueAddress = [];
|
||||
//load data about this table
|
||||
//find where this table is located
|
||||
//get current compendium
|
||||
let compendium = game.packs;
|
||||
//loop through each compendium
|
||||
compendium.forEach(function(pack){
|
||||
//is this a pack of rolltables?
|
||||
if (pack.metadata.type === 'RollTable') {
|
||||
//log where we are
|
||||
currentLocation = pack.metadata.id;
|
||||
//loop through each pack to find the right table
|
||||
pack.index.forEach(function(table) {
|
||||
//is this our table?
|
||||
if (table._id === tableId) {
|
||||
//grab the table data
|
||||
tableData = table;
|
||||
//grab the table location
|
||||
tableLocation = currentLocation;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//get table data
|
||||
let tableData = await game.packs.get(tableLocation).getDocument(tableId);
|
||||
//get table name
|
||||
let tableName = tableData.name;
|
||||
//get table name
|
||||
@@ -720,12 +726,6 @@ export class MothershipActor extends Actor {
|
||||
//bounce this request away if certain parameters are NULL
|
||||
//if rollString is STILL blank, redirect player to choose the roll
|
||||
if (!rollString) {
|
||||
//get table data
|
||||
let tableData = await game.packs.get(tableLocation).getDocument(tableId);
|
||||
//get table name
|
||||
let tableName = tableData.name;
|
||||
//get table result
|
||||
let tableDie = tableData.formula.replace('-1','');
|
||||
//run the choose attribute function
|
||||
let chosenRollType = await this.chooseAdvantage(tableName,tableDie);
|
||||
//set variables
|
||||
@@ -741,8 +741,10 @@ export class MothershipActor extends Actor {
|
||||
//roll the dice
|
||||
//parse the roll string
|
||||
let parsedRollString = this.parseRollString(rollString,aimFor);
|
||||
//set panic die color
|
||||
let dsnTheme = game.settings.get('mosh','panicDieTheme');
|
||||
//roll the dice
|
||||
let rollResult = await new Roll(parsedRollString).evaluate();
|
||||
let rollResult = await new Roll(parsedRollString + '[' + dsnTheme + ']').evaluate();
|
||||
//interpret the results
|
||||
let parsedRollResult = this.parseRollResult(rollString,rollResult,zeroBased,checkCrit,rollTarget,comparison);
|
||||
//fetch the table result
|
||||
|
||||
@@ -95,6 +95,34 @@ Hooks.once("ready", async function () {
|
||||
Hooks.on("hotbarDrop", (bar, data, slot) => createMothershipMacro(data, slot));
|
||||
});
|
||||
|
||||
|
||||
//set our custom damage and panic dice for MOSH
|
||||
Hooks.once('diceSoNiceReady', (dice3d) => {
|
||||
dice3d.addColorset(
|
||||
{
|
||||
name: 'damage',
|
||||
description: 'Damage Dice',
|
||||
category: 'Mothership',
|
||||
foreground: '#FFFFFF',
|
||||
background: '#cc2828',
|
||||
outline: 'none',
|
||||
texture: 'none',
|
||||
material: 'metal'
|
||||
},
|
||||
{
|
||||
name: 'panic',
|
||||
description: 'Panic Die',
|
||||
category: 'Mothership',
|
||||
foreground: '#000000',
|
||||
background: '#ffe800',
|
||||
outline: 'none',
|
||||
texture: 'none',
|
||||
material: 'metal'
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
//Hooks.on("preCreateActor", (createData) => {
|
||||
/**
|
||||
* Set default values for new actors' tokens
|
||||
|
||||
+13
-1
@@ -48,7 +48,7 @@ export const registerSettings = function () {
|
||||
game.settings.register('mosh', 'damageDiceTheme', {
|
||||
name: "Damage Dice Theme",
|
||||
hint: "If DiceSoNice is installed, what theme should be applied to damage dice?",
|
||||
default: "red",
|
||||
default: "damage",
|
||||
scope: 'world',
|
||||
type: String,
|
||||
config: true,
|
||||
@@ -57,6 +57,18 @@ export const registerSettings = function () {
|
||||
}
|
||||
});
|
||||
|
||||
game.settings.register('mosh', 'panicDieTheme', {
|
||||
name: "Panic Die Theme",
|
||||
hint: "If DiceSoNice is installed, what theme should be applied to the panic die?",
|
||||
default: "panic",
|
||||
scope: 'world',
|
||||
type: String,
|
||||
config: true,
|
||||
onChange: value => { // A callback function which triggers when the setting is changed
|
||||
console.log("Panic die theme set to " + value)
|
||||
}
|
||||
});
|
||||
|
||||
game.settings.register('mosh', 'hideWeight', {
|
||||
name: "Hide Weight",
|
||||
hint: "Hide weight in the items list for players and ships?",
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<div class="body">{{{msgDesc}}}</div>
|
||||
</div>
|
||||
{{{parsedRollResult.rollHtml}}}
|
||||
{{#unless parsedRollResult.success}}
|
||||
{{#if parsedRollResult.success}}
|
||||
<div class="description" style="margin-bottom : 20px;">{{{flavorText}}}</div>
|
||||
{{else}}
|
||||
{{#if (compare 'int' tableResult.[0].type '===' 1)}}
|
||||
<ol class="table-results">
|
||||
|
||||
Reference in New Issue
Block a user