Configurable Rolltable Options

This commit is contained in:
Chris Schmalz
2024-02-10 20:57:55 -08:00
parent e702e6060f
commit 3d4a33a6b0
31 changed files with 414 additions and 62 deletions
+13 -13
View File
@@ -1345,14 +1345,14 @@ export class MothershipActor extends Actor {
if (firstEdition) {
if (androidPanic && this.system.class.value.toLowerCase() === 'android') {
if (useCalm) {
tableId = 'GCtYeCCQVQJ5M6SE';
tableId = game.settings.get('mosh','table1ePanicCalmAndroid');
aimFor = 'low';
zeroBased = true;
checkCrit = true;
rollAgainst = 'system.other.stress.value';
comparison = '<';
} else {
tableId = 'aBnY19jlhPXzibCt';
tableId = game.settings.get('mosh','table1ePanicStressAndroid');
aimFor = 'high';
zeroBased = false;
checkCrit = false;
@@ -1361,14 +1361,14 @@ export class MothershipActor extends Actor {
}
} else {
if (useCalm) {
tableId = 'MOYI6Ntj5OVFYk06';
tableId = game.settings.get('mosh','table1ePanicCalmNormal');
aimFor = 'low';
zeroBased = true;
checkCrit = true;
rollAgainst = 'system.other.stress.value';
comparison = '<';
} else {
tableId = 'ypcoikqHLhnc9tNs';
tableId = game.settings.get('mosh','table1ePanicStressNormal');
aimFor = 'high';
zeroBased = false;
checkCrit = false;
@@ -1379,14 +1379,14 @@ export class MothershipActor extends Actor {
} else {
if (androidPanic && this.system.class.value.toLowerCase() === 'android') {
if (useCalm) {
tableId = 'VW6HQ29T7zClNIZ6';
tableId = game.settings.get('mosh','table0ePanicCalmAndroid');
aimFor = 'low';
zeroBased = true;
checkCrit = true;
rollAgainst = 'system.other.stress.value';
comparison = '<';
} else {
tableId = 'egJ11m2mJM3HBd6d';
tableId = game.settings.get('mosh','table0ePanicStressAndroid');
aimFor = 'high';
zeroBased = false;
checkCrit = false;
@@ -1395,14 +1395,14 @@ export class MothershipActor extends Actor {
}
} else {
if (useCalm) {
tableId = 'kqKpQAXyLTEEyz6Z';
tableId = game.settings.get('mosh','table0ePanicCalmNormal');
aimFor = 'low';
zeroBased = true;
checkCrit = true;
rollAgainst = 'system.other.stress.value';
comparison = '<';
} else {
tableId = '1vCm4ElRPotQXgNB';
tableId = game.settings.get('mosh','table0ePanicStressNormal');
aimFor = 'high';
zeroBased = false;
checkCrit = false;
@@ -1426,7 +1426,7 @@ export class MothershipActor extends Actor {
//set special roll value for use later
specialRoll = tableId;
//assign variables
tableId = 'kqz8GsFVPfjvqO0N';
tableId = game.settings.get('mosh','table1eMaintenance');
zeroBased = true;
checkCrit = true;
rollAgainst = 'system.stats.systems.value';
@@ -2405,7 +2405,7 @@ export class MothershipActor extends Actor {
let compendium = game.packs;
let currentLocation = ``;
let tableLocation = ``;
let tableId = `BsfdIl7CJNs1PViS`;
let tableId = game.settings.get('mosh','table1eBankruptcy');
//loop through each compendium
compendium.forEach(function(pack){
//is this a pack of rolltables?
@@ -3417,17 +3417,17 @@ export class MothershipActor extends Actor {
buttons: {
button1: {
label: `Advantage`,
callback: () => this.rollTable(`UxAjAqUTjYTcCbS8`,`1d10 [+]`,`low`,true,false,null,null),
callback: () => this.rollTable(game.settings.get('mosh','table1eDistressSignal'),`1d10 [+]`,`low`,true,false,null,null),
icon: `<i class="fas fa-angle-double-up"></i>`
},
button2: {
label: `Normal`,
callback: () => this.rollTable(`UxAjAqUTjYTcCbS8`,`1d10`,`low`,true,false,null,null),
callback: () => this.rollTable(game.settings.get('mosh','table1eDistressSignal'),`1d10`,`low`,true,false,null,null),
icon: `<i class="fas fa-minus"></i>`
},
button3: {
label: `Disadvantage`,
callback: () => this.rollTable(`UxAjAqUTjYTcCbS8`,`1d10 [-]`,`low`,true,false,null,null),
callback: () => this.rollTable(game.settings.get('mosh','table1eDistressSignal'),`1d10 [-]`,`low`,true,false,null,null),
icon: `<i class="fas fa-angle-double-down"></i>`
}
}
+1 -1
View File
@@ -166,7 +166,7 @@ export class MothershipShipSheetSBT extends ActorSheet {
const actorData = sheetData.data;
//A script to return the data from a table.
let tableId = 'AqGWwoWXzijFs427';
let tableId = game.settings.get('mosh','table1eMegadamageEffects');
let currentLocation = '';
let tableLocation = '';
//find where this table is located
+150 -1
View File
@@ -1,3 +1,5 @@
import { rolltableConfig } from "./windows/settings-rolltables.js";
export const registerSettings = function () {
game.settings.register('mosh', 'firstEdition', {
@@ -295,4 +297,151 @@ export const registerSettings = function () {
}
});
};
game.settings.registerMenu('mosh', 'rolltableSelector', {
name: "Rolltable Configuration",
label: "Choose Tables",
hint: "Customize which rolltables are used.",
icon: "fa-solid fa-list",
type: rolltableConfig
});
game.settings.register('mosh', 'rolltableSelector', {
scope: 'world',
config: true,
type: Object
});
game.settings.register('mosh', 'table0ePanicStressNormal', {
scope: 'world',
config: false,
type: String,
default: "1vCm4ElRPotQXgNB"
});
game.settings.register('mosh', 'table0ePanicStressAndroid', {
scope: 'world',
config: false,
type: String,
default: "egJ11m2mJM3HBd6d"
});
game.settings.register('mosh', 'table0ePanicCalmNormal', {
scope: 'world',
config: false,
type: String,
default: "kqKpQAXyLTEEyz6Z"
});
game.settings.register('mosh', 'table0ePanicCalmAndroid', {
scope: 'world',
config: false,
type: String,
default: "VW6HQ29T7zClNIZ6"
});
game.settings.register('mosh', 'table1ePanicStressNormal', {
scope: 'world',
config: false,
type: String,
default: "ypcoikqHLhnc9tNs"
});
game.settings.register('mosh', 'table1ePanicStressAndroid', {
scope: 'world',
config: false,
type: String,
default: "aBnY19jlhPXzibCt"
});
game.settings.register('mosh', 'table1ePanicCalmNormal', {
scope: 'world',
config: false,
type: String,
default: "MOYI6Ntj5OVFYk06"
});
game.settings.register('mosh', 'table1ePanicCalmAndroid', {
scope: 'world',
config: false,
type: String,
default: "GCtYeCCQVQJ5M6SE"
});
game.settings.register('mosh', 'table1eWoundBluntForce', {
scope: 'world',
config: false,
type: String,
default: "31YibfjueXuZdNLb"
});
game.settings.register('mosh', 'table1eWoundBleeding', {
scope: 'world',
config: false,
type: String,
default: "ata3fRz3uoPfNCLh"
});
game.settings.register('mosh', 'table1eWoundGunshot', {
scope: 'world',
config: false,
type: String,
default: "XjDU2xFOWEasaZK0"
});
game.settings.register('mosh', 'table1eWoundFireExplosives', {
scope: 'world',
config: false,
type: String,
default: "lqiaWwh5cGcJhvnu"
});
game.settings.register('mosh', 'table1eWoundGoreMassive', {
scope: 'world',
config: false,
type: String,
default: "uVfC1CqYdojaJ7yR"
});
game.settings.register('mosh', 'table0eDeath', {
scope: 'world',
config: false,
type: String,
default: "cZOHlhEJcYGZsQBM"
});
game.settings.register('mosh', 'table1eDeath', {
scope: 'world',
config: false,
type: String,
default: "W36WFIpCfMknKgHy"
});
game.settings.register('mosh', 'table1eDistressSignal', {
scope: 'world',
config: false,
type: String,
default: "UxAjAqUTjYTcCbS8"
});
game.settings.register('mosh', 'table1eMegadamageEffects', {
scope: 'world',
config: false,
type: String,
default: "AqGWwoWXzijFs427"
});
game.settings.register('mosh', 'table1eMaintenance', {
scope: 'world',
config: false,
type: String,
default: "kqz8GsFVPfjvqO0N"
});
game.settings.register('mosh', 'table1eBankruptcy', {
scope: 'world',
config: false,
type: String,
default: "BsfdIl7CJNs1PViS"
});
};
+84
View File
@@ -0,0 +1,84 @@
export class rolltableConfig extends FormApplication {
static get defaultOptions() {
const options = super.defaultOptions;
//options.id = 'sheet-modifiers';
//options.classes = ["mosh", "sheet", "actor", "ship"];
options.id = 'rolltable-modifiers';
options.classes = ["mosh"];
options.template = 'systems/mosh/templates/dialogs/settings-rolltableconfig-dialog.html';
options.width = 800;
options.height = 'auto';
options.resizeable = false;
return options;
}
/**
* Construct and return the data object used to render the HTML template for this form application.
* @return {Object}
*/
getData() {
const tableSelection = super.getData();
tableSelection.table0ePanicStressNormal = game.settings.get("mosh", "table0ePanicStressNormal");
tableSelection.table0ePanicStressAndroid = game.settings.get("mosh", "table0ePanicStressAndroid");
tableSelection.table0ePanicCalmNormal = game.settings.get("mosh", "table0ePanicCalmNormal");
tableSelection.table0ePanicCalmAndroid = game.settings.get("mosh", "table0ePanicCalmAndroid");
tableSelection.table1ePanicStressNormal = game.settings.get("mosh", "table1ePanicStressNormal");
tableSelection.table1ePanicStressAndroid = game.settings.get("mosh", "table1ePanicStressAndroid");
tableSelection.table1ePanicCalmNormal = game.settings.get("mosh", "table1ePanicCalmNormal");
tableSelection.table1ePanicCalmAndroid = game.settings.get("mosh", "table1ePanicCalmAndroid");
tableSelection.table1eWoundBluntForce = game.settings.get("mosh", "table1eWoundBluntForce");
tableSelection.table1eWoundBleeding = game.settings.get("mosh", "table1eWoundBleeding");
tableSelection.table1eWoundGunshot = game.settings.get("mosh", "table1eWoundGunshot");
tableSelection.table1eWoundFireExplosives = game.settings.get("mosh", "table1eWoundFireExplosives");
tableSelection.table1eWoundGoreMassive = game.settings.get("mosh", "table1eWoundGoreMassive");
tableSelection.table0eDeath = game.settings.get("mosh", "table0eDeath");
tableSelection.table1eDeath = game.settings.get("mosh", "table1eDeath");
tableSelection.table1eDistressSignal = game.settings.get("mosh", "table1eDistressSignal");
tableSelection.table1eMegadamageEffects = game.settings.get("mosh", "table1eMegadamageEffects");
tableSelection.table1eMaintenance = game.settings.get("mosh", "table1eMaintenance");
tableSelection.table1eBankruptcy = game.settings.get("mosh", "table1eBankruptcy");
return tableSelection;
}
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Close Button
html.find('.close-button').click(ev => this.close());
}
/**
* This method is called upon form submission after form data is validated
* @param event {Event} The initial triggering submission event
* @param formData {Object} The object of validated form data with which to update the object
* @private
*/
async _updateObject(event, formData) {
await Promise.all([
game.settings.set("mosh", "table0ePanicStressNormal", formData["table0ePanicStressNormal"]),
game.settings.set("mosh", "table0ePanicStressAndroid", formData["table0ePanicStressAndroid"]),
game.settings.set("mosh", "table0ePanicCalmNormal", formData["table0ePanicCalmNormal"]),
game.settings.set("mosh", "table0ePanicCalmAndroid", formData["table0ePanicCalmAndroid"]),
game.settings.set("mosh", "table1ePanicStressNormal", formData["table1ePanicStressNormal"]),
game.settings.set("mosh", "table1ePanicStressAndroid", formData["table1ePanicStressAndroid"]),
game.settings.set("mosh", "table1ePanicCalmNormal", formData["table1ePanicCalmNormal"]),
game.settings.set("mosh", "table1ePanicCalmAndroid", formData["table1ePanicCalmAndroid"]),
game.settings.set("mosh", "table1eWoundBluntForce", formData["table1eWoundBluntForce"]),
game.settings.set("mosh", "table1eWoundBleeding", formData["table1eWoundBleeding"]),
game.settings.set("mosh", "table1eWoundGunshot", formData["table1eWoundGunshot"]),
game.settings.set("mosh", "table1eWoundFireExplosives", formData["table1eWoundFireExplosives"]),
game.settings.set("mosh", "table1eWoundGoreMassive", formData["table1eWoundGoreMassive"]),
game.settings.set("mosh", "table0eDeath", formData["table0eDeath"]),
game.settings.set("mosh", "table1eDeath", formData["table1eDeath"]),
game.settings.set("mosh", "table1eDistressSignal", formData["table1eDistressSignal"]),
game.settings.set("mosh", "table1eMegadamageEffects", formData["table1eMegadamageEffects"]),
game.settings.set("mosh", "table1eMaintenance", formData["table1eMaintenance"]),
game.settings.set("mosh", "table1eBankruptcy", formData["table1eBankruptcy"])
]);
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ export class DLShipMegaDamage extends FormApplication {
const actorData = sheetData.object;
//A script to return the data from a table.
let tableId = 'AqGWwoWXzijFs427';
let tableId = game.settings.get('mosh','table1eMegadamageEffects');
let currentLocation = '';
let tableLocation = '';
//find where this table is located