-
Notifications
You must be signed in to change notification settings - Fork 2
/
comestiblesList.py
602 lines (567 loc) · 25.4 KB
/
comestiblesList.py
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
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
import json
import sys
import copy
import string
import math
import pywikibot
from version import version
#documentation
#Usage: python [location of pywikibotinstall]\pwb.py comestiblesList.py
# Then input your password, and wait for the page to be updated.
list_comestibles_files = [ 'data/json/items/comestibles.json', 'data/json/items/comestibles/brewing.json', 'data/json/items/comestibles/carnivore.json', 'data/json/items/comestibles/drink.json', 'data/json/items/comestibles/egg.json', 'data/json/items/comestibles/frozen.json', 'data/json/items/comestibles/med.json', 'data/json/items/comestibles/mutagen.json', 'data/json/items/comestibles/protein.json', 'data/json/items/comestibles/seed.json', 'data/json/items/comestibles/spice.json', 'data/json/items/classes/comestible.json', 'data/core/basic.json' ]
data = list()
def merge_json_data(x,y): #expects two lists
retval = x + y
return retval
def check_duplicates(x,y): #check if there are duplicate ID's which might mess things up. Takes two lists as arguments.
for iterator in range(0, len(x)):
if ('id' in x[iterator]): #check for abstract item ID's.
id = x[iterator]["id"]
for iterator2 in range(0, len(y)):
if ('id' in y[iterator2]): #abstract check.
if (id == y[iterator2]["id"]):
print "duplicate ID detected "
print id
print ".\n"
def setAbstractIds(data): #some items have no ID value set, which this code depends on, but they do have an abstract. This function copies the abstract value into the id value.
for it in range(0, len(data)):
if(not 'id' in data[it]):
if('abstract' in data[it]):
data[it]['id'] = data[it]['abstract']
else:
print 'both no id and no abstract detected '
print it
print '.\n'
return data
ID_to_item = dict()
def ID_To_Item_Int(id): #should return the location of the item inside the items list. Input, string containing the item Id, returns, int location in the data list.
if(id in ID_to_item):
return ID_to_item[id]["id_nr"]
else:
return -1
def fill_ID_to_item (data):
retval = dict()
for it in range(0, len(data)):
keyD = dict()
keyD['id_nr'] = it
keyD["name"] = data[it]["name"]
if ('id' in data[it]):
retval[data[it]["id"]] = keyD
return retval
def getValue(id, value): #returns the value field of the item. It is a recursive function that takes into account the abstract item.
if(value in data[id]):
return data[id][value]
else:
if('copy-from' in data[id]):
return getValue(ID_To_Item_Int(data[id]["copy-from"]), value)
else:
return 'error:no such value field, in getValue'
def checkValue(id, value): #returns if the value field is defined in the item description. Or if it is defined in on of the abstracts.
if(value in data[id]):
return True
if("copy-from" in data[id]):
return checkValue(ID_To_Item_Int(data[id]["copy-from"]), value)
else:
return False
def getValueOrZero(id, value):
if(checkValue(id, value)):
return getValue(id, value)
else:
return 0
def getValueRecursive(id, value): # gets values taking proportional and relatives values into account. Only use on ints, returns zero if not set.
retval = 0
if(value in data[id]): # proportional and relative values don't matter if this value is set.
return data[id][value]
if(checkValue(id, 'copy-from')):
retval = getValueRecursive(ID_To_Item_Int(data[id]["copy-from"]),value)
if("relative" in data[id]):
if(value in data[id]['relative']):
retval += data[id]['relative'][value]
retval = int(retval)
if('proportional' in data[id]):
if(value in data[id]['proportional']):
retval *= data[id]['proportional'][value]
retval = int(retval)
return retval
kcal_per_nutr = 2500.0 / ( 12 * 24 ) #from itype.h
def getNutrition(id):
if(checkValue(id, 'nutrition')):
return getValue(id,'nutrition')
elif(checkValue(id, 'calories')):
retval = getValueRecursive(id, 'calories') / kcal_per_nutr
retval = int(retval)
return retval
return 0
def getMaterialsString(id): #Returns a list of strings. Because that is what my code uses.
retval = [ "" ]
if (checkValue(id,'material')):
if (isinstance(getValue(id,'material'), list)):
materialList = sorted(getValue(id,'material'), key=string.lower)
for ite in range(0, len(materialList)):
if(ite > 0):
retval.append(", ")
retval.append("{{Materialtoname|")
retval.append(str(materialList[ite]))
retval.append("}}")
else:
retval.append("{{Materialtoname|")
retval.append(str(getValue(id,'material')))
retval.append("}}")
else:
retval.append("none")
return retval
def getUseFunctionString(id): #Returns a list of strings. Because that is what my code uses.
#Healing items are just listed as 'healing item' (see item). (as they have a pretty big list of results, and not all that interesting, and these results are visible ingame).
#Drugs have their various effects listed, which in contrast to the healing items, vary wildly, and cannot be seen ingame.
#Double check if all the options are properly listed in 'Template:Usefunctiontotext'. Please add any missing ones.
retval = [ "" ]
if(checkValue(id,'use_action')): #usefunction (add any missing options to 'Template:Row/Food'
useaction = getValue(id,'use_action')
if (isinstance(useaction, dict)):
if('type' in useaction):
if(useaction['type'] == 'heal'):
retval.append("Healing item (see item)")
elif(useaction['type'] == 'mutagen_iv'):
retval.append("MUT_IV")
elif(useaction['type'] == 'mutagen'):
retval.append("MUTAGEN")
elif(useaction['type'] == 'consume_drug'):
if('effects' in useaction):
for it in range(0, len(useaction['effects'])):
if(it > 0):
retval.append(", ")
retval.append("{{Usefunctiontotext|")
retval.append(str(useaction['effects'][it]['id']))
retval.append("}}")
else:
retval.append("See Item")
else:
retval.append("See Item")
else:
retval.append(str(useaction))
else:
retval.append("none")
return retval
for it in range(0, len(list_comestibles_files)):
with open(list_comestibles_files[it]) as data_file:
new_data = json.load(data_file)
check_duplicates (data, new_data)
data = merge_json_data(data, new_data)
data = setAbstractIds(data)
ID_to_item = fill_ID_to_item(data)
ID_masterlist = list()
for it in range(0, len(data)):
ID_masterlist.append(data[it]["id"])
ID_masterlist = sorted(ID_masterlist, key=string.lower)
ID_comes = list()
for it in range(0, len(data)):
if(checkValue(it,'comestible_type')):
if ('FOOD' == getValue(it,'comestible_type')):
if(not checkValue(it, 'seed_data')): #Seeds go into a different list.
ID_comes.append(data[it]["id"])
ID_comes = sorted(ID_comes, key=string.lower)
ID_seeds = list()
for it in range(0, len(data)):
if(checkValue(it,'comestible_type')):
if ('FOOD' == getValue(it,'comestible_type')):
if(checkValue(it, 'seed_data')):
ID_seeds.append(data[it]["id"])
ID_seeds = sorted(ID_seeds, key=string.lower)
ID_drinks = list()
for it in range(0, len(data)):
if(checkValue(it, 'comestible_type')):
if ('DRINK' == getValue(it, 'comestible_type')):
ID_drinks.append(data[it]["id"])
ID_drinks = sorted(ID_drinks, key=string.lower)
ID_meds = list()
for it in range(0, len(data)):
if(checkValue(it, 'comestible_type')):
if ('MED' == getValue(it, 'comestible_type')):
ID_meds.append(data[it]["id"])
ID_meds = sorted(ID_meds, key=string.lower)
ID_mutagen = list()
for it in range(0, len(data)):
if(checkValue(it, 'use_action')):
use_action = getValue(it, 'use_action')
if ((use_action == 'MUTAGEN') or (use_action == 'MUT_IV') or (use_action == 'PURIFY_IV') or (use_action == 'PURIFIER')): #I think these mutation useactions have been moved into a json dictionary, but I kept them in here just to be complete.
ID_mutagen.append(data[it]["id"])
elif (type(use_action) is dict):
if (use_action['type'] == 'mutagen_iv' or use_action['type'] == 'mutagen'):
ID_mutagen.append(data[it]["id"])
ID_mutagen = sorted(ID_mutagen, key=string.lower)
#Check which ID's are not used in any of the lists. (might indicate missing information).
ID_not_used = list()
for it in range(0, len(data)):
used = False
if(checkValue(it, 'use_action')):
use_action = getValue(it, 'use_action')
if ((use_action == 'MUTAGEN') or (use_action == 'MUT_IV') or (use_action == 'PURIFY_IV') or (use_action == 'PURIFIER')):
used = True
elif (type(use_action) is dict):
if (use_action['type'] == 'mutagen_iv' or use_action['type'] == 'mutagen'):
used = True
if(checkValue(it, 'comestible_type')):
com_type = getValue(it, 'comestible_type')
if ((com_type == 'MED') or (com_type == 'FOOD') or (com_type == 'DRINK')):
used = True
if (not used):
ID_not_used.append(data[it]["id"])
ID_not_used = sorted(ID_not_used, key=string.lower)
#Print the unused id's. (Some will show up but aren't a problem, like water, as it is also defined as ammo in 'data\core\basic.json').
#It will be best to document which ones are and aren't a problem somewhere. (TODO).
if (len(ID_not_used) > 0):
print "Unused ID's detected, (" + str(len(ID_not_used)) + "):"
for it in range(0, len(ID_not_used)):
print str(it+1) + ": " + ID_not_used[it]
header = '''<!--Automatically generated using https://github.com/Soyweiser/CDDA-Wiki-Scripts ComestiblesList.py -->'''
footer = '''</table>
<noinclude>Automatically generated by [https://github.com/Soyweiser/CDDA-Wiki-Scripts The ComestiblesList.py script]. Any edits made to this can and will be overwritten. Please contact [[User:Soyweiser|Soyweiser]] if you want make changes to this page. Especially as any changes made here probably also means there have been changes in other pages. And there are tools to update those a little bit quicker.\n[[Category:Templates]]\n'''
footer+=version+"</noinclude>\n"
##Food list
output = [ "" ]
output.append("{{header/Comestibles|food}}\n")
output.append(header)
#'{{row/Food'|name|price|color|item materials|container|volume|weight|quench|nutrition|spoils|stimulant|health|addiction|charges|fun|usefunction|addiction_function|description|weight/volume|parasites'}}'
for it in range(0, len(ID_comes)):
id = ID_To_Item_Int(ID_comes[it])
if(not 'abstract' in data[id]): #don't print abstract items.
output.append("<!--"+ID_comes[it]+"-->")
output.append("{{row/Food|")
output.append(getValue(id,'name'))
output.append("|")
output.append(str(getValueRecursive(id,'price')))
output.append("|")
output.append(getValue(id,'color'))
output.append("|")
output.extend(getMaterialsString(id))
output.append("|")
if(checkValue(id,'container')): #containers
output.append(str(getValue(id,'container')))
else:
output.append("itm_null")
output.append("|")
output.append(str(getValueRecursive(id,'volume')))
output.append("|")
output.append(str(getValueRecursive(id,'weight')))
output.append("|")
output.append(str(getValueRecursive(id,'quench')))
output.append("|")
output.append(str(getNutrition(id))) #due to calories and nutrition being used, this is a special case.
output.append("|")
output.append(str(getValueOrZero(id,'spoils_in')))
output.append("|")
output.append(str(getValueOrZero(id,'stim')))
output.append("|")
output.append(str(getValueOrZero(id,'healthy')))
output.append("|")
output.append(str(getValueOrZero(id,'addiction_potential')))
output.append("|")
charges = getValueOrZero(id,'charges')
if(charges == 0):
charges = 1
output.append(str(charges))
output.append("|")
output.append(str(getValueRecursive(id,'fun')))
output.append("|")
output.extend(getUseFunctionString(id))
output.append("|")
if(checkValue(id,'addiction_type')):
output.append(str(getValue(id,'addiction_type')))
else:
output.append("ADD_NULL")
output.append("|")
output.append(str(getValue(id,'description')))
output.append("|")
if( not getValueOrZero(id, 'weight') == 0 ):
output.append(str(math.ceil(float(getValueOrZero(id, 'nutrition') / float(getValueOrZero(id, 'weight')))*100)/100))
else:
output.append("!")
output.append("|")
output.append(str(getValueRecursive(id,'parasites')))
if(checkValue(id,'price_postapoc')):
output.append("|trade_price=")
output.append(str(getValueRecursive(id,'price_postapoc')))
output.append("}}\n")
output.append(footer)
Foodtext = "".join(output)
Foodtext.replace("\n", "\\n")
#print Foodtext
##Seed list
output = [ "" ]
output.append("{{header/Comestibles|seeds}}\n")
output.append(header)
#(row data) name/price/materials/volume/weight/quench/nut/spoils/health/addiction/fun/function/fruit/grow
for it in range(0, len(ID_seeds)):
id = ID_To_Item_Int(ID_seeds[it])
if(not 'abstract' in data[id]): #don't print abstract items.
output.append("<!--"+ID_seeds[it]+"-->")
output.append("{{row/Seeds|")
output.append(getValue(id,'name'))
output.append("|")
output.append(str(getValueRecursive(id,'price')))
output.append("|")
output.append(getValue(id,'color'))
output.append("|")
output.extend(getMaterialsString(id))
output.append("|")
if(checkValue(id,'container')): #containers
output.append(str(getValue(id,'container')))
else:
output.append("itm_null")
output.append("|")
output.append(str(getValueRecursive(id,'volume')))
output.append("|")
output.append(str(getValueRecursive(id,'weight')))
output.append("|")
output.append(str(getValueRecursive(id,'quench')))
output.append("|")
output.append(str(getNutrition(id))) #due to calories and nutrition being used, this is a special case.
output.append("|")
output.append(str(getValueOrZero(id,'spoils_in')))
output.append("|")
output.append(str(getValueOrZero(id,'stim')))
output.append("|")
output.append(str(getValueOrZero(id,'healthy')))
output.append("|")
output.append(str(getValueOrZero(id,'addiction_potential')))
output.append("|")
charges = getValueOrZero(id,'charges')
if(charges == 0):
charges = 1
output.append(str(charges))
output.append("|")
output.append(str(getValueRecursive(id,'fun')))
output.append("|")
output.extend(getUseFunctionString(id))
output.append("|")
if(checkValue(id,'addiction_type')):
output.append(str(getValue(id,'addiction_type')))
else:
output.append("ADD_NULL")
output.append("|")
output.append(str(getValue(id,'description')))
output.append("|")
if( not getValueOrZero(id, 'weight') == 0 ):
output.append(str(math.ceil(float(getValueOrZero(id, 'nutrition') / float(getValueOrZero(id, 'weight')))*100)/100))
else:
output.append("!")
output.append("|")
output.append(str(getValueRecursive(id,'parasites')))
if(checkValue(id,'price_postapoc')):
output.append("|trade_price=")
output.append(str(getValueRecursive(id,'price_postapoc')))
if(checkValue(id,'seed_data')):
seed_data = getValue(id, 'seed_data')
if(not seed_data['fruit'] == 'null'): #there are special cases
output.append("|fruit=[[")
if(seed_data['fruit'] in ID_to_item):
output.append(str(getValue(ID_To_Item_Int(seed_data['fruit']),'name')))
else:
print str(seed_data['fruit']) + " not found in ID_to_item list"
output.append(str(seed_data['fruit']))
output.append("]]")
else:
output.append("|fruit=See item")
if('seeds' in seed_data):
output.append("|seeds=")
output.append(str(seed_data['seeds']))
if('grow' in seed_data):
output.append("|grow=")
output.append(str(seed_data['grow']))
output.append("}}\n")
output.append(footer)
Seedtext = "".join(output)
Seedtext.replace("\n", "\\n")
##Drinks list
output = [ "" ]
output.append("{{header/Comestibles|drinks}}\n")
output.append(header)
#'{{row/drinks'|name|price|color|material|container|quench|nutrition|spoils|stimulant|health|addiction|charges|fun|usefunction|addiction_function|description'}}'
for it in range(0, len(ID_drinks)):
id = ID_To_Item_Int(ID_drinks[it])
if(not 'abstract' in data[id]): #don't print abstract items.
output.append("<!--"+ID_drinks[it]+"-->")
output.append("{{row/Drinks|")
output.append(getValue(id,'name'))
output.append("|")
output.append(str(getValueRecursive(id,'price')))
output.append("|")
output.append(getValue(id,'color'))
output.append("|")
output.extend(getMaterialsString(id))
output.append("|")
if(checkValue(id,'container')): #containers
output.append(str(getValue(id,'container')))
else:
output.append("itm_null")
output.append("|")
output.append(str(getValueRecursive(id,'quench')))
output.append("|")
output.append(str(getNutrition(id))) #due to calories and nutrition being used, this is a special case.
output.append("|")
output.append(str(getValueOrZero(id,'spoils_in')))
output.append("|")
output.append(str(getValueOrZero(id,'stim')))
output.append("|")
output.append(str(getValueOrZero(id,'healthy')))
output.append("|")
output.append(str(getValueOrZero(id,'addiction_potential')))
output.append("|")
charges = getValueOrZero(id,'charges')
if(charges == 0):
charges = 1
output.append(str(charges))
output.append("|")
output.append(str(getValueRecursive(id,'fun')))
output.append("|")
output.extend(getUseFunctionString(id))
output.append("|")
if(checkValue(id,'addiction_type')):
output.append(str(getValue(id,'addiction_type')))
else:
output.append("ADD_NULL")
output.append("|")
output.append(str(getValue(id,'description')))
if(checkValue(id,'price_postapoc')):
output.append("|trade_price=")
output.append(str(getValueRecursive(id,'price_postapoc')))
output.append("}}\n")
output.append(footer)
Drinktext = "".join(output)
Drinktext.replace("\n", "\\n")
##Meds list
output = [ "" ]
output.append("{{header/Comestibles|meds}}\n")
output.append(header)
#'{{row/meds'|name|price|color|container|material|stimulant|health|addiction|charges|fun|usefunction|addiction_function|description'}}'
for it in range(0, len(ID_meds)):
id = ID_To_Item_Int(ID_meds[it])
if(not 'abstract' in data[id]): #don't print abstract items.
output.append("<!--"+ID_meds[it]+"-->")
output.append("{{row/Meds|")
output.append(getValue(id,'name'))
output.append("|")
output.append(str(getValueRecursive(id,'price')))
output.append("|")
output.append(getValue(id,'color'))
output.append("|")
if(checkValue(id,'container')): #containers
output.append(str(getValue(id,'container')))
else:
output.append("itm_null")
output.append("|")
output.extend(getMaterialsString(id))
output.append("|")
output.append(str(getValueOrZero(id,'stim')))
output.append("|")
output.append(str(getValueOrZero(id,'healthy')))
output.append("|")
output.append(str(getValueOrZero(id,'addiction_potential')))
output.append("|")
charges = getValueOrZero(id,'charges')
if(charges == 0):
charges = 1
output.append(str(charges))
output.append("|")
output.append(str(getValueRecursive(id,'fun')))
output.append("|")
output.extend(getUseFunctionString(id))
output.append("|")
if(checkValue(id,'addiction_type')):
output.append(str(getValue(id,'addiction_type')))
else:
output.append("ADD_NULL")
output.append("|")
output.append(str(getValue(id,'description')))
if(checkValue(id,'price_postapoc')):
output.append("|trade_price=")
output.append(str(getValueRecursive(id,'price_postapoc')))
output.append("}}\n")
output.append(footer)
Medstext = "".join(output)
Medstext.replace("\n", "\\n")
##Mutagen list
output = [ "" ]
output.append("{{header/Comestibles|food}}\n")
output.append(header)
#'{{row/Food'|name|price|color|item materials|container|volume|weight|quench|nutrition|spoils|stimulant|health|addiction|charges|fun|usefunction|addiction_function|description|weight/volume|parasites'}}'
for it in range(0, len(ID_mutagen)):
id = ID_To_Item_Int(ID_mutagen[it])
if(not 'abstract' in data[id]): #don't print abstract items.
output.append("<!--"+ID_mutagen[it]+"-->")
output.append("{{row/Food|")
output.append(getValue(id,'name'))
output.append("|")
output.append(str(getValueRecursive(id,'price')))
output.append("|")
output.append(getValue(id,'color'))
output.append("|")
output.extend(getMaterialsString(id))
output.append("|")
if(checkValue(id,'container')): #containers
output.append(str(getValue(id,'container')))
else:
output.append("itm_null")
output.append("|")
output.append(str(getValueRecursive(id,'volume')))
output.append("|")
output.append(str(getValueRecursive(id,'weight')))
output.append("|")
output.append(str(getValueRecursive(id,'quench')))
output.append("|")
output.append(str(getNutrition(id))) #due to calories and nutrition being used, this is a special case.
output.append("|")
output.append(str(getValueOrZero(id,'spoils_in')))
output.append("|")
output.append(str(getValueOrZero(id,'stim')))
output.append("|")
output.append(str(getValueOrZero(id,'healthy')))
output.append("|")
output.append(str(getValueOrZero(id,'addiction_potential')))
output.append("|")
charges = getValueOrZero(id,'charges')
if(charges == 0):
charges = 1
output.append(str(charges))
output.append("|")
output.append(str(getValueRecursive(id,'fun')))
output.append("|")
output.extend(getUseFunctionString(id))
output.append("|")
if(checkValue(id,'addiction_type')):
output.append(str(getValue(id,'addiction_type')))
else:
output.append("ADD_NULL")
output.append("|")
output.append(str(getValue(id,'description')))
output.append("|")
if( not getValueOrZero(id, 'weight') == 0 ):
output.append(str(math.ceil(float(getValueOrZero(id, 'nutrition') / float(getValueOrZero(id, 'weight')))*100)/100))
else:
output.append("!")
output.append("|")
output.append(str(getValueRecursive(id,'parasites')))
if(checkValue(id,'price_postapoc')):
output.append("|trade_price=")
output.append(str(getValueRecursive(id,'price_postapoc')))
output.append("}}\n")
output.append(footer)
Mutagentext = "".join(output)
Mutagentext.replace("\n", "\\n")
site = pywikibot.Site('en', 'cddawiki')
page = pywikibot.Page(site, 'Template:Comestibles/Food')
page.text = Foodtext
page.save('Updated text automatically via the https://github.com/Soyweiser/CDDA-Wiki-Scripts ComestiblesList.py script')
page = pywikibot.Page(site, 'Template:Comestibles/Seeds')
page.text = Seedtext
page.save('Updated text automatically via the https://github.com/Soyweiser/CDDA-Wiki-Scripts ComestiblesList.py script')
page = pywikibot.Page(site, 'Template:Comestibles/Drinks')
page.text = Drinktext
page.save('Updated text automatically via the https://github.com/Soyweiser/CDDA-Wiki-Scripts ComestiblesList.py script')
page = pywikibot.Page(site, 'Template:Comestibles/Meds')
page.text = Medstext
page.save('Updated text automatically via the https://github.com/Soyweiser/CDDA-Wiki-Scripts ComestiblesList.py script')
page = pywikibot.Page(site, 'Template:Comestibles/Mutagen')
page.text = Mutagentext
page.save('Updated text automatically via the https://github.com/Soyweiser/CDDA-Wiki-Scripts ComestiblesList.py script')
exit()