mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.198.1
This commit is contained in:
34
js/encountergen.js
Normal file
34
js/encountergen.js
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
class EncountersPage extends TableListPage {
|
||||
constructor () {
|
||||
super({
|
||||
dataSource: "data/encounters.json",
|
||||
|
||||
dataProps: ["encounter"],
|
||||
});
|
||||
}
|
||||
|
||||
static _COL_NAME_1 = "Encounter";
|
||||
|
||||
static _FN_SORT (a, b, o) {
|
||||
if (o.sortBy === "name") return SortUtil.ascSortEncounter(a, b);
|
||||
if (o.sortBy === "source") return SortUtil.ascSortLower(a.source, b.source) || SortUtil.ascSortEncounter(a, b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_getHash (ent) {
|
||||
return UrlUtil.encodeForHash([ent.name, ent.source, `${ent.minlvl ?? 0}-${ent.maxlvl ?? 0}-${ent.caption || ""}`]);
|
||||
}
|
||||
|
||||
_getHeaderId (ent) {
|
||||
return UrlUtil.encodeForHash([ent.name, ent.source]);
|
||||
}
|
||||
|
||||
_getDisplayName (ent) {
|
||||
return Renderer.table.getConvertedEncounterTableName(ent, ent);
|
||||
}
|
||||
}
|
||||
|
||||
const encountersPage = new EncountersPage();
|
||||
window.addEventListener("load", () => encountersPage.pOnLoad());
|
||||
Reference in New Issue
Block a user