Skip to content

Commit e4eec53

Browse files
authored
add ruleset page with filter - basic (#226)
1 parent 228194f commit e4eec53

File tree

5 files changed

+320
-0
lines changed

5 files changed

+320
-0
lines changed

data/play

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Landing Page
2+
this is land.
3+
## Introductory Poem on Mythmancers (Lore, title TBD)
4+
we myth and we mance\
5+
what is a rule anyway?\
6+
we dith and we dance
7+
## Description
8+
i describe now.
9+
# Character Creation
10+
how create? read -
11+
## Character Creation Steps
12+
step by step
13+
### Choose a Race
14+
racist
15+
### Choose a Class
16+
classist
17+
### Assign Abilities
18+
ableist
19+
### Choose Skills
20+
ableist
21+
### For Warriors - Choose a Fighting Style
22+
Monkey style?
23+
24+
Dragon style
25+
26+
Kung pao
27+
### For Adepts - Choose Spells
28+
A-A-R-D-V-A-R-K
29+
30+
W-O-N-T-O-N-L-Y
31+
## Races
32+
off to the races!
33+
### Gaeans
34+
who are these little green ghouls?
35+
#### Gaean
36+
little green ghouls buddy
37+
#### Cyclopes
38+
but these ones also one eye
39+
### Telon
40+
nortel
41+
#### Stream Telon
42+
if you have bandwidth
43+
paragraph2
44+
#### Great River Telon
45+
the big one over there
46+
#### Mountain Telon
47+
mounties! so cute!
48+
#### Kyma
49+
comma,,,
50+
### Oroi
51+
you or i
52+
53+
me or you
54+
55+
beep beep boop
56+
#### Ceramic Orid
57+
don't drop them
58+
#### Metallic Orid
59+
you can drop them
60+
### Dendroids
61+
roided up
62+
#### Tree Dendrid
63+
up there
64+
#### Fern Dendrid
65+
down there
66+
## Classes
67+
K-12. All free.\
68+
Paid for by K-A-R-S Cars for Kids
69+
### Warriors
70+
They do the bing bing bong bong
71+
#### Fighter
72+
smash
73+
melee
74+
oh, all mario?
75+
#### Ranger
76+
bow. arrow. track. look. legolas.
77+
#### Knight
78+
can't use in the daylight.
79+
80+
keeps saying "ni". look into this. bug?
81+
### Rogues
82+
bad fellas
83+
#### Rogue (?)
84+
bad fella (?)
85+
#### Scout
86+
eagle. boy. girl. many!
87+
#### Seeker
88+
flappy little thing.
89+
what a creature!
90+
### Adepts
91+
very very very good at what they do
92+
#### Adept (?)
93+
very very very good at what it does (?)
94+
#### Cleric
95+
like the error
96+
#### Magician
97+
pick a card, any card
98+
## Abilities
99+
can make you pick a card
100+
## Skills
101+
can make you pick a card
102+
### Athletics (STR)
103+
run!!!!!
104+
### Swimming (STR)
105+
run, in water
106+
### Lock Picking (DEX)
107+
run, through a door (once opened)
108+
### Stealth (DEX)
109+
run, but no-one knows
110+
### Appraisal (INT)
111+
run the numbers
112+
### Husbandry (INT)
113+
run the labs and ... uh, oh this what this is?
114+
### History (INT)
115+
run down memory lane
116+
### Literacy (INT)
117+
ijoijigrunaeijosgdfoiurag
118+
### Nature (INT)
119+
can't spell "nature" without "run"
120+
### Tactics (INT)
121+
run through the scenarios
122+
### Animism (WIS)
123+
tree trunk has life
124+
### Perception (WIS)
125+
see someone run
126+
### Tracking (WIS)
127+
see if someone has run
128+
### Influence (CHA)
129+
run into someone's heart or brain
130+
### Performance (CHA)
131+
run well
132+
### Adepts - Counter Casting (WIS)
133+
jib
134+
135+
jab
136+
137+
jeb!
138+
### Adepts - Concentration (CON)
139+
think thinky...
140+
### Adepts - Discreet Casting (DEX)
141+
Diss Crete if you want war
142+
### Advanced Skill - Medicine (INT)
143+
Lol like leeches?
144+
### Advanced Skill - Poisons (INT)
145+
Bad stuff! Cures COVID.
146+
### Other Skills
147+
just some stuff
148+
## Equipment
149+
you have these
150+
### Weapons
151+
you whack with these
152+
### Armor
153+
you get whacked on these
154+
### Gear
155+
you you use these. humans use tools. figure it out.
156+
## Fighting Styles
157+
good, bad, medium
158+
### Defensive
159+
if you're a loser
160+
### Offensive
161+
if you're a winner
162+
### Archery
163+
if you're a coward. what're you doing back there
164+
### Special Training
165+
higher education
166+
## Spells
167+
yes i dpo!
168+
### Patrons and Starting Spells
169+
god #1
170+
171+
god #2
172+
173+
TODObug
174+
### Further Reading on Patrons and Spells
175+
you nerd
176+
## Optional Character Details
177+
don't read if you don't want to
178+
### Trade Skills and Professions
179+
don't trade your skills
180+
### Wages and Cost of Living
181+
wage war, not money
182+
### Origins and Further Reading
183+
you nerd (again)
184+
# Experience, Training, and Leveling Up
185+
happens once in a while
186+
## Experience Points and Training Points
187+
goes up one
188+
## Leveling Up
189+
goes up one, slower
190+
## Optional Rule - Talented Characters
191+
if you're that type A
192+
## Beyond Level 10 - Heroic Characters
193+
if you're that old, boomer
194+
# Spells
195+
GORDWUORK
196+
197+
WOMPOMLY
198+
## Spellcasting Basics
199+
step 1. spell\
200+
step 2. cast
201+
## Adept Spellcasting Skills
202+
If you're really really good!
203+
## Metamagic
204+
You can cast the spell on this line if you want.
205+
## Patrons
206+
Has this person been to your bar?
207+
## Spells by Degree
208+
celsius or fahrenheit? :(
209+
# Gameplay
210+
ok finally you go
211+
## Hit Points and Wounds
212+
ouchie!
213+
214+
bone hurting juice!
215+
## Saving Throws
216+
will protect you. or not. roll die and see.
217+
## Skill and Ability Checks
218+
will help you. or not. roll die and see.
219+
## Exploration, Turns, and Random Encounters
220+
this part is fun sometimes.
221+
## Ambush and Surprise
222+
this part if fun sometimes.
223+
## Combat, Rounds, and Initiative
224+
Wombat, sounds, municipality

docs/static/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ body.character-sheet {
113113
margin: 0;
114114
}
115115

116+
.writing h4 {
117+
color: #549171;
118+
margin: 0;
119+
}
120+
116121
.writing p {
117122
margin: 0;
118123
}

sitemap.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"template": "template_character_sheet_v2.html",
1717
"data_type": "json"
1818
},
19+
{
20+
"route": "play",
21+
"title": "play rules",
22+
"template": "template_ruleset.html",
23+
"data_type": "markdown"
24+
},
1925
{
2026
"title": "character creation",
2127
"route": "character-creation",

templates/ruleset_filter.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const SEARCH_TAG_NAMES = ["h1", "h2", "h3", "h4", "h5", "h6", "p"];
2+
const SEARCH_BAR_ID = "searchBar";
3+
let RULESET_ELEMENTS = null;
4+
let NODE_MAP = null;
5+
6+
function treeifyHeaders() {
7+
const stack = [{domNode: {tagName: "H0"}, children: [], parent: null}];
8+
const nodeMap = new Map();
9+
const rulesetElements = document.querySelectorAll(SEARCH_TAG_NAMES.join(","))
10+
for (const rulesetElement of rulesetElements) {
11+
const node = {
12+
domNode: rulesetElement,
13+
children: [],
14+
parent: null
15+
};
16+
17+
// find parent header; happens to work because "P" > "H6"
18+
let last = stack.at(-1);
19+
while (last.domNode.tagName >= node.domNode.tagName) {
20+
stack.pop();
21+
last = stack.at(-1);
22+
}
23+
last.children.push(node);
24+
node.parent = last;
25+
stack.push(node);
26+
nodeMap[`${node.domNode.tagName}-${node.domNode.textContent}`] = node;
27+
}
28+
return [rulesetElements, nodeMap];
29+
};
30+
31+
function getAllChildren(node) {
32+
return node.children.reduce((acc, child) => acc.concat(child, getAllChildren(child)), []);
33+
}
34+
35+
function getAllParents(node) {
36+
return node.parent ? [node.parent].concat(getAllParents(node.parent)) : [];
37+
}
38+
39+
function filterRuleset() {
40+
const filter = this.value.toLowerCase().trim();
41+
if (filter == "") {
42+
RULESET_ELEMENTS.forEach(rulesetElement => {
43+
rulesetElement.classList.remove("hidden");
44+
});
45+
return;
46+
}
47+
48+
const toShow = new Set();
49+
RULESET_ELEMENTS.forEach(rulesetElement => {
50+
if (rulesetElement.textContent.toLowerCase().includes(filter)) {
51+
toShow.add(rulesetElement);
52+
const headingTreeNode = NODE_MAP[`${rulesetElement.tagName}-${rulesetElement.textContent}`];
53+
54+
// if a heading matches, all content under it should be shown
55+
getAllChildren(headingTreeNode).forEach(child => {
56+
toShow.add(child.domNode);
57+
});
58+
59+
// if any element matches, all the headings leading to it should be shown
60+
getAllParents(headingTreeNode).forEach(parent => {
61+
toShow.add(parent.domNode);
62+
});
63+
}
64+
});
65+
66+
RULESET_ELEMENTS.forEach(rulesetElement => {
67+
if (!toShow.has(rulesetElement)) {
68+
rulesetElement.classList.add("hidden");
69+
} else {
70+
rulesetElement.classList.remove("hidden");
71+
}
72+
});
73+
}
74+
75+
window.onload = function() {
76+
[RULESET_ELEMENTS, NODE_MAP] = treeifyHeaders();
77+
document.getElementById(SEARCH_BAR_ID).addEventListener("input", filterRuleset);
78+
}

templates/template_ruleset.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% include './header.html' %}
2+
<script>{% include './ruleset_filter.js' %}</script>
3+
<div class="writing">
4+
<input type="text" id="searchBar" placeholder="Search rules...">
5+
{{ data }}
6+
</div>
7+
{% include './footer.html' %}

0 commit comments

Comments
 (0)