Files
2024-06-03 13:15:14 -04:00

196 lines
11 KiB
HTML

<div class="heading">OneDice Universal Character Sheet</div>
<span class="label" data-i18n="Name">Name</span>: <input type="text" name="attr_character_name" /> <span class="label" data-i18n="Level">Level</span>: <input type="number" name="attr_level" /> <span class="label" data-i18n="E/IP">E/IP</span>: <input type="number" name="attr_eip" /> <span class="label" data-i18n="Stunt Points">Stunt Points</span>: <input type="number" name="attr_stuntpoints" value="6" /><br /><br />
<div class="layout">
<div class="layoutabilities">
<span class="statlabel" data-i18n="Strong">Strong</span>: <input class="statfield" type="number" name="attr_strong" /> <br />
</div>
<div class="layoutcells">
<span class="statlabel" data-i18n="Health">Health</span>: <input type="number" name="attr_healthmax" value="(@{strong}*3)" disabled/><br /><br />
<span class="statlabel" data-i18n="Current">Current</span>: <input class="statfield" type="number" name="attr_healthcurrent" value="@{healthmax}" /><br />
</div>
<div class="layoutbg">
<span class="label" data-i18n="Background and Description">Background and Description</span>:</br />
<textarea class="descinput" name="attr_description"></textarea>
</div>
<div class="layoutabilities">
<span class="statlabel" data-i18n="Clever">Clever</span>: <input class="statfield" type="number" name="attr_clever" /><br />
</div>
<div class="layoutcells">
<span class="statlabel" data-i18n="Defence">Defence</span>: <input type="number" name="attr_defence" value="(@{defstat}*3)" disabled="false" /> <span class="sublabel" data-i18n="Use">Use</span>:
<select class="skillability" name="attr_defstat">
<option value='@{strong}' data-i18n="Strong">Strong</option>
<option value='@{quick}' data-i18n="Quick">Quick</option>
</select> <br />
<div class="statlabel armor" data-i18n="Armor">Armor</div> <div class="statlabel armorbonus" data-i18n="Bonus">Bonus</div><br />
<fieldset class="repeating_armor">
<input class="armor sublabel" type="text" name="attr_armortype">
<input type="number" class="armorbonus" name="attr_armorbonus" />
</fieldset><br /><br />
<span class="statlabel" data-i18n="Total Armor">Total Armor</span>:
<input class="statfield" type="number" name="attr_armortotal" value="(@{defence}+@{totalarmorbonus})" disabled /><br />
</div>
<div class="layoutabilities">
<span class="statlabel" data-i18n="Quick">Quick</span>: <input class="statfield" type="number" name="attr_quick" />
<span class="sublabel" data-i18n="Roll Initiative">Roll Initiative</span>:
<button type="roll" value='&{template:rolloutput} {{rollname=Initiative}} {{initiative=[[d6+@{quick}]]}}' class="spellroll" name="roll_initiative"></button><br />
</div>
<div class="layoutcells">
<span class="statlabel" data-i18n="Move">Move</span>: <input type="number" name="attr_move" class="statfield" value="(@{quick}*10)" disabled="true" /> <span class="text" data-i18n="meters">meters</span><br />
</div>
<div class="layoutmagic">
<span class="statlabel" data-i18n="Magic">Magic</span>: <input class="statfield" type="number" name="attr_magic" /> <br />
</div>
<div class="spells layoutspells">
<span class="statlabel" data-i18n="Spells">Spells</span>: <br />
<div class="spellname sublabel" data-i18n="Name">Name</div>
<div class="spelldesc sublabel" data-i18n="Description">Description</div>
<div class="spellrange sublabel" data-i18n="Range">Rng</div>
<div class="spelltarget sublabel" data-i18n="Target">Target</div>
<div class="spelldamage sublabel" data-i18n="Effect">Effect</div>
<div class="spellroll sublabel" data-i18n="Roll">Roll</div><br />
<fieldset class="repeating_spells">
<input class="spellname" type="text" name="attr_spellname">
<input class="spelldesc" type="text" name="attr_spelldesc" />
<input class="spellrange" type="number" name="attr_spellrange" />
<input class="spelltarget" type="text" name="attr_spelltarget" />
<input class="spelldamage" type="text" name="attr_spelldamage" />
<button class="spellroll" type='roll' name="roll_castspell" value='&{template:spelloutput} {{rollname=@{spellname}}} {{magic=[[d6+@{magic}]]}} {{spelldescoutput=@{spelldesc}}} {{damage=@{spelldamage}}} {{charname=@{character_name}}}'></button>
</fieldset>
</div>
<div class="layoutskills">
<span class="label" data-i18n="Skills">Skills</span>:<br />
<span class="skillname sublabel" data-i18n="Name">Name</span>
<span class="skillpoints sublabel" data-i18n="Points">Points</span>
<span class="skillability sublabel" data-i18n="Ability">Ability</span>
<span class="skilltotal sublabel" data-i18n="Total">Total</span><br />
<fieldset class="repeating_skill">
<input class="skillname" type="text" name="attr_skillname" />
<input class="skillpoints" type="number" name="attr_skillpoints" />
<select class="skillability" name="attr_skillstat">
<option value='@{strong}' data-i18n="Strong">Strong</option>
<option value='@{clever}' data-i18n="Clever">Clever</option>
<option value='@{quick}' data-i18n="Quick">Quick</option>
</select>
<input class="skilltotal" type="number" name="attr_skilltotal" value="@{skillpoints}+@{skillstat}" disabled="true" />
<button class="spellroll" type="roll" value='&{template:rolloutput} {{rollname=@{skillname}}} {{skill=[[1d6+@{skilltotal}]]}} {{charname=@{character_name}}}' name="roll_useskill"></button>
</fieldset>
</div>
<div class="layoutweapons">
<span class="label" data-i18n="Weapons">Weapons</span>:<br />
<span class="weaponname sublabel" data-i18n="Name">Name</span>
<span class="weaponability sublabel" data-i18n="Ability Used">Ability Used</span>
<span class="weaponskill sublabel" data-i18n="Skill Modifier">Skill</span>
<span class="weapondam sublabel" data-i18n="Damage">Damage</span><br />
<fieldset class="repeating_weapon">
<input class="weaponname" type="text" name="attr_weaponname" />
<select class="weaponability" name="attr_weaponstat">
<option value='@{strong}' data-i18n="Strong">Strong</option>
<option value='@{clever}' data-i18n="Clever">Clever</option>
<option value='@{quick}' data-i18n="Quick">Quick</option>
</select>
<input class="weaponskill" type="number" name="attr_weaponskill" />
<input type="number" name="attr_weapondamage" />
<input type="number" name="attr_totalweapon" class="hideme" value="@{weaponstat}+@{weaponskill}" disabled="true" />
<button class="spellroll" type="roll" name="roll_attack" value='&{template:rolloutput} {{rollname=@{weaponname}}} {{attack=[[1d6+@{totalweapon}]]}} {{damage=@{weapondamage}}} {{charname=@{character_name}}}'></button><br>
</fieldset><br />
*<span class="subtext" data-i18n="Manually enter the skill bonus.">Manually enter the skill bonus.</span>
</div>
<div class="layoutequipment">
<span class="label" data-i18n="Other Equipment">Other Equipment</span>:<br />
<span class="equipmentname sublabel" data-i18n="Name">Name</span><span class="equipmentlocation sublabel" data-i18n="Location">Location</span><br />
<fieldset class="repeating_equipment">
<input class="equipmentname" type="text" name="attr_equipmentname" /> <input class="equipmentlocation" type="text" name="attr_equipmentlocation" />
</fieldset>
</div>
<div class="layoutextra">
<span class="label" data-18n="Other Notes">Other Notes</span><br />
<textarea class="descinput" name="attr_otherdescription" placeholder="A good place to put rules reminders, custom rules, or other things you need to track"></textarea>
</div>
</div>
<hr>
<div class="footnote" data-i18n="OneDice is a simple universal d6 system by Cakebread & Walton, available on DriveThruRPG.">OneDice is a simple universal d6 system by Cakebread & Walton, available on DriveThruRPG.</div>
<script type="text/worker">
// Sheet Worker to Sum Armor
/* ===== PARAMETERS ==========
destination = the name of the attribute that stores the total quantity
section = name of repeating fieldset, without the repeating_
fields = the name of the attribute field to be summed
can be a single attribute: 'weight'
or an array of attributes: ['weight','number','equipped']
multiplier (optional) = a multiplier to to entire fieldset total. For instance, if summing coins of weight 0.02, might want to multiply the final total by 0.02.
*/
const repeatingSum = (destination, section, fields, multiplier = 1) => {
if (!Array.isArray(fields)) fields = [fields];
getSectionIDs(`repeating_${section}`, idArray => {
const attrArray = idArray.reduce( (m,id) => [...m, ...(fields.map(field => `repeating_${section}_${id}_${field}`))],[]);
getAttrs(attrArray, v => {
console.log("===== values of v: "+ JSON.stringify(v) +" =====");
const getValue = (section, id,field) => parseFloat(v[`repeating_${section}_${id}_${field}`], 10)||1; // default value of 1, so any faulty value inputs are ignored and the calculation still works.
const sumTotal = idArray.reduce((total, id) => total + fields.reduce((subtotal,field) => subtotal * getValue(section, id,field),1),0);
setAttrs({[destination]: sumTotal * multiplier});
});
});
};
on('change:repeating_armor remove:repeating_armor sheet:opened', function() {
repeatingSum("totalarmorbonus","armor","armorbonus");
});
</script>
<!-- Roll Template -->
<rolltemplate class="sheet-rolltemplate-rolloutput">
<div class="sheet-template-container">
<div class="sheet-template-header">{{rollname}}</div>
{{#initiative}}<div class="sheet-template-row">{{initiative}}</div>{{/initiative}}
{{#attack}}
<div class="sheet-template-row">{{charname}} <span data-i18n="attacks">attacks with a</span> {{attack}}!</div>
{{/attack}}
{{#damage}}<div class="sheet-template-row"><span data-i18n="Damage bonus">Damage bonus</span>: {{damage}} </div>{{/damage}}
{{#skill}}<div class="sheet-template-row">{{charname}} <span data-18n="uses">uses</span> {{rollname}}: {{skill}}</div> {{/skill}}
</div>
</rolltemplate>
<rolltemplate class="sheet-rolltemplate-spelloutput">
<div class="sheet-template-container">
<div class="sheet-template-header">{{rollname}}</div>
<div class="sheet-template-row">{{charname}} <span data-i18n="casts">casts</span> {{rollname}} <span data-i18n="and gets a">and gets a </span> {{magic}}</div>
{{#rollWasFumble() magic}}<div class="sheet-template-row"><span style="font-weight:bold;" data-i18n="Failed">This spell failed!</span></div>
{{/rollWasFumble() magic}}
{{#^rollWasFumble() magic}}
{{#spelldescoutput}}<div class="sheet-template-row"><span class="spelldescoutput">{{spelldescoutput}}</span></div>{{/spelldescoutput}}
{{#damage}}<div class="sheet-template-row"><span data-i18n="Effect">Effect</span>: {{damage}} </div>{{/damage}}
{{/^rollWasFumble() magic}}
</rolltemplate>