-
Notifications
You must be signed in to change notification settings - Fork 52
/
spells.html
505 lines (412 loc) · 13.1 KB
/
spells.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
XML data was compiled by a reddit community for use with the "Fight Club 5" app.
Google "5e xml files" for more info.
Feel free to use, edit, and redistribute this as you wish.
I don't own any of the XML data anyway.
-->
<title>Spells - 5etools</title>
<link rel="stylesheet" href="css/bootstrap.css">
<style type="text/css">
header {
margin-bottom: 3px;
padding: 25px 15px;
color: white;
background-color: rgb(0, 107, 196);
}
header p.lead {
color: lightgrey;
}
main {
padding: 10px 15px;
}
footer {
padding: 20px 15px;
font-size: 90%;
}
input.search {
width: 62%;
}
form#filtertools {
font-size: 0.8em;
}
.sortlabel {
display: inline-block;
width: 49%;
float: right;
text-align: right;
}
.sortlabel span {
background: lightgrey;
border-radius: 3px;
padding: 2px;
text-align: right;
}
.sortlabel:hover span:hover {
background: grey;
color: white;
cursor: pointer;
}
ul.list {
list-style-type: none;
padding-left: 0px;
font-size: 1.1em;
height: 100%;
max-height: 250px;
overflow-y: scroll;
overflow-x: hidden;
padding-top: 1em;
}
ul.list li {
padding: 1px;
cursor: pointer;
}
ul.list li:hover {
background: lightgrey;
}
ul.list li:active {
color: white;
}
ul.list li span.source {
font-size: 0.8em;
}
ul.list li span.level, ul.list li span.classes, ul.list li span.school {
font-size: 0.8em;
margin-left: 1em;
display: none;
text-transform: capitalize;
}
ul.list li:hover span {
display: block;
}
th#name span.source {
display: inline-block;
float: right;
font-weight: 500;
margin-left: 0.5em;
}
span.sourceDMG {
color: purple;
}
span.sourceMM {
color: green;
}
span.sourceVGM {
color: grey;
}
span.sourceToD {
color: orangered;
}
span.sourceCoS {
color: purple;
}
span.sourceOotA {
color: black;
}
span.sourceSKT {
color: darkcyan;
}
span.sourcePotA {
color: blue;
}
pan.sourceLMoP {
color: lightgreen;
}
table#stats {
width: 100%;
min-width: 200px;
max-width: 400px;
background: #fdf1dc;
font-size: .9em;
table-layout: fixed;
}
table#stats td, table#stats th {
padding: 1px 0.3em;
}
table#stats th {
color: #922610;
}
table#stats span {
vertical-align: top!important;
}
th.border {
height: 10px;
background: #e69a28;
border: 1px solid black;
}
td.divider div {
background: #922610;
height: 4px;
margin: 4px 0;
}
th#name {
font-size: 1.5em;
font-family: serif;
font-weight: 500;
}
table#stats span.name {
font-weight: bold;
}
tr.text td {
padding-bottom: 0.7em!important;
color: black!important;
}
td#levelschoolritual {
font-style: italic;
}
table#stats #castingtime, table#stats #range, table#stats #components, table#stats #duration, table#stats #classes {
font-weight: bold;
}
table#stats #castingtime span, table#stats #range span, table#stats #components span, table#stats #duration span, table#stats #classes span {
font-weight: normal!important;
}
</style>
<script type="text/javascript">
function parsesize (size) {
if (size == "T") size = "Tiny";
if (size == "S") size = "Small";
if (size == "M") size = "Medium";
if (size == "L") size = "Large";
if (size == "H") size = "Huge";
if (size == "G") size = "Gargantuan";
return size;
}
function parseschool (school) {
if (school == "A") return "abjuration";
if (school == "EV") return "evocation";
if (school == "EN") return "enchantment";
if (school == "I") return "illusion";
if (school == "D") return "divination";
if (school == "N") return "necromancy";
if (school == "T") return "transmutation";
if (school == "C") return "conjuration";
return false;
}
function parsespelllevel (level) {
if (isNaN (level)) return false;
if (level === "0") return "cantrip"
if (level === "2") return level+"nd";
if (level === "3") return level+"rd";
if (level === "1") return level+"st";
return level+"th";
}
function asc_sort(a, b){
return ($(b).text()) < ($(a).text()) ? 1 : -1;
}
function dec_sort(a, b){
return ($(b).text()) > ($(a).text()) ? 1 : -1;
}
window.onload = loadspells;
function loadspells() {
tabledefault = $("#stats").html();
var spelllist = spelldata.compendium.spell;
for (var i = 0; i < spelllist.length; i++) {
var curspell = spelllist[i];
var name = curspell.name;
var leveltext = "";
if (curspell.level !== "0") leveltext = "level"
var isritual="";
if (curspell.ritual === "YES") isritual = " (ritual)";
$("ul.spells").append("<li id='"+i+"' data-link='"+encodeURI(name).toLowerCase().replace("'","")+"' data-name='"+encodeURI(name)+"'><span class='name'>"+curspell.name+"</span> <span class='level'>"+parsespelllevel(curspell.level)+" "+leveltext+isritual+"</span> <span class='school'>"+parseschool (curspell.school)+"</span> <span class='classes'>"+curspell.classes+"</span> </li>");
if (!$("select.levelfilter:contains('"+parsespelllevel(curspell.level)+"')").length) {
$("select.levelfilter").append("<option value='"+curspell.level+"'>"+parsespelllevel(curspell.level)+"</option>");
}
if (!$("select.schoolfilter:contains('"+parseschool (curspell.school)+"')").length) {
$("select.schoolfilter").append("<option value='"+parseschool (curspell.school)+"'>"+parseschool (curspell.school)+"</option>");
}
var classlist = curspell.classes.split(",");
for (var a = 0; a < classlist.length; a++) {
if (classlist[a][0] === " ") classlist[a] = classlist[a].replace(/^\s+|\s+$/g, "")
if (!$("select.classfilter option[value='"+classlist[a]+"']").length) {
$("select.classfilter").append("<option title=\""+classlist[a]+"\" value='"+classlist[a]+"'>"+classlist[a]+"</option>")
}
}
}
$("select.levelfilter option").sort(asc_sort).appendTo('select.levelfilter');
$("select.levelfilter option[value=1]").before($("select.levelfilter option[value=All]"));
$("select.levelfilter option[value=1]").before($("select.levelfilter option[value=0]"));
$("select.levelfilter").val("All");
$("select.schoolfilter option").sort(asc_sort).appendTo('select.schoolfilter');
$("select.schoolfilter").val("All");
$("select.classfilter option").sort(asc_sort).appendTo('select.classfilter');
$("select.classfilter").val("All");
var options = {
valueNames: ['name', 'level', 'school', 'classes'],
listClass: "spells"
}
var spellslist = new List("listcontainer", options);
spellslist.sort ("name")
$("ul.list li").mousedown(function(e) {
if (e.which === 2) {
console.log("#"+$(this).attr("data-link").toLowerCase())
window.open("#"+$(this).attr("data-link").toLowerCase(), "_blank").focus();
e.preventDefault();
e.stopPropagation();
return;
}
});
$("ul.list li").click(function(e) {
usespell($(this).attr("id"));
document.title = decodeURI($(this).attr("data-name")) + " - 5etools Spells";
window.location = "#"+$(this).attr("data-link").toLowerCase();
});
if (window.location.hash.length) {
$("ul.list li[data-link='"+window.location.hash.split("#")[1].toLowerCase()+"']:eq(0)").click();
} else $("ul.list li:eq(0)").click();
$("form#filtertools select").change(function(){
var levelfilter = $("select.levelfilter").val();
if (levelfilter !== "All") {
levelfilter = parsespelllevel (levelfilter);
if (levelfilter !== "cantrip") {
levelfilter = levelfilter + " level"
} else levelfilter = "cantrip ";
if ($(".ritualfilter").val() === "Rituals") levelfilter = levelfilter + " (ritual)"
} else if ($(".ritualfilter").val() === "Rituals") levelfilter = "(ritual)"
var schoolfilter = $("select.schoolfilter").val();
var classfilter = $("select.classfilter").val();
spellslist.filter(function(item) {
var rightlevel = false;
var rightschool = false;
var rightclass = false;
if (levelfilter === "All" || item.values().level.indexOf(levelfilter) !== -1) rightlevel = true;
if (schoolfilter === "All" || item.values().school === schoolfilter) rightschool = true;
var classes = item.values().classes.split(", ");
for (var c = 0; c < classes.length; c++) {
if (classes[c] === classfilter) rightclass = true;
}
if (classfilter === "All") rightclass = true;
if (rightlevel && rightschool && rightclass) return true;
return false;
});
});
}
function usespell (id) {
$("#stats").html(tabledefault);
var spelllist = spelldata.compendium.spell;
var curspell = spelllist[id];
$("th#name").html(curspell.name);
$("td span#school").html(parseschool(curspell.school));
if (curspell.level === "0") {
$("td span#school").css('textTransform', 'capitalize');
$("td span#level").css('textTransform', 'lowercase!important');
$("td span#level").html(" cantrip").detach().appendTo("td span#school");
} else {
$("td span#school").css('textTransform', 'lowercase');
$("td span#level").html(parsespelllevel (curspell.level)+"-level");
}
if (curspell.ritual === "YES") {
$("td span#ritual").show();
} else $("td span#ritual").hide();
$("td#components span").html(curspell.components)
$("td#range span").html(curspell.range)
$("td#castingtime span").html(curspell.time)
$("td#duration span").html(curspell.duration)
$("tr.text").remove();
var textlist = curspell.text;
var texthtml = "";
if (textlist[0].length === 1) {
texthtml = "<p>"+textlist+"</p>";
} else for (var i = 0; i < textlist.length; i++) {
if (!textlist[i]) continue;
texthtml = texthtml + "<p>"+textlist[i].replace("At Higher Levels: ", "<strong>At Higher Levels:</strong> ").replace("This spell can be found in the Elemental Evil Player's Companion","")+"</p>";
}
$("tr#text").after("<tr class='text'><td colspan='6' class='text"+i+"'>"+texthtml+"</td></tr>");
$("td#classes span").html(curspell.classes);
return;
};
</script>
</head>
<body>
<header class="hidden-xs hidden-sm">
<div class="container">
<h1>Spells List</h1>
<p>Search by name on the left, click spell name to display on the right.</p>
</div>
</header>
<nav class="container">
<ul class="nav nav-pills">
<li role="presentation"><a href="5etools.html">5eTools</a></li>
<li role="presentation"><a href="classes.html">Classes</a></li>
<li role="presentation"><a href="bestiary.html">Bestiary</a></li>
<li role="presentation"><a href="items.html">Items</a></li>
<li role="presentation"><a href="backgrounds.html">Backgrounds</a></li>
<li role="presentation"><a href="feats.html">Feats</a></li>
<li role="presentation"><a href="races.html">Races</a></li>
<li role="presentation" class="active"><a href="spells.html">Spells</a></li>
<li role="presentation"><a href="crcalculator.html">CR Calc</a></li><li role="presentation"><a href="http://kobold.club" target="_blank" title="I could literally never build something better than Kobold Fight Club">Encounter Builder</a></li>
</ul>
</nav>
<main class="container bodyContent">
<div class="row">
<div class="col-sm-6" id="listcontainer">
<h3><input type="search" id="search" class="search" placeholder="Find spell..."></h3>
<form id="filtertools">
<span class="sortlabel">
<span class="sort" data-sort="name">Name</span>
<span class="sort" data-sort="level">Level</span>
<span class="sort" data-sort="school">School</span>
</span>
<select class="levelfilter">
<option value="All">All Levels</option>
</select>
<select class="ritualfilter">
<option value="All">All Spells</option>
<option value="Rituals">Rituals Only</option>
</select>
<select class="schoolfilter">
<option value="All">All Schools</option>
</select>
<select class="classfilter">
<option value="All">All Classes</option>
</select>
</form>
<ul class="list spells" style="height: 100%; max-height: 600px; overflow-y: auto; overflow-x: visible; padding-top: 1em;">
</ul>
</div>
<div class="col-sm-6">
<div style="height: 100%; max-height: 660px; overflow-y: auto; overflow-x: visible; padding-top: 1em;">
<table id="stats">
<tr><th class="border" colspan="6"></th></tr>
<tr>
<th id="name" colspan="6">Name</th>
</tr>
<tr>
<td id="levelschoolritual" colspan="6"><span id="level">1st-level</span> <span id="school">evocation</span> <span id="ritual">(ritual)</span></td>
</tr>
<tr>
<td id="castingtime" colspan="6">Casting Time: <span>1 action</span></td>
</tr>
<tr>
<td id="range" colspan="6">Range: <span>30 feet</span></td>
</tr>
<tr>
<td id="components" colspan="6">Components: <span>V, S, M (salt)</span></td>
</tr>
<tr>
<td id="duration" colspan="6">Duration: <span>Concentration, up to 1 minute</span></td>
</tr>
<tr id="text"><td class="divider" colspan="6"><div></div></td></tr>
<tr>
<td id="classes" colspan="6">Classes: <span>wizard</span></td>
</tr>
<tr><th class="border" colspan="6"></th></tr>
</table>
</div>
</div>
</div>
</main>
<!--
All the embedded crap.
Would load it in but I want this for offline use too
-->
<script type="text/javascript" src="data/spells.json"></script>
<script type="text/javascript" src="js/list.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
</body>
</html>