Single NPC gen, spell list, world map, roll20-hitdice
This commit is contained in:
1 parent
79f9260d13
commit
9017792b3c
10 files changed
+626
-15
No files matched your search
@@ -6,13 +6,29 @@
|
||||
<div class="uk-flex uk-flex-center uk-margin-bottom uk-margin-top">
|
||||
<h1>Adventurer Conqueror King Spell List</h1>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
|
||||
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-small-bottom">
|
||||
<div>
|
||||
<label for="base_level">TURN INTO FILTER AREA</label>
|
||||
<input type="number" name="base_level" id="base_level" class="uk-input" value="{{ base_level if base_level else 1 }}" >
|
||||
<label for="spell_level">Spell Level</label>
|
||||
<input type="number" name="spell_level" id="spell_level" class="uk-input" value="0">
|
||||
</div>
|
||||
<div class="uk-margin-left">
|
||||
<button class="uk-button uk-button-primary" onclick="generateParty();">Generate</button>
|
||||
<div>
|
||||
<label for="divine_toggle">Divine</label>
|
||||
<input type="checkbox" name="divine_toggle" id="divine_toggle" class="uk-checkbox" checked>
|
||||
</div>
|
||||
<div>
|
||||
<label for="arcane_toggle">Arcane</label>
|
||||
<input type="checkbox" name="arcane_toggle" id="arcane_toggle" class="uk-checkbox" checked>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-bottom uk-flex-center uk-margin-large-bottom">
|
||||
<div>
|
||||
<label for="spell_query">Name Search</label>
|
||||
<input type="text" name="spell_query" id="spell_query" class="uk-input"/>
|
||||
</div>
|
||||
<div class="uk-margin-left">
|
||||
<button class="uk-button uk-button-primary" onclick="applyFilters();">Filter</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +37,7 @@
|
||||
{% if spells %}
|
||||
<div class="uk-grid-medium uk-grid-match uk-flex-center" uk-grid>
|
||||
{% for spell in spells %}
|
||||
<div class="acks-npc-card">
|
||||
<div class="acks-npc-card" id="{{ spell.dom_id }}">
|
||||
<div class="uk-card uk-card-body uk-card-default uk-box-shadow-hover-large">
|
||||
<h4 class="uk-card-title uk-margin-small-top">{{ spell.name }}</h4>
|
||||
<ul>
|
||||
@@ -39,6 +55,67 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script type="text/javascript">
|
||||
var spells = [{% for spell in spells %} {{ spell.roll20_format | tojson }}, {% endfor %}];
|
||||
|
||||
function filterSpell(filters, spell) {
|
||||
function name2id(name) {
|
||||
return "#" + name.toLowerCase().replace(/[\*',]/g, "").replace(/\s/g, "_");
|
||||
}
|
||||
|
||||
let hide = false;
|
||||
|
||||
// Handle search query filtering
|
||||
if(filters.spell_query) {
|
||||
if(spell.name.toLowerCase().indexOf(filters.spell_query.toLowerCase()) < 0) {
|
||||
hide = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle school and level filtering
|
||||
if(!filters.arcane_included && spell.is_arcane) {
|
||||
hide = true;
|
||||
}
|
||||
|
||||
if(!filters.divine_included && spell.is_divine) {
|
||||
hide = true;
|
||||
}
|
||||
|
||||
if(filters.spell_level > 0) {
|
||||
if(spell.is_arcane && spell.arcane != filters.spell_level) {
|
||||
hide = true;
|
||||
}
|
||||
if(spell.is_divine && spell.divine != filters.spell_level) {
|
||||
hide = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide this spell-card if appropriate
|
||||
if(hide) {
|
||||
document.querySelector(name2id(spell.name)).classList.add('uk-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function resetFiltering() {
|
||||
var hidden_spells = document.querySelectorAll("div.acks-npc-card.uk-hidden");
|
||||
for(let hd of hidden_spells) {
|
||||
hd.classList.remove('uk-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function applyFilters() {
|
||||
resetFiltering();
|
||||
|
||||
filters = {
|
||||
spell_level: document.querySelector('#spell_level').value,
|
||||
spell_query: document.querySelector('#spell_query').value,
|
||||
arcane_included: document.querySelector('#arcane_toggle').checked,
|
||||
divine_included: document.querySelector('#divine_toggle').checked,
|
||||
};
|
||||
|
||||
spells.forEach((spell, index) => { filterSpell(filters, spell); });
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
table.item-table, table.item-table th {
|
||||
font-size: 12px;
|
||||
|
||||
Reference in new issue
Block a user