added quest unlocks and filters, customized asc/pagination

This commit is contained in:
Bart van der Braak 2019-04-26 19:26:04 +02:00
parent e00676d3a6
commit a7b573f822
2 changed files with 187 additions and 30 deletions

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Slayer Calc</title>
<title>Slayer Task Calculator</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/datatables.min.css">
@ -16,7 +16,7 @@
<body>
<div class="jumbotron text-center">
<h1>Slayer task weights</h1>
<h1>Slayer Task Calculator</h1>
<p>A calculator for slayer geeks that need to know percentages.</p>
</div>
@ -32,31 +32,29 @@
<li><a data-toggle="tab" class="nav-link" href="#" onclick="applyChanges('duradel');return false;">Duradel</a></li>
</ul>
<div class="row">
<div class="col">
<div class="col-12">
<h3>Slayer settings</h3>
</div>
</div>
<div class="row">
<div class="col-6">
<p>Unlocks:</p>
<form>
<ul>
<li><label><input type="checkbox" name="reddrags" id="reddrags">
Seeing red (Unlocks Red Dragons)</label></li>
<li><label><input type="checkbox" name="mithdrags" id="mithdrags">
I hope you mith me (Unlocks Mithril Dragons)</label></li>
<li><label><input type="checkbox" name="aviansies" id="aviansies">
Watch the birdie (Unlocks Aviansies)</label></li>
<li><label><input type="checkbox" name="tzhaar" id="tzhaar">
Hot stuff (Unlocks TzHaars)</label></li>
<li><label><input type="checkbox" name="lizardmen" id="lizardmen">
Reptile got ripped (Unlocks Lizardmen)</label></li>
<li><label><input type="checkbox" name="bosses" id="bosses">
Like a boss (Unlocks Bosses)</label></li>
<li><label><input type="checkbox" name="fossilwyverns" id="fossilwyverns">
Stop the Wyvern (Disables Fossil Island Wyverns)</label></li>
</ul>
</form>
<p><form>
<label><input type="checkbox" name="reddrags" id="reddrags">
Seeing red <small>Unlocks Red Dragons</small></label><br>
<label><input type="checkbox" name="mithdrags" id="mithdrags">
I hope you mith me <small>Unlocks Mithril Dragons</small></label><br>
<label><input type="checkbox" name="aviansies" id="aviansies">
Watch the birdie <small>Unlocks Aviansies</small></label><br>
<label><input type="checkbox" name="tzhaar" id="tzhaar">
Hot stuff <small>Unlocks TzHaars</small></label><br>
<label><input type="checkbox" name="lizardmen" id="lizardmen">
Reptile got ripped <small>Unlocks Lizardmen</small></label><br>
<label><input type="checkbox" name="bosses" id="bosses">
Like a boss <small>Unlocks Bosses</small></label><br>
<label><input type="checkbox" name="fossilwyverns" id="fossilwyverns">
Stop the Wyvern <small>Disables Fossil Island Wyverns</small></label><br>
</form></p>
</div>
<div class="col-6">
<p>Task blocks:</p>
@ -77,16 +75,66 @@
</ol>
</div>
</div>
<div class="col-6 text-center">
Slayer level:
<input type="text" min="1" max="99" name="slayerlevel" id="slayerlevel" maxlength="2" placeholder="99" value="99">
<div class="col-6">
<p>Quest unlocks:</p>
</div>
<div class="col-6 text-center">
<div class="col-6">
<label><input type="checkbox" id="toggleQuests" onclick="toggleQuestAll($(this))" > Completed all (or ignore quests)</label>
</div>
<div class="col-6 quests">
<form>
<label><input type="checkbox" name="quest" id="spiritcreatures">
Death Plateau <small>Unlocks Spiritual Creatures</small></label><br>
<label><input type="checkbox" name="quest" id="dragonslayer2">
Dragon Slayer II <small>Unlocks Adamant & Rune Dragons</small></label><br>
<label><input type="checkbox" name="quest" id="brinerats">
Olaf's Quest (partial) <small>Unlocks Brine Rats</small></label><br>
<label><input type="checkbox" name="quest" id="dagannoths">
Horror from the Deep <small>Unlocks Dagannoths</small></label><br>
<label><input type="checkbox" name="quest" id="darkbeasts">
Mourning's End Part II (started) <small>Unlocks Dark Beasts</small></label><br>
<label><input type="checkbox" name="quest" id="dustdevils">
Desert Treasure (started) <small>Unlocks Dust Devils</small></label><br>
<label><input type="checkbox" name="quest" id="bonevoyage">
Bone Voyage <small>Unlocks Fossil Island Wyverns</small></label><br>
<label><input type="checkbox" name="quest" id="mutatedzygomites">
Lost City <small>Unlocks Mutated Zygomites</small></label><br>
<label><input type="checkbox" name="quest" id="cabinfever">
Cabin Fever <small>Unlocks Cave & Jungle Horrors</small></label><br>
</form>
</div>
<div class="col-6 quests">
<form>
<label><input type="checkbox" name="quest" id="elves">
Regicide (Started) <small>Unlocks Elves</small></label><br>
<label><input type="checkbox" name="quest" id="feverspiders">
Rum Deal (started) <small>Unlocks Fever Spiders</small></label><br>
<label><input type="checkbox" name="quest" id="molanisks">
Death to the Dorgeshuun <small>Unlocks Molanisks</small></label><br>
<label><input type="checkbox" name="quest" id="shadowwarriors">
Legends' Quest <small>Unlocks Shadow Warriors</small></label><br>
<label><input type="checkbox" name="quest" id="dragonslayer">
Dragon Slayer <small>Unlocks Dragons (Blue, Black, Red, Iron, Steel)</small></label><br>
<label><input type="checkbox" name="quest" id="scabaras">
Contact! <small>Unlocks Minions of Scabaras</small></label><br>
<label><input type="checkbox" name="quest" id="suqahs">
Lunar Diplomacy (partial) <small>Unlocks Suqahs</small></label><br>
<label><input type="checkbox" name="quest" id="mogres">
Skippy and the Mogres (Miniquest) <small>Unlocks Mogres</small></label><br>
</form>
</div>
<div class="col-6 ">
<p>Slayer level:
<input type="text" min="1" max="99" name="slayerlevel" id="slayerlevel" maxlength="2" placeholder="99" value="99"></p>
</div>
<div class="col-6">
<input type="submit" value="Apply changes" onclick="applyChanges(currentMaster)">
</div>
</div>
<div class="row">
<div class="row pt-5">
<div class="col">
<h3 id="mastertitle"></h3>
<table id="master" class="display nowrap" width="100%">

View file

@ -6,6 +6,20 @@ function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function toggleQuestAll(source) {
checkboxes = document.getElementsByName('quest');
for(var i=0, n=checkboxes.length;i<n;i++) {
checkboxes[i].checked = source.prop("checked");
}
if (source.prop("checked") == true) {
$('.quests').hide(100);
}
else {
$('.quests').show(100);
}
}
function setBlocklists() {
// generate blocklist options, currently unused for static html
@ -27,14 +41,17 @@ function setBlocklists() {
}
$(document).ready(function() {
// starting functions on page load
applyChanges('krystilia');
toggleQuestAll($('#toggleQuests'));
});
function filterTasks(data) {
index_list = []
for (i = 0; i < data.length; i++) {
console.log(i,data[i].monster)
switch (data[i].monster.toUpperCase()) {
@ -74,9 +91,100 @@ function filterTasks(data) {
if ($("#fossilwyverns").prop("checked") == true) {
index_list.unshift(i)
}
break;
// Quest task unlocks
case 'SPIRITUAL CREATURES':
if ($("#spiritcreatures").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'RUNE DRAGONS':
case 'ADAMANT DRAGONS':
if ($("#dragonslayer2").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'BRINE RATS':
if ($("#brinerats").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'DAGANNOTHS':
if ($("#dagannoths").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'DARK BEASTS':
if ($("#darkbeasts").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'DUST DEVILS':
if ($("#dustdevils").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'FOSSIL ISLAND WYVERNS':
if ($("#bonevoyage").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'MUTATED ZYGOMITES':
if ($("#mutatedzygomites").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'CAVE HORRORS':
case 'JUNGLE HORRORS':
if ($("#cabinfever").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'ELVES':
if ($("#elves").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'FEVER SPIDERS':
if ($("#feverspiders").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'MOLANISKS':
if ($("#molanisks").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'SHADOW WARRIORS':
if ($("#shadowwarriors").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'BLUE DRAGONS':
case 'BLACK DRAGONS':
case 'RED DRAGONS':
case 'IRON DRAGONS':
case 'STEEL DRAGONS':
if ($("#dragonslayer").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'MINIONS OF SCABARAS':
if ($("#scabaras").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'SUQAHS':
if ($("#suqahs").prop("checked") == false) {
index_list.unshift(i)
}
break;
case 'MOGRES':
if ($("#mogres").prop("checked") == false) {
index_list.unshift(i)
}
}
@ -97,7 +205,6 @@ function filterTasks(data) {
}
unique_list = index_list.filter(onlyUnique);
console.log(unique_list)
for (var i in unique_list) {
console.log(data[unique_list[i]])
@ -138,6 +245,8 @@ function applyChanges(master) {
$(document).ready(function() {
table = $('#master').DataTable({
"order": [[ 2, "desc" ]],
"pageLength": 15,
"data": data,
"columns": [
{ data: 'monster'},