-
Notifications
You must be signed in to change notification settings - Fork 1
/
coriolis_npc_generator.html
82 lines (78 loc) · 4.7 KB
/
coriolis_npc_generator.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style type="text/css">
html, body {
font-family: 'Arial', sans-serif;
padding: 5% 20%;
}
.npc {
margin-bottom: 1em;
width: 100%;
overflow: hidden;
}
.name {
font-weight: bold;
}
.profession, .characteristic, .activity {
float: left;
margin-right: .5em;
padding-right: .5em;
border-right: 1px solid black;
}
.activity {
border-right: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// First, checks if it isn't implemented yet.
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
$("#generate").click(function(){ getNPCs(); });
getNPCs();
});
var firstNames = ['Awadah','Youssouf','Arib','Mojiz','Loubna','Lila','Zinah','Ghina','Ayham','Aziz','Abdelmajid','Jihane','Nihale','Jasmin','Hayyan','Zitane','Mimoun','Hamza','Younes','Aisha','Alina','Amira','Jaul','Fayaaz','Badria','Fadma','Yara','Mehrak','Nivrod','Davood','Noushineh','Mava','Sima','Shervan','Taba','Parvaneh'];
var lastNames = ['Soleymani','Motiwala','Subedar','Shahidi','Akalay','Saqqat','Maadawi','Mansouri','Serhane','Bourkia','Ben','Chafik','Abdessalam','Ghallab','Salama','Mallak','Ammar','Niazi','Mahdi','Arinites','Khalaf','Halaby','Gupta','Ahantem','Chanda','Sabharwal','Kamath','Saha','Mahar','Hamadani','Karra','Karali','Rega','Maroun','Shalhoub','Irides'];
var professions = ['Guard','Baker','Pilot','Peddler','Tailor','Medicurg','Soldier','Street urchin','Homeless','Chef','Jelloun','Deckhand','Officer','Noble','Agent','Courtesan','Artist','Poet','Writer','Student','Child','Mystic','Priest','Scientist','Archaeologist','Academic','Thief','Gang member','Assassin','Waiter','Prospector','Pilgrim','Judicator','Samaritan','Captain','Criminal'];
var characteristics = ['Fat','Skinny','Good-looking','Seductive','Smells bad','Smells good','Tall','Short','Always smiling','Moping','Stevedore','Depressed','Always joking','Hums','Clicks mouth','Fiddles with something','Tired','Lovesick','Elegant','Bejeweled','Tattooed','Grand hairstyle','Bearded','Bio sculpted','Cyber eye','Cyber arm','Always eating','In despair','Hateful','Walks with a limp','Broken nose','Sweaty','Perfumed','Drunk','Slow','Suspicious'];
var activities = ['Searching','Making friends','Rambling tediously','Flirts','Looking for a fight','On a stroll','Working','Chasing something','Is lost','Guarding something','Brat Drinking','Partying','Eating','Bickering','In a discussion','Studying','Reading','Resting','Mending something','Showing something','Staring','Hanging out','Smoking','Writing','Preaching','Hiding','Sleeping','On a delivery','Looking to sell something','Using a tabula','Collapsing','Stealing something','Praying to an Icon','Threatening someone','Helping someone','Getting into trouble'];
function getNPCs(count=10) {
$("#npcs").empty();
for (let index = 0; index < count; index++) {
getNPC();
}
}
function getNPC() {
var firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
var lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
var profession = professions[Math.floor(Math.random() * professions.length)];
var characteristic = characteristics[Math.floor(Math.random() * characteristics.length)];
var activity = activities[Math.floor(Math.random() * activities.length)];
var npc = `<div class="npc">
<div class="name">{0} {1}</div>
<div class="profession">{2}</div>
<div class="characteristic">{3}</div>
<div class="activity">{4}</div>
</div>`.format(
firstName, lastName, profession, characteristic, activity);
$("#npcs").append(npc);
}
</script>
</head>
<body>
<button id="generate">Generate NPCs</button>
<div id="npcs"></div>
</body>
</html>