[SalvageUnion] import denizens
This commit is contained in:
@@ -19,6 +19,12 @@ summary{
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
summary > span{
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
details summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -62,6 +68,7 @@ input[type="checkbox"] {
|
||||
.pilot,
|
||||
.mech,
|
||||
.crawler,
|
||||
.denizen,
|
||||
.notes,
|
||||
.settings
|
||||
{
|
||||
@@ -77,6 +84,7 @@ input[type="checkbox"] {
|
||||
.tabstoggle[value="pilot"] ~ div.pilot,
|
||||
.tabstoggle[value="mech"] ~ div.mech,
|
||||
.tabstoggle[value="crawler"] ~ div.crawler,
|
||||
.tabstoggle[value="denizen"] ~ div.denizen,
|
||||
.tabstoggle[value="notes"] ~ div.notes,
|
||||
.tabstoggle[value="settings"] ~ div.settings
|
||||
{
|
||||
@@ -107,6 +115,12 @@ input[type="checkbox"] {
|
||||
.show-crawler:checked ~ button.crawler-button {
|
||||
}
|
||||
|
||||
.show-denizen:not(:checked) ~ button.denizen-button {
|
||||
display:none;
|
||||
}
|
||||
.show-denizen:checked ~ button.denizen-button {
|
||||
}
|
||||
|
||||
.show-notes:not(:checked) ~ button.notes-button {
|
||||
display:none;
|
||||
}
|
||||
@@ -157,6 +171,10 @@ input[type="checkbox"] {
|
||||
margin-right: 7%;
|
||||
}
|
||||
|
||||
.fullsize {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wrapper textarea {
|
||||
padding: 5px;
|
||||
margin-left: 10px;
|
||||
|
||||
+386
-36
@@ -10,6 +10,9 @@
|
||||
<input class="show-crawler" name="attr_is-crawler" type="checkbox" hidden/>
|
||||
<button type="action" name="act_crawler" class="tabs crawler-button">Union Crawler</button>
|
||||
|
||||
<input class="show-denizen" name="attr_is-denizen" type="checkbox" hidden/>
|
||||
<button type="action" name="act_denizen" class="tabs denizen-button">Denizen</button>
|
||||
|
||||
<input class="show-notes" name="attr_show-notes-tab" type="checkbox" hidden/>
|
||||
<button type="action" name="act_notes" class="tabs notes-button">Notes</button>
|
||||
|
||||
@@ -525,9 +528,94 @@
|
||||
|
||||
<h3>Bays</h3>
|
||||
<fieldset class="repeating_bays">
|
||||
<details class="equipment">
|
||||
<details>
|
||||
<summary>
|
||||
<input type="text" name="attr_name" title="Name of the Bay">
|
||||
<input type="text" name="attr_name" class="fullsize" title="Name of the Bay">
|
||||
</summary>
|
||||
<textarea name="attr_details" class="textarea"></textarea>
|
||||
</details>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="denizen">
|
||||
<h2>Denizen
|
||||
<button type="roll" value="&{template:roll}{{name=@{character_name}}}{{roll=[[1d20]]}}"></button>
|
||||
</h2>
|
||||
<div style="display:flex">
|
||||
<div class="twocolumns">
|
||||
<div class="descValuePair">
|
||||
<label for="denizenname">Name</label>
|
||||
<input id="denizenname" type="text" name="attr_character_name">
|
||||
</div>
|
||||
|
||||
<div class="descValuePair">
|
||||
<label for="denzientechlevel">Tech Level</label>
|
||||
<input id="denzientechlevel" type="text" name="attr_techlevel">
|
||||
</div>
|
||||
<div class="descValuePair">
|
||||
<label for="denizenscrap">Scrap</label>
|
||||
<input id="denizenscrap" type="number" name="attr_scrapvalue">
|
||||
</div>
|
||||
<textarea name="attr_typeDetails"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="marginleft twocolumns">
|
||||
<div class="descValuePair">
|
||||
<label for="denizenhealth">HP</label>
|
||||
<input type="number" id="denizenhealth" min="0" name="attr_health" value="0">
|
||||
<label> of <input type="number" min="0" name="attr_health_max" value="0"></label>
|
||||
</div>
|
||||
<div class="descValuePair">
|
||||
<label for="denizenstructure">SP</label>
|
||||
<input type="number" id="denizenstructure" min="0" name="attr_structure" value="0">
|
||||
<label> of <input type="number" min="0" name="attr_structure_max" value="0"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Weapons</h3>
|
||||
<div class="weapon">
|
||||
<label>Name</label>
|
||||
<label>Range</label>
|
||||
<label>Damage</label>
|
||||
</div>
|
||||
<div>
|
||||
<fieldset class="repeating_mechweapons">
|
||||
<details>
|
||||
<summary>
|
||||
<input type="text" name="attr_name" title="Name of the Weapon">
|
||||
<input type="text" name="attr_range" title="Range">
|
||||
<input type="text" name="attr_damage" title="Damage">
|
||||
<button type="roll" title="Fire the Weapon" value="&{template:weapon}{{name=@{character_name}}}{{range=@{range}}}{{weapon_name=@{name}}}{{roll=[[1d20]]}}{{damage=@{damage}}}">
|
||||
</button>
|
||||
</summary>
|
||||
<details>
|
||||
<summary>
|
||||
Settings
|
||||
</summary>
|
||||
<div class="descValuePair">
|
||||
<label>Heat produced</label>
|
||||
<input type="number" name="attr_heat" value="0">
|
||||
</div>
|
||||
<div class="descValuePair">
|
||||
<label>Cost</label>
|
||||
<input type="text" name="attr_scrap" placeholder="1 T1 Scrap">
|
||||
</div>
|
||||
<div class="descValuePair">
|
||||
<label>Slots</label>
|
||||
<input type="number" name="attr_slots" value="1">
|
||||
</div>
|
||||
</details>
|
||||
<textarea name="attr_details"></textarea>
|
||||
</details>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<h3>Traits</h3>
|
||||
<fieldset class="repeating_traits">
|
||||
<details>
|
||||
<summary>
|
||||
<input type="text" name="attr_name" class="fullsize" title="Name of the Trait">
|
||||
</summary>
|
||||
<textarea name="attr_details" class="textarea"></textarea>
|
||||
</details>
|
||||
@@ -552,32 +640,6 @@
|
||||
<span>Is Pilot</span>
|
||||
<input id="isPilot" name="attr_is-pilot" type="checkbox" checked/>
|
||||
</label>
|
||||
<br>
|
||||
<details>
|
||||
<summary>
|
||||
<label for="isMech" class="settings-checkbox">
|
||||
<span>Is Mech</span>
|
||||
<input id="isMech" name="attr_is-mech" type="checkbox"/>
|
||||
</label>
|
||||
</summary>
|
||||
<label for="countWeapons" class="settings-checkbox">
|
||||
<span>Count Weapons as Systems</span>
|
||||
<input id="countWeapons" name="attr_count-weapons" type="checkbox"/>
|
||||
</label>
|
||||
<label for="showShield" class="settings-checkbox">
|
||||
<span>Show Shield</span>
|
||||
<input id="showShield" name="attr_show-shield" type="checkbox"/>
|
||||
</label>
|
||||
<details>
|
||||
<summary>Importer</summary>
|
||||
<textarea name="attr_importerText" class="textarea" placeholder="To use the importer copy the text from the rulebook and paste it into this window. Names have to be on one line."></textarea>
|
||||
<button type="action" class="textbutton passiv-hide" name="act_import-mech-stats">Import Stats</button>
|
||||
<button type="action" class="textbutton passiv-hide" name="act_import-mech-weapon">Import Weapon</button>
|
||||
<button type="action" class="textbutton passiv-hide" name="act_import-mech-system">Import System</button>
|
||||
<button type="action" class="textbutton passiv-hide" name="act_import-mech-module">Import Module</button>
|
||||
</details>
|
||||
</details>
|
||||
|
||||
<br>
|
||||
<label for="isCrawler" class="settings-checkbox">
|
||||
<span>Is Crawler</span>
|
||||
@@ -589,6 +651,56 @@
|
||||
<input id="showNotesTab" name="attr_show-notes-tab" type="checkbox"/>
|
||||
</label>
|
||||
<br>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<span>Mech Settings</span>
|
||||
</summary>
|
||||
<div>
|
||||
<label for="isMech" class="settings-checkbox">
|
||||
<span>Is Mech</span>
|
||||
<input id="isMech" name="attr_is-mech" type="checkbox"/>
|
||||
</label>
|
||||
<label for="countWeapons" class="settings-checkbox">
|
||||
<span>Count Weapons as Systems</span>
|
||||
<input id="countWeapons" name="attr_count-weapons" type="checkbox"/>
|
||||
</label>
|
||||
<label for="showShield" class="settings-checkbox">
|
||||
<span>Show Shield</span>
|
||||
<input id="showShield" name="attr_show-shield" type="checkbox"/>
|
||||
</label>
|
||||
<details>
|
||||
<summary>Importer</summary>
|
||||
<textarea name="attr_importerText" class="textarea" placeholder="To use the importer copy the text from the rulebook and paste it into this window. Names have to be on one line. Hot(x) has to be replaced with the number."></textarea>
|
||||
<button type="action" class="textbutton" name="act_import-mech-stats">Import Stats</button>
|
||||
<button type="action" class="textbutton" name="act_import-mech-weapon">Import Weapon</button>
|
||||
<button type="action" class="textbutton" name="act_import-mech-system">Import System</button>
|
||||
<button type="action" class="textbutton" name="act_import-mech-module">Import Module</button>
|
||||
</details>
|
||||
</div>
|
||||
</details>
|
||||
<br>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<span>Mediator Settings</span>
|
||||
</summary>
|
||||
<div>
|
||||
<label for="isDenizen" class="settings-checkbox">
|
||||
<span>Is Denizen</span>
|
||||
<input id="isDenizen" name="attr_is-denizen" type="checkbox"/>
|
||||
</label>
|
||||
<details>
|
||||
<summary>Importer</summary>
|
||||
<textarea name="attr_importerText" class="textarea" placeholder="To use the importer copy the text from the rulebook and paste it into this window. For Bio-Titans copy everything without the orange boxes and import the orange boxes separately. Multiple orange boxes can be imported at once."></textarea>
|
||||
<button type="action" class="textbutton" name="act_import-biotitan">Import Biotitan</button>
|
||||
<button type="action" class="textbutton" name="act_import-biotitan-orangebox">Import Biotitan orange box</button>
|
||||
<button type="action" class="textbutton" name="act_import-vehicle">Import Vehicle</button>
|
||||
<button type="action" class="textbutton" name="act_import-creature">Import Creature</button>
|
||||
<button type="action" class="textbutton" name="act_import-peoplesquad">Import People/Squad</button>
|
||||
</details>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -601,7 +713,7 @@
|
||||
|
||||
|
||||
<script type="text/worker">
|
||||
const buttonlist = ["pilot","mech","crawler","notes","settings"];
|
||||
const buttonlist = ["pilot","mech","crawler", "denizen", "notes","settings"];
|
||||
buttonlist.forEach(button => {
|
||||
on(`clicked:${button}`, function() {
|
||||
setAttrs({
|
||||
@@ -841,7 +953,14 @@ on('clicked:import-mech-stats', async (ev) => {
|
||||
on('clicked:import-mech-weapon', async (ev) => {
|
||||
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
await importWeapon(toImport);
|
||||
|
||||
asw.setAttrs({
|
||||
importerText: 'Values imported'
|
||||
});
|
||||
});
|
||||
|
||||
const importWeapon = async (toImport) => {
|
||||
var row = "repeating_mechweapons_" + generateRowID() + "_";
|
||||
let weapon = {};
|
||||
|
||||
@@ -855,10 +974,8 @@ on('clicked:import-mech-weapon', async (ev) => {
|
||||
importHeat(rules, weapon, row);
|
||||
importDetails(rules, toImport, weapon, row);
|
||||
|
||||
weapon["importerText"] ='Values imported'
|
||||
|
||||
asw.setAttrs(weapon);
|
||||
});
|
||||
}
|
||||
|
||||
on('clicked:import-mech-system', async (ev) => {
|
||||
importFromImporter("systems");
|
||||
@@ -871,6 +988,9 @@ on('clicked:import-mech-module', async (ev) => {
|
||||
const importFromImporter = async(type) => {
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
await importModuleSystem(type, toImport);
|
||||
asw.setAttrs({
|
||||
importerText: 'Values imported'
|
||||
});
|
||||
}
|
||||
|
||||
const importModuleSystem = async (type, toImport) => {
|
||||
@@ -899,8 +1019,6 @@ const importModuleSystem = async (type, toImport) => {
|
||||
importHeat(rules, object, row);
|
||||
importDetails(rules, toImport, object, row);
|
||||
|
||||
object.importerText = 'Values imported'
|
||||
|
||||
asw.setAttrs(object);
|
||||
};
|
||||
|
||||
@@ -921,7 +1039,7 @@ const importMultipleEp = async (type, toImport) => {
|
||||
}
|
||||
|
||||
const formatImporterText = (toImport) => {
|
||||
let formatted = toImport.replaceAll(/\/\/\s*[\r\n]/gm, '// ').replaceAll(/[\r\n]/gm, '#').replaceAll(/#\/\//g, '//').replaceAll(/#/g, '\n').replaceAll(/^\s*\n/gm,'');
|
||||
let formatted = toImport.replaceAll(/\/\/\s*[\r\n]/gm, '// ').replaceAll(/[\r\n]/gm, '#').replaceAll(/#\/\//g, '//').replaceAll(/#/g, '\n').replaceAll(/^\s*\n/gm,'').replaceAll(/\n(\(\d\))/gm, "$1").trim();
|
||||
|
||||
let multilineName = formatted.split(/\r?\n/);
|
||||
if(multilineName[2].includes("Range") || multilineName[2].includes("Passive") || multilineName[2].includes("EP")) {
|
||||
@@ -1035,10 +1153,242 @@ const importHeat = (rules, object, row) => {
|
||||
}
|
||||
|
||||
const importDetails = (rules, toImport, object, row) => {
|
||||
let longtext = toImport.split('\n').slice(1).join('').trim();
|
||||
let longtext = toImport.split('\n').slice(1).join(' ').trim();
|
||||
object[row + "details"] = rules + "\n" + longtext;
|
||||
}
|
||||
|
||||
/////////////////////////
|
||||
// DENIZEN IMPORTER ///
|
||||
/////////////////////////
|
||||
|
||||
on('clicked:import-biotitan', async (ev) => {
|
||||
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
|
||||
if(!toImport.includes(".")) {
|
||||
asw.setAttrs({
|
||||
importerText: 'No \".\" found. Add one at the end of the description \n\n' + toImport
|
||||
});
|
||||
}
|
||||
|
||||
let biotitan = {};
|
||||
biotitan.techlevel = "Tech 1 / Bio-Salvage";
|
||||
|
||||
toImport = toImport.split('\n');
|
||||
|
||||
biotitan.structure = toImport.pop().replaceAll(/[a-zA-Z.]/g, '').trim();
|
||||
biotitan.structure_max = biotitan.structure;
|
||||
biotitan.scrapvalue = biotitan.structure;
|
||||
|
||||
//look for name (all caps)
|
||||
let typeDetails = "";
|
||||
while(toImport[toImport.length-1] !== toImport[toImport.length-1].toUpperCase()) {
|
||||
typeDetails = toImport.pop().trim() + " " + typeDetails;
|
||||
}
|
||||
typeDetails = typeDetails.replaceAll(/(?=•)/g, '\n');
|
||||
biotitan.typeDetails =typeDetails;
|
||||
|
||||
biotitan.character_name = toImport.pop().trim().replace(/(\w)(\w*)/g, (_, firstChar, rest) => firstChar + rest.toLowerCase());
|
||||
|
||||
biotitan["importerText"] = 'Values imported';
|
||||
asw.setAttrs(biotitan);
|
||||
});
|
||||
|
||||
on('clicked:import-biotitan-orangebox', async (ev) => {
|
||||
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
|
||||
if(!toImport.includes(".")) {
|
||||
asw.setAttrs({
|
||||
importerText: 'No \".\" found. Add one at the end of the description \n\n' + toImport
|
||||
});
|
||||
}
|
||||
|
||||
let biotitan = {};
|
||||
biotitan.techlevel = "Tech 1 / Bio-Salvage";
|
||||
|
||||
toImport = toImport.split('\n');
|
||||
|
||||
while(toImport.length !== 0) {
|
||||
let name = toImport.shift().trim();
|
||||
let rules = toImport.shift().trim();
|
||||
let details = "";
|
||||
|
||||
while(toImport.length > 3 && !toImport[2].includes("//") && !toImport[2].includes("Passive")) {
|
||||
details = details + toImport.shift();
|
||||
}
|
||||
details = details + toImport.shift();
|
||||
if(toImport.length < 3) {
|
||||
details = details + toImport.join("");
|
||||
//exit loop
|
||||
toImport = [];
|
||||
}
|
||||
details = details.replaceAll(" ", " ");
|
||||
|
||||
if(rules.includes("//")) {
|
||||
await importWeapon(name + "\n" + rules + "\n" + details);
|
||||
}
|
||||
|
||||
if(rules.includes("Passive")) {
|
||||
let row = "repeating_traits_" + generateRowID();
|
||||
biotitan[row + "_name"] = name;
|
||||
biotitan[row + "_details"] = rules + "\n" + details;
|
||||
}
|
||||
}
|
||||
|
||||
biotitan["importerText"] = 'Values imported';
|
||||
asw.setAttrs(biotitan);
|
||||
});
|
||||
|
||||
on('clicked:import-vehicle', async (ev) => {
|
||||
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
|
||||
if(!toImport.includes(".")) {
|
||||
asw.setAttrs({
|
||||
importerText: 'No \".\" found. Add one at the end of the description \n\n' + toImport
|
||||
});
|
||||
}
|
||||
|
||||
let vehicle = {};
|
||||
|
||||
toImport = toImport.split('\n');
|
||||
|
||||
vehicle.scrapvalue = toImport.pop();
|
||||
vehicle.techlevel = toImport.pop();
|
||||
|
||||
let traits = "";
|
||||
while(!toImport[toImport.length-1].includes("SP")) {
|
||||
traits = toImport.pop().trim() + " " + traits;
|
||||
}
|
||||
traits = traits.replaceAll(" ", " ").split("//");;
|
||||
importTraits(traits, vehicle);
|
||||
|
||||
if(toImport[toImport.length-1].includes("SP")) {
|
||||
vehicle.structure = toImport.pop().replaceAll(/[a-zA-Z]/g, '').trim();
|
||||
vehicle.structure_max = vehicle.structure;
|
||||
}
|
||||
|
||||
vehicle.character_name = toImport.pop().trim();
|
||||
|
||||
if(toImport[toImport.length-1].includes("//")) {
|
||||
let rules = toImport.pop();
|
||||
let weaponName = toImport.pop();
|
||||
|
||||
importWeapon(weaponName +"\n" + rules);
|
||||
}
|
||||
|
||||
while(!toImport[toImport.length-1].includes(".")) {
|
||||
await importModuleSystem('traits', toImport.pop());
|
||||
}
|
||||
|
||||
vehicle.typeDetails = toImport.join('');
|
||||
|
||||
vehicle["importerText"] ='Values imported'
|
||||
|
||||
asw.setAttrs(vehicle);
|
||||
});
|
||||
|
||||
on('clicked:import-creature', async (ev) => {
|
||||
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
|
||||
if(!toImport.includes(".")) {
|
||||
asw.setAttrs({
|
||||
importerText: 'No \".\" found. Add one at the end of the description \n\n' + toImport
|
||||
});
|
||||
}
|
||||
|
||||
let creature = {};
|
||||
creature.scrapvalue = 0;
|
||||
creature.techlevel = 0;
|
||||
|
||||
toImport = toImport.split('\n');
|
||||
|
||||
let traits = "";
|
||||
while(!toImport[toImport.length-1].includes("HP")) {
|
||||
traits = toImport.pop().trim() + " " + traits;
|
||||
}
|
||||
traits = traits.replaceAll(" ", " ");
|
||||
importTraits(traits, creature);
|
||||
|
||||
creature.health = toImport.pop().replaceAll(/[a-zA-Z]/g, '').trim();
|
||||
creature.health_max = creature.health;
|
||||
|
||||
if(toImport[0].includes("Scorpion")) {
|
||||
creature.character_name = toImport[0];
|
||||
toImport = toImport.shift();
|
||||
}
|
||||
else {
|
||||
creature.character_name = toImport.pop().trim();
|
||||
}
|
||||
|
||||
if(toImport[toImport.length-1].includes("//")) {
|
||||
let rules = toImport.pop();
|
||||
let weaponName = toImport.pop();
|
||||
|
||||
importWeapon(weaponName +"\n" + rules);
|
||||
}
|
||||
|
||||
creature.typeDetails = toImport.join('');
|
||||
|
||||
creature["importerText"] = 'Values imported';
|
||||
|
||||
asw.setAttrs(creature);
|
||||
});
|
||||
|
||||
on('clicked:import-peoplesquad', async (ev) => {
|
||||
|
||||
let toImport = formatImporterText((await asw.getAttrs(['importerText'])).importerText);
|
||||
|
||||
if(!toImport.includes(".")) {
|
||||
asw.setAttrs({
|
||||
importerText: 'No \".\" found. Add one at the end of the description \n\n' + toImport
|
||||
});
|
||||
}
|
||||
|
||||
let people = {};
|
||||
people.scrapvalue = 0;
|
||||
people.techlevel = 0;
|
||||
|
||||
toImport = toImport.split('\n');
|
||||
|
||||
people.character_name = toImport.shift();
|
||||
|
||||
people.health = toImport.pop().replaceAll(/[a-zA-Z]/g, '').trim();
|
||||
people.health_max = people.health;
|
||||
|
||||
let traits = "";
|
||||
while(!toImport[toImport.length-1].includes("//")) {
|
||||
traits = toImport.pop().trim() + "\n" + traits;
|
||||
}
|
||||
traits = traits.replaceAll(" ", " ").split("\n");;
|
||||
importTraits(traits, people);
|
||||
|
||||
if(toImport[toImport.length-1].includes("//")) {
|
||||
let rules = toImport.pop();
|
||||
let weaponName = toImport.pop();
|
||||
|
||||
importWeapon(weaponName +"\n" + rules);
|
||||
}
|
||||
|
||||
people.typeDetails = toImport.join('');
|
||||
|
||||
people["importerText"] = 'Values imported';
|
||||
|
||||
asw.setAttrs(people);
|
||||
});
|
||||
|
||||
const importTraits = (traits, object) => {
|
||||
|
||||
traits.forEach(trait => {
|
||||
if(trait.trim() !== "") {
|
||||
let row = "repeating_traits_" + generateRowID() + "_name";
|
||||
object[row] = trait.trim();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// HELPER ////
|
||||
///////////////////
|
||||
|
||||
Reference in New Issue
Block a user