-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
64 lines (55 loc) · 4.9 KB
/
main.js
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
/*
Interactive Obra Dinn Crew List
-------------------------------
This JavaScript file functions purely
to generate the HTML for the crew list.
It is not intended to be used as a
standalone script.
*/
const url = 'https://sondregronas.github.io/obra-dinn-interactive-crew-list/'
const crew = ['1', 'Robert Witterel', 'Captain', 'England', '2', 'William Hoscut', 'First Mate', 'Scotland', '3', 'Edward Nichols', 'Second Mate', 'England', '4', 'Martin Perrott', 'Third Mate', 'England', '5', 'John Davies', 'Fourth Mate', 'England', '6', 'Alfred Klestil', 'Bosun', 'Austria', '7', 'Charles Miner', "Bosun's Mate", 'France', '8', 'Henry Evans', 'Surgeon', 'England', '9', 'James Wallace', "Surgeon's mate", 'England', '10', 'Winston Smith', 'Carpenter', 'America', '11', 'Marcus Gibbs', "Carpenter's Mate", 'America', '12', 'Thomas Sefton', 'Cook', 'England', '13', "Emil O'Farrell", 'Butcher', 'Ireland', '14', 'Christian Wolff', 'Gunner', 'Austria', '15', 'Olus Wiater', "Gunner's Mate", 'Poland', '16', 'Duncan McKay', 'Purser', 'Scotland', '17', 'Finley Dalton', 'Helmsman', 'England', '18', 'Edward Spratt', 'Artist', 'England', '19', 'Abigail Hoscut Witterel', 'Passenger', 'Scotland', '20', 'Nunzio Pasqua', 'Passenger', 'Italy', '21', 'Emily Jackson', 'Passenger', 'England', '22', 'Jane Bird', 'Passenger', 'England', '23', 'Bun-Lan Lim', 'Passenger', 'Formosa', '24', 'It-Beng Sia', 'Passenger', 'Formosa', '25', 'Chioh Tan', 'Passenger', 'Formosa', '26', 'Hok-Seng Lau', 'Passenger', 'Formosa', '27', 'Zungi Sathi', "Ship's Steward", 'India', '28', 'Fillip Dahl', "Captain's Steward", 'Sweden', '29', 'Paul Moss', "1st Mate's Steward", 'Wales', '30', 'Samuel Galligan', "2nd Mate's Steward", 'Ireland', '31', 'Roderick Andersen', "3rd Mate's Steward", 'England', '32', 'Davey James', "4th Mate's Steward", 'England', '33', 'Peter Milroy', 'Midshipman', 'England', '34', 'Thomas Lanke', 'Midshipman', 'England', '35', 'Charles Hershtik', 'Midshipman', 'England', '36', 'Omid Gul', 'Topman', 'Persia', '37', 'Timothy Butement', 'Topman', 'Scotland', '38', 'Huang Li', 'Topman', 'China', '39', 'Jie Zhang', 'Topman', 'China', '40', 'Li Hong', 'Topman', 'China', '41', 'Wei Lee', 'Topman', 'China', '42', 'Nicholas Botterill', 'Topman', 'England', '43', 'Maba', 'Topman', 'New Guinea', '44', 'Lewis Walker', 'Topman', 'England', '45', 'Leonid Volkov', 'Topman', 'Russia', '46', 'Alarcus Nikishin', 'Seaman', 'Russia', '47', 'Aleksei Toporov', 'Seaman', 'Russia', '48', 'Nathan Peters', 'Seaman', 'England', '49', 'Lars Linde', 'Seaman', 'Denmark', '50', 'John Naples', 'Seaman', 'Wales', '51', 'Renfred Rajub', 'Seaman', 'India', '52', 'Abraham Akbar', 'Seaman', 'India', '53', 'William Wasim', 'Seaman', 'India', '54', 'Soloman Syed', 'Seaman', 'India', '55', 'Hamadou Diom', 'Seaman', 'Siera Leona', '56', 'Henry Brennan', 'Seaman', 'England', '57', 'Alexander Booth', 'Seaman', 'England', '58', "Patrick O'Hagan", 'Seaman', 'Ireland', '59', 'George Shirley', 'Seaman', 'England', '60', 'Samuel Peters', 'Seaman', 'England']
const crewDict = [];
for (let i = 0; i < crew.length; i+=4) {
crewDict.push({'id': crew[i], 'name': crew[i+1], 'quality': crew[i+2], 'origin': crew[i+3]});
}
const countries = ['Africa', 'Atlantic Island', 'Azores', 'Canary Islands', 'Cape Verde', 'East Indies', 'Europe', 'Middle East', 'United Kingdom', 'West Indies']
const crushed = {
'Beast': 'terrible beast.',
'Cannon': 'loose cannon.',
'Cargo': 'falling cargo.',
'Rigging': 'falling rigging.',
'Stones': 'falling stones.',
}
const targets = ['Unknown', 'Enemy', 'Beast']
targets.push({'name': 'Unknown', 'quality': 'Officer'})
for (let i = 0; i < 18; i++) {targets.push(crewDict[i])}
targets.push({'name': 'Unknown', 'quality': 'Passenger'})
for (let i = 18; i < 26; i++) {targets.push(crewDict[i])}
targets.push({'name': 'Unknown', 'quality': 'Steward'})
for (let i = 26; i < 32; i++) {targets.push(crewDict[i])}
targets.push({'name': 'Unknown', 'quality': 'Midshipman'})
for (let i = 32; i < 35; i++) {targets.push(crewDict[i])}
targets.push({'name': 'Unknown', 'quality': 'Topman'})
for (let i = 35; i < 45; i++) {targets.push(crewDict[i])}
targets.push({'name': 'Unknown', 'quality': 'Seaman'})
for (let i = 45; i < 60; i++) {targets.push(crewDict[i])}
const fates = {
'Unknown': {'text': 'met an unknown fate'},
'Alive': {'text': '', 'choices': countries, 'prefix': 'is alive in '},
'Axed': {'text': 'was axed', 'targets': targets},
'Burned': {'text': 'burned to death.'},
'Clawed': {'text': 'was clawed by a terrible beast.'},
'Clubbed': {'text': 'was clubbed', 'targets': targets},
'Crushed': {'text': 'was crushed', 'choices': crushed}, //
}
const port = 3000;
const express = require('express');
const app = express();
app.set('view engine', 'pug');
app.use(express.static('docs'));
app.get('/', (req, res) => {
res.render('index', {crew: crewDict, href: url});
});
app.listen(port, () => {
console.log(`App listening at http://localhost:${port}`)
});