Files
roll20-character-sheets-tester/Quest-boardgame/Quest.html
T
2021-03-01 19:57:44 -05:00

197 lines
9.0 KiB
HTML

<!-- QUest HTML */ -->
<!-- Version 1.0 -->
<div class="ept">
<!-- Hidden Values -->
<input type='hidden' class='profession-select' name='attr_profession' value='Warrior' />
<h2 class="title"><span class="underline">Quest</span>: Character Sheet</h2>
<!-- Basics Section -->
<div class="section">
<span class="flex-row"><label>Player Name</label><input class="fill" type="text" name="attr_character_name"/></span>
<span class="flex-row">
<label>Profession</label>
<select class="profession-select fill" name="attr_profession" title="@{Profession}">
<option value="Warrior" selected="selected">Warrior</option>
<option value="Priest">Priest</option>
<option value="Magic-User">Magic User</option>
</select>
</span>
<div class="grid-4">
<!-- <span class="flex-row grid-4-span-2"><label >Kaitar</label><input class="fill nospin" type="number" name="attr_kaitar" title="@{kaitar}" value="0" min="0" /></span> -->
<span class="flex-row grid-4-span-2"><label >Kaitar</label><span class="fill worker" name="attr_kaitar"></span> </span>
<span class="flex-row grid-4-span-2"><label >Level</label><span class="fill worker" name="attr_level"></span></span>
</div>
</div>
<!-- END Basics Section -->
<div class="grid-4">
<span class="flex-row grid-4-span-2">
<div class="section">
<label class="flex-row label">Equipment</label>
<div class="checklist">
<div class="items">
<div class="skill-set">
<input class="skill-checkbox" type="checkbox" name="attr_sword" value="yes" />
<label class="skill-label">Sword +1</label>
</div>
<!-- <label class="flex-row label">Eyes</label> -->
<div class="skill-set">
<input class="skill-checkbox" type="checkbox" name="attr_unconquerable" value="yes" />
<label class="skill-label">Eye of the Unconquerable</label>
</div>
<div class="skill-set">
<input class="skill-checkbox" type="checkbox" name="attr_madness" value="yes" />
<label class="skill-label">Eye of Madness</label>
</div>
<div class="skill-set">
<input class="skill-checkbox" type="checkbox" name="attr_kramighty" value="yes" />
<label class="skill-label">Eye of Kra the Mighty</label>
</div>
<div class="skill-set">
<input class="skill-checkbox" type="checkbox" name="attr_ragingpower" value="yes" />
<label class="skill-label">Eye of Raging Power</label>
</div>
</div>
</div>
</div>
</span>
<span class="flex-row grid-4-span-2">
<div class="spells section">
<div class="prof-skill-select flex-row">
<span class="flex-row label-prof"><label class="label">Spells: </label>
<label class="label label-profession-warrior">Warrior</label>
<label class="label label-profession-priest">Priest</label>
<label class="label label-profession-magicuser">Magic&nbsp;User</label>
</span>
</div>
<div class="profession-warrior">
<div class="skill-set">
<label class="skill-label tab1">None</label>
</div>
</div>
<div class="profession-magicuser">
<span class="flex-row"><label>No. of spells</label><span class="fill worker" name="attr_spells"></span></span>
<span class="flex-row fill"><label>Control Person</label><input class="fill" type="text" name="attr_spell_controlperson" /></span>
<span class="flex-row fill"><label>Doom Kill</label><input class="fill" type="text" name="attr_spell_doomkill" /></span>
<span class="flex-row fill"><label>Energy Bolt</label><input class="fill" type="text" name="attr_spell_energybolt" /></span>
<span class="flex-row fill"><label>Walls</label><input class="fill" type="text" name="attr_spell_walls" /></span>
</div>
<div class="profession-priest">
<span class="flex-row"><label>Number of spells</label><span class="fill worker" name="attr_spells"></span></span>
<span class="flex-row tab1 fill"><label>Control Creatures</label><input class="fill" type="text" name="attr_spell_controlcreatures" /></span>
<span class="flex-row tab1 fill"><label>Creatures</label><input class="fill" type="text" name="attr_spell_creatures" /></span>
<span class="flex-row tab1 fill"><label>Fear</label><input class="fill" type="text" name="attr_spell_fear" /></span>
<span class="flex-row tab1 fill"><label>Silver Halo</label><input class="fill" type="text" name="attr_spell_silverhalo" /></span>
</div>
</div>
</span>
</div>
<!-- Treasures Section -->
<div class="treasure section">
<div class="grid-4">
<span class="flex-row grid-4-span-3 label"><label class="">Treasure Found</label></span>
<span class="flex-row grid-4-span-1"><label class="">kaitars</label></span>
</div>
<fieldset class="repeating_treasure">
<div class="grid-4">
<input class="flex-row grid-4-span-3 fill" type="text" name="attr_treasure" />
<input class="flex-row grid-4-span-1 fill right" type="text" name="attr_kaitar_treasure" />
</div>
</fieldset>
</div>
<!-- Monsters Section -->
<div class="monsters section">
<div class="grid-4">
<span class="flex-row grid-4-span-3 label"><label class="">Mosters Killed</label></span>
<span class="flex-row grid-4-span-1"><label class="">kaitars</label></span>
</div>
<fieldset class="repeating_monster">
<div class="grid-4">
<input class="flex-row grid-4-span-3 fill" type="text" name="attr_monster" />
<input class="flex-row grid-4-span-1 fill right" type="text" name="attr_kaitar_monster" />
</div>
</fieldset>
</div>
<!-- END Misc. Section -->
</div>
<!-- Sheet Workers -->
<script type="text/worker">
// Talent based calulations
on("change:kaitar sheet:opened", function() {
getAttrs(["KAITAR"], function(values) {
let kaitar = parseInt(values.KAITAR)||0;
let level = 1;
let spells = 3;
// Strength modifiers
if (kaitar >= 30000) {
level = 4;
spells = 6;
} else if (kaitar >= 20000) {
level = 3;
spells = 5;
} else if (kaitar >= 10000) {
level = 2;
spells = 4;
}
setAttrs({
level: level,
spells: spells,
});
});
});
/* ===== PARAMETERS ==========
destinations = the name of the attribute that stores the total quantity
can be a single attribute, or an array: ['total_cost', 'total_weight']
If more than one, the matching fields must be in the same order.
section = name of repeating fieldset, without the repeating_
fields = the name of the attribute field to be summed
destination and fields both can be a single attribute: 'weight'
or an array of attributes: ['weight','number','equipped']
*/
const repeatingSum = (destinations, section, fields) => {
if (!Array.isArray(destinations)) destinations = [destinations.replace(/\s/g, '').split(',')];
if (!Array.isArray(fields)) fields = [fields.replace(/\s/g, '').split(',')];
getSectionIDs(`repeating_${section}`, idArray => {
const attrArray = idArray.reduce((m, id) => [...m, ...(fields.map(field => `repeating_${section}_${id}_${field}`))], []);
getAttrs([...attrArray], v => {
const getValue = (section, id, field) => v[`repeating_${section}_${id}_${field}`] === 'on' ? 1 : parseFloat(v[`repeating_${section}_${id}_${field}`]) || 0;
const commonMultipliers = (fields.length <= destinations.length) ? [] : fields.splice(destinations.length, fields.length - destinations.length);
const output = {};
destinations.forEach((destination, index) => {
output[destination] = idArray.reduce((total, id) => total + getValue(section, id, fields[index]) * commonMultipliers.reduce((subtotal, mult) => subtotal * getValue(section, id, mult), 1), 0);
});
setAttrs(output);
});
});
};
on('change:repeating_treasure remove:repeating_treasure change:repeating_monster remove:repeating_monster sheet:opened', function() {
repeatingSum("kaitar_total_treasure","treasure","kaitar_treasure");
repeatingSum("kaitar_total_monster","monster","kaitar_monster");
});
on("change:kaitar_total_treasure change:kaitar_total_monster sheet:opened", function() {
getAttrs(["KAITAR_TOTAL_TREASURE", "KAITAR_TOTAL_MONSTER"], function(values) {
let kaitar_total_treasure = parseInt(values.KAITAR_TOTAL_TREASURE)||0;
let kaitar_total_monster = parseInt(values.KAITAR_TOTAL_MONSTER)||0;
let kaitar_total = kaitar_total_treasure + kaitar_total_monster;
setAttrs({ kaitar: kaitar_total });
});
});
</script>
<!-- END charsheet EPT -->