-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwfrp-random-inn.html
413 lines (366 loc) · 10.5 KB
/
wfrp-random-inn.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
<!DOCTYPE html>
<html lang="en">
<head><title>WFRP 4th Edition Random Treasure</title>
<script>
var FIERCEANIMAL = [
["Gryphon"],
["Dragon"],
["Lion"],
["Eagle"],
["Panther"],
["Bear"],
["Wolf"],
["Boar"]
];
var ANIMAL = [
["Snake"],
["Fish"],
["Horse"],
["Dog"],
["Seagull"],
["Frog"],
["Rat"],
["Pig"],
["Donkey"],
["$FIERCEANIMAL"],
["$FIERCEANIMAL"],
["$FIERCEANIMAL"]
];
var COLOUR = [
["Purple"],
["Red"],
["Blue"],
["White"],
["Black"],
["Gray"],
["Yellow"],
["Tan"],
["Green"],
["Brown"]
];
var ADJETIVE = [
["Golden"],
["Silver"],
["Dancing"],
["Hanged"],
["Happy"],
["Thirsty"],
["$COLOUR"]
];
var REST = [
["Solace"],
["Sleep"],
["Retreat"]
];
var NOBLE = [
["Crown"],
["Emperor"],
["Empress"],
["Count"],
["Elector"],
["Graf"]
];
var WHSTUFF = [
["Comet"],
["Skull"],
["Heart"],
["Feather"],
["Hourglass"]
];
var PERSON = [
["$NOBLE"],
["Estalian"],
["Bretonian"],
["Tilean"],
["Rover"],
["Rover"],
["Minstrel"]
];
var CREATURE = [
["Goblin"],
["Troll"],
["Giant"],
["Ogre"],
["Halfling"],
["Dwarf"]
];
var NAME = [
["$ANIMAL"],
["$FIERCEANIMAL"],
["$NOBLE"],
["$PERSON"],
["$WHSTUFF"],
["$CREATURE"]
];
var MAYBETHE = [
["The"],
["The"],
[""]
];
var MAYBEAPS = [
[""],
[""],
["'s"]
];
var MAYBEPLACE = [
["Tavern"],
["Inn"],
["Inn"],
["Coaching Inn"],
[""],
[""]
];
var SIZE= [
["small"],
["medium sized"],
["large"]
];
var WALLMATERIAL = [
["wooden"],
["stone"],
["brick"]
];
var DRINKQUALITY = [
["watered"],
["strong"],
["piss-poor"],
["spicy"],
["strong"],
["excelent"]
];
var DRINKTYPE= [
["drinks"],
["ales"],
["ales"],
["beer"],
["wines"],
["bretonian wines"]
];
var PIEFILLING = [
["venison meat"],
["beff"],
["onions and rabbit"],
["mistery meat"],
["pork and cabbage"],
["spicy chicken and leeks"],
["minced lamb and carrots"],
["curried goat and root vegetables"],
["beer braised turnips and black beans"]
];
var DISH = [
["eel filets marinated in vinegar, sugar, and spices, and served chilled with a side of black bread."],
["blood Sausage, a hearty sausage made with pig's blood and barley, spiced with cloves, nutmeg, and pepper."],
["\“Hag\'s Stew\”, a thick stew made with chunks of beef, turnips, carrots, and onions, with a mysterious and pungent flavor."],
["dried river fish jerky, chewy and salty, served with a small glass of snaps."],
["creamy mushroom soup served in a bread bowl."],
["venison or will board roast with root vegetables and gravy."],
["a lentils and onions soup with chicken and eggs on it."],
["dried meats, hard cheese and stale bread as its only food option."],
["a casserole made with pieces of presumably rabbit, mushrooms, onions, and garlic, served piping hot."]
];
var BOUNCER = [
["ogre"],
["armoured dwarf"],
["scarred veteran"],
["ex-pit figther"],
["halfling wielding too-many-knives"]
];
var GAME = [
["Al-Zahr, a game of dice"],
["Alvatafl, a board game"],
["arm-wrestling matches"],
["Beast Among the Tailors, a popular skittle game"],
["bowls"],
["Bull Ring, a ring tossing game"],
["cards with a Reiklander Tarock deck"],
["cards with a Reiklander Tarock deck"],
["cards with a Wissen Trioki deck"],
["Cerevis, a card and drinking game"],
["darts"],
["dominoes"],
["Dwile Flonking, a wild dancing game"],
["Mühlen, a board game"],
["pub quizzes"],
["Scarlet Empress, a card game"],
["Stones, a board game"],
["arm-wrestling matches"],
];
var COVERED = [
["in murals depicting famous battles"],
["with paitings of hunting scenes"],
["with beautiful tapestries"],
["with grime and soot from years of pipe smoking by the patrons."],
["with grim trophies, such as skulls and weapons taken from vanquished foes"]
];
var ALLSTRINGS = [
["$MAYBEPLACE",MAYBEPLACE],
["$MAYBETHE",MAYBETHE],
["$MAYBEAPS",MAYBEAPS],
["$NAME",NAME],
["$ANIMAL",ANIMAL],
["$FIERCEANIMAL",FIERCEANIMAL],
["$COLOUR",COLOUR],
["$CREATURE",CREATURE],
["$ADJETIVE",ADJETIVE],
["$NOBLE",NOBLE],
["$PERSON",PERSON],
["$WHSTUFF",WHSTUFF],
["$REST",REST],
["$SIZE",SIZE],
["$WALLMATERIAL",WALLMATERIAL],
["$GAME",GAME],
["$PIEFILLING",PIEFILLING],
["$DISH",DISH],
["$BOUNCER",BOUNCER],
["$DRINKQUALITY",DRINKQUALITY],
["$COVERED", COVERED],
["$DRINKTYPE",DRINKTYPE]
];
var Inns = [
["The $NAME $MAYBEPLACE."],
["The $NAME $MAYBEPLACE."],
["$MAYBETHE $ADJETIVE $NAME $MAYBEPLACE."],
["The $NAME and the $NAME $MAYBEPLACE."],
["The $ADJETIVE $NAME and the $ADJETIVE $NAME $MAYBEPLACE."],
["The $ADJETIVE $PERSON$MAYBEAPS $REST $MAYBEPLACE."],
["The $NOBLE$MAYBEAPS $REST $MAYBEPLACE."]
];
var InnStuff = [
["A $SIZE establishment surrounded by a $WALLMATERIAL wall."],
["It's famous for its $DRINKQUALITY $DRINKTYPE."],
["Inside always seems to be people playing $GAME."],
["It's guarded by a $BOUNCER bouncer."],
["They serve halfling-made pies filled with $PIEFILLING."],
["They are have an specility dish, $DISH"],
["The place has a stable and offers horse rentals for guests."],
["The walls are covered $COVERED."]
];
var RoomOffer =[
["It offers private rooms (10 s) and really cheap common rooms (3 d)."],
["It offers private rooms (10 s) and common rooms (10 d)."],
["It offers fine private rooms (1 gc) and average common rooms (10 d)."],
["It offers average (10 s) and fine private rooms (1 gc)."]
];
var InnType = -1;
function roll1d10(){
"use strict";
return Math.floor(Math.random() * 10) + 1;
}
function roll2d10(){
"use strict";
return Math.floor(Math.random() * 10) + Math.floor(Math.random() * 10) + 2;
}
function rollXd10(x){
"use strict";
var j;
var roll= 0;
for (j = 0; j < x; j += 1) {
roll += roll1d10();
}
return roll;
}
function roll1d100(){
"use strict";
return Math.floor(Math.random() * 100) + 1;
};
function removedoublespaces (str) {
"use strict";
str = str.replace(/ +(?= )/g,'');
str = str.replace(/ \./g,'.');
return str;
};
function aanmanagement( str) {
"use strict";
var strnew = str.replace(/\b(a)\s([aeiou])/ig,'$1n $2');
strnew = strnew.replace(/\b(a)\s<I>([aeiou])/ig,'$1n <I>$2');
return strnew;
};
function parsequalities(originalString) {
var notdone = 1;
while (notdone) {
notdone = 0;
for(var i=0; i < ALLSTRINGS.length; i++){
var lookingfor = ALLSTRINGS[i][0];
var strings = ALLSTRINGS[i][1];
var randomnumber = Math.floor(Math.random() * strings.length) ;
var replacement = strings[ randomnumber ][0];
if (originalString.includes(lookingfor) == true) {
notdone = 1;
};
var originalString = originalString.replace( lookingfor , replacement);
};
};
var parsedString = aanmanagement(removedoublespaces(originalString));
return parsedString;
};
function randomInn (InnType){
if (InnType == -1) {
InnType = Math.floor(Math.random() * Inns.length) + 1;
};
var innst = Inns[Math.floor(Math.random() * Inns.length)];
return innst[0];
};
function randomDesc (InnType){
if (InnType == -1) {
InnType = Math.floor(Math.random() * InnStuff.length) + 1;
};
var inn = InnStuff[Math.floor(Math.random() * InnStuff.length)][0] + "<br>" + RoomOffer[Math.floor(Math.random() * RoomOffer.length)][0] ;
return inn;
};
function generateInn ( tt) {
var amount = amountInput.value;
if (isNaN(amount)) {
amount = 3;
} else {
amount = Math.min(parseInt(amount,10), 15);
amount = Math.max(amount, 1);
};
document.getElementById("amountInput").value = amount;
for(j=0; j < amount; j++){
var inn = randomInn(tt);
var parsedinn = parsequalities(inn);
var desc = randomDesc(tt);
var parseddescription = parsequalities(desc);
var finalString = "<h3>"+parsedinn+"</h3>"+parseddescription;
var innTargetText = "InnB"+(j+1);
document.getElementById(innTargetText).innerHTML = finalString;
};
};
</script>
</head>
<body>
<h1>Generate Inn</h1>
<h2>WFRP Random Inn Generator</h2>
<p>This is a simple Inn generator, still mostly WIP.<br>
If you need people you might meet inside check my <a href="https://pacomiscelaneousstuff.blogspot.com/2019/08/npc-generator.html">NPC Generator</a> to create Merchants, Scholar, Soldiers and similar citizens.<br>
If you need a more dangerous set you might check my <a href="https://pacomiscelaneousstuff.blogspot.com/2019/08/monster-generator.html">Monster Generator</a> to create Mutants, Orcs, Goblins or worse.<br>
To have a more detailed Old Worlders you can use the list of my <a href="https://pacomiscelaneousstuff.blogspot.com/2018/09/generic-npc-stats-for-4th-edition.html">Generic NPCs stats for 4th edition</a>.<br>
You can also create the loot carried by them using my <a href="https://pacomiscelaneousstuff.blogspot.com/2019/08/treasure-generator.html">Random Treasure Generator</a>.
</p>
<button type="button" onclick="generateInn(-1)">Generate Now!</button><br> <label>Amount : <input type="text" maxlength="2" value= "5" size="2" id="amountInput"/></label><br>
<p id="InnB1"> </p>
<p id="InnB2"> </p>
<p id="InnB3"> </p>
<p id="InnB4"> </p>
<p id="InnB5"> </p>
<p id="InnB6"> </p>
<p id="InnB7"> </p>
<p id="InnB8"> </p>
<p id="InnB9"> </p>
<p id="InnB10"> </p>
<p id="InnB11"> </p>
<p id="InnB12"> </p>
<p id="InnB13"> </p>
<p id="InnB14"> </p>
<p id="InnB15"> </p>
<div class="separator" style="clear: both;"><a href="https://1.bp.blogspot.com/-CxW7zgDSHlA/YBJ6Mt6A_WI/AAAAAAAAtiE/byt2ZxlNVDoe9VoS3B4kgiuR3dQ7Q8fLQCLcBGAsYHQ/s2048/20210128_094554.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="200" data-original-height="1637" data-original-width="2048" src="https://1.bp.blogspot.com/-CxW7zgDSHlA/YBJ6Mt6A_WI/AAAAAAAAtiE/byt2ZxlNVDoe9VoS3B4kgiuR3dQ7Q8fLQCLcBGAsYHQ/s200/20210128_094554.jpg"/></a></div>
<p id="Acknowledgements">Code: Francisco Muñoz 2019.
<br>Game: Games Worshop and Cubicle 7
<br>Core WFRP 4th edition book: <a href="https://www.drivethrurpg.com/product/248284/Warhammer-Fantasy-Roleplay-Fourth-Edition-Rulebook?affiliate_id=91369">Warhammer Fantasy Roleplay Fourth Edition Rulebook</a>
<br>Tavern Games from: <a href="https://www.drivethrurpg.com/product/273300/Warhammer-Fantasy-Roleplay-Fourth-Edition-Rough-Nights-and-Hard-Days?affiliate_id=91369">Warhammer Fantasy Roleplay Fourth Edition Rough Nights and Hard Days</a>
<br>For your official random tavern generation check <a href="https://www.drivethrurpg.com/es/product/461787/warhammer-fantasy-roleplay-taverns-of-the-old-world?affiliate_id=91369">Taverns of the Old World</a>
<br>Other random tavern generator for Warhammer: <a href="http://orteil.dashnet.org/randomgen/?gen=YmmACP0J">http://orteil.dashnet.org/randomgen/?gen=YmmACP0J</a>
<br>Other random generators: <a href="https://randroll.com/archive/warhammer-fantasy-roleplay-generators-guide/">https://randroll.com/archive/warhammer-fantasy-roleplay-generators-guide/</a></p>
</body>
</html>
</html>