-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrarian.lua
More file actions
4580 lines (3836 loc) · 218 KB
/
librarian.lua
File metadata and controls
4580 lines (3836 loc) · 218 KB
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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Display the contents of your library
--
--[====[
librarian
================
]====]
local dont_be_silly = false
-- 'true' disables the "ook" part from the description of the return from hiding key.
local ook_start_x = 10
-- x position of where the "ook" key description appears, in case the script clashes with something else.
local gui = require 'gui'
local dialog = require 'gui.dialogs'
local widgets = require 'gui.widgets'
local guiScript = require 'gui.script'
local utils = require 'utils'
local Ui
-- Compatibility
-- dfhack.TranslateName was renamed in DFHack v50.15-r2.
local translateName = dfhack.TranslateName or dfhack.translation.translateName
local DF_pre_50 = (tonumber(string.match(dfhack.getDFVersion(), "^v?(%d+%.%d+)")) < 0.50)
-- in 0.50+, CURSOR_LEFT and CURSOR_RIGHT are now bound to the a and d keys.
-- KEYBOARD_CURSOR_LEFT and KEYBOARD_CURSOR_RIGHT are the arrow keys.
local Cursor_Left = (DF_pre_50) and "CURSOR_LEFT" or "KEYBOARD_CURSOR_LEFT"
local Cursor_Right = (DF_pre_50) and "CURSOR_RIGHT" or "KEYBOARD_CURSOR_RIGHT"
--=====================================
local values = {[df.value_type.LAW] =
{[-3] = "finds the idea of law abhorrent",
[-2] = "disdains the law",
[-1] = "does not respect the law",
[0] = "doesn't feel strongly about the law",
[1] = "respects the law",
[2] = "has a great deal of respect for the law",
[3] = "is an absolute believer in the rule of law"},
[df.value_type.LOYALTY] =
{[-3] = "is disgusted by the idea of loyalty",
[-2] = "disdains loyalty",
[-1] = "views loyalty unfavorably",
[0] = "doesn't particularly value loyalty",
[1] = "values loyalty",
[2] = "greatly prizes loyalty",
[3] = "has the highest regard for loyalty"},
[df.value_type.FAMILY] =
{[-3] = "finds the idea of family loathsome",
[-2] = "lacks any respect for family",
[-1] = "is put off by family",
[0] = "does not care about family one way or the other",
[1] = "values family",
[2] = "values family greatly",
[3] = "sees family as one of the most important things in life"},
[df.value_type.FRIENDSHIP] =
{[-3] = "finds the whole idea of friendship disgusting",
[-2] = "is completely put off by the idea of friends",
[-1] = "finds friendship burdensome",
[0] = "does not care about friendship",
[1] = "thinks friendship is important",
[2] = "sees friendship as one of the finer things in life",
[3] = "believes friendship is the key to the ideal life"},
[df.value_type.POWER] =
{[-3] = "finds the acquisition and use of power abhorrent and would have all masters toppled",
[-2] = "hates those who wield power over others",
[-1] = "has a negative view of those who exercise power over others",
[0] = "doesn't find power particularly praiseworthy",
[1] = "respects power",
[2] = "sees power over others as something to strive for",
[3] = "believes that the acquisition of power over others is the ideal goal in life and worthy of the highest respect"},
[df.value_type.TRUTH] =
{[-3] = "is repelled by the idea of honesty and lies without compunction",
[-2] = "sees lying as an important means to an end",
[-1] = "finds blind honesty foolish",
[0] = "does not particularly value the truth",
[1] = "values honesty",
[2] = "believes that honesty is a high ideal",
[3] = "believes the truth is inviolable regardless of the cost"},
[df.value_type.CUNNING] =
{[-3] = "is utterly disgusted by guile and cunning",
[-2] = "holds shrewd and crafty individuals in the lowest esteem",
[-1] = "sees guile and cunning as indirect and somewhat worthless",
[0] = "does not really value cunning and guile",
[1] = "values cunning",
[2] = "greatly respects the shrewd and guileful",
[3] = "holds well-laid plans and shrewd deceptions in the highest regard"},
[df.value_type.ELOQUENCE] =
{[-3] = "sees artful speech and eloquence as a wasteful form of deliberate deception and treats it as such",
[-2] = "finds [him]self somewhat disgusted with eloquent speakers",
[-1] = "finds eloquence and artful speech off-putting",
[0] = "doesn't value eloquence so much",
[1] = "values eloquence",
[2] = "deeply respects eloquent speakers",
[3] = "believes that artful speech and eloquent expression are of the highest ideals"},
[df.value_type.FAIRNESS] =
{[-3] = "is disgusted by the idea of fairness and will freely cheat anybody at any time",
[-2] = "finds the idea of fair-dealing foolish and cheats whenever [he] finds it profitable",
[-1] = "sees life as unfair and doesn't mind it that way",
[0] = "does not care about fairness", -- one way or the other?
[1] = "respects fair-dealing and fair-play",
[2] = "has great respect for fairness",
[3] = "holds fairness as one of the highest ideals and despises cheating of any kind"},
[df.value_type.DECORUM] =
{[-3] = "is affronted of the whole notion of maintaining decorum and finds so-called dignified people disgusting",
[-2] = "sees those that attempt to maintain dignified and proper behavior as vain and offensive",
[-1] = "finds maintaining decorum a silly, fumbling waste of time",
[0] = "doesn't care very much about decorum",
[1] = "values decorum, dignity and proper behavior",
[2] = "greatly respects those that observe decorum and maintain their dignity",
[3] = "views decorum as a high ideal and is deeply offended by those that fail to maintain it"},
[df.value_type.TRADITION] =
{[-3] = "is disgusted by tradition and would flout any [he] encounters if given a chance",
[-2] = "find the following of tradition foolish and limiting",
[-1] = "disregards tradition",
[0] = "doesn't have any strong feelings about tradition",
[1] = "values tradition",
[2] = "is a firm believer in the value of tradition",
[3] = "holds the maintenance of tradition as one of the highest ideals"},
[df.value_type.ARTWORK] =
{[-3] = "finds art offensive and would have it destroyed whenever possible",
[-2] = "sees the whole pursuit of art as silly",
[-1] = "finds artwork boring",
[0] = "doesn't care about art one way or another",
[1] = "values artwork",
[2] = "greatly respects artists and their work",
[3] = "believes that the creation and appreciation of artwork is one of the highest ideals"},
[df.value_type.COOPERATION] =
{[-3] = "is thoroughly disgusted by cooperation",
[-2] = "views cooperation as a low ideal not worthy of any respect",
[-1] = "dislikes cooperation",
[0] = "doesn't see cooperation as valuable",
[1] = "values cooperation",
[2] = "sees cooperation as very important in life",
[3] = "places cooperation as one of the highest ideals"},
[df.value_type.INDEPENDENCE] =
{[-3] = "hates freedom and would crush the independent spirit wherever it is found",
[-2] = "sees freedom and independence as completely worthless",
[-1] = "finds the idea of independence and freedom somewhat foolish",
[0] = "doesn't really value independence one way or another",
[1] = "values independence",
[2] = "treasures independence",
[3] = "believes that freedom and independence are completely non-negotiable and would fight to defend them"},
[df.value_type.STOICISM] =
{[-3] = "sees concealment of emotions as a betrayal and tries [his] best never to associate with such secretive fools",
[-2] = "feels that those who attempt to conceal their emotions are vain and foolish",
[-1] = "sees no value in holding back complaints and concealing emotions",
[0] = "doesn't see much value in being stoic",
[1] = "believes it is important to conceal emotions and refrain from complaining",
[2] = "thinks it is of the utmost importance to present a bold face and never grouse, complain, and even show emotion",
[3] = "views any show of emotion as offensive"},
[df.value_type.INTROSPECTION] =
{[-3] = "finds the whole idea of introspection completely offensive and contrary to the ideals of a life well-lived",
[-2] = "thinks that introspection is valueless and those that waste time in self-examination are deluded fools",
[-1] = "finds introspection to be a waste of time",
[0] = "doesn't really see the value in self-examination",
[1] = "sees introspection as important",
[2] = "deeply values introspection",
[3] = "feels that introspection and all forms of self-examination are the keys to a good life and worthy of respect"},
[df.value_type.SELF_CONTROL] =
{[-3] = "has abandoned any attempt at self-control and finds the whole concept deeply offensive",
[-2] = "sees the denial of impulses as a vain and foolish pursuit",
[-1] = "finds those that deny their impulses somewhat stiff",
[0] = "doesn't particularly value self-control",
[1] = "values self-control",
[2] = "finds moderation and self-control to be very important",
[3] = "believes that self-mastery and the denial of impulses are of the highest ideals"},
[df.value_type.TRANQUILITY] =
{[-3] = "is disgusted by tranquility and would that the world would constantly churn with noise and activity",
[-2] = "is greatly disturbed by quiet and a peaceful existence",
[-1] = "prefers a noisy, bustling life to boring days without activity",
[0] = "doesn't have a preference between tranquility and tumult",
[1] = "values tranquility and a peaceful day",
[2] = "strongly values tranquility and quiet",
[3] = "views tranquility as one of the highest ideals"},
[df.value_type.HARMONY] =
{[-3] = "believes deeply that chaos and disorder are the truest expressions of life and would disrupt harmony wherever it is found",
[-2] = "can't fathom why anyone would want to live in an orderly and harmonious society",
[-1] = "doesn't respect a society that has settled into harmony without debate and strife",
[0] = "sees equal parts of harmony and discord as parts of life",
[1] = "values a harmonious existence",
[2] = "strongly believes that a peaceful and ordered society without dissent is best",
[3] = "would have the world operate in complete harmony without the least bit of strife and disorder"},
[df.value_type.MERRIMENT] =
{[-3] = "is appalled by merrymaking, parties and other such worthless activities",
[-2] = "is disgusted by merrymakers",
[-1] = "sees merrymaking as a waste",
[0] = "doesn't really value merrymaking",
[1] = "finds merrymaking and parying worthwhile activities",
[2] = "truly values merrymaking and parties",
[3] = "believes that little is better in life than a good party"},
[df.value_type.CRAFTSMANSHIP] =
{[-3] = "views craftdwarfship with disgust and would desecrate a so-called masterwork or two if [he] could get away with it",
[-2] = "sees the pursuit of good craftdwarfship as a total waste",
[-1] = "considers craftdwarfship to be relatively worthless",
[0] = "doesn't particularly care about crafdwarfship",
[1] = "values good craftdwarfship",
[2] = "has a great deal of respect for worthy craftdwarfship",
[3] = "holds craftdwarfship to be of the highest ideals and celebrates talented artisans and their masterworks"},
[df.value_type.MARTIAL_PROWESS] =
{[-3] = "abhors those who pursue the mastery of weapons and skill with fighting",
[-2] = "thinks that the pursuit of the skills of warfare and fighting is a low pursuit indeed",
[-1] = "finds those that develop skills with weapons and fighting distasteful",
[0] = "does not really value skills related to fighting",
[1] = "values martial prowess",
[2] = "deeply respects skill at arms",
[3] = "believes that martial prowess defines the good character of an individual"},
[df.value_type.SKILL] =
{[-3] = "sees the whole idea of taking time to master a skill as appalling",
[-2] = "believes that the time taken to master a skill is a horrible waste",
[-1] = "finds the pursuit of skill mastery off-putting",
[0] = "doesn't care if others take the time to master skills",
[1] = "respects the development of skill",
[2] = "really respects those that take the time to master a skill",
[3] = "believes that the mastery of a skill is one of the highest pursuits"},
[df.value_type.HARD_WORK] =
{[-3] = "finds the proposition that one should work hard in life utterly abhorrent",
[-2] = "thinks working hard is an abject idiocy",
[-1] = "sees working hard as a foolish waste of time",
[0] = "doesn't really see the point of working hard",
[1] = "values hard work",
[2] = "deeply respects those that work hard at their labors",
[3] = "believes that hard work is one of the highest ideals and a key to the good life"},
[df.value_type.SACRIFICE] =
{[-3] = "thinks that the whole concept of sacrifice for others is truly disgusting",
[-2] = "finds sacrifice to be the height of folly",
[-1] = "sees sacrifice as wasteful and foolish",
[0] = "doesn't particularly respect sacrifice as a virtue",
[1] = "values sacrifice",
[2] = "believes that those who sacrifice for others should be deeply respected",
[3] = "sacrifice to be one of the highest ideals"},
[df.value_type.COMPETITION] =
{[-3] = "finds the very idea of competition obscene",
[-2] = "deeply dislikes competition",
[-1] = "sees competition as wasteful and silly",
[0] = "doesn't have strong views on competition",
[1] = "sees competition as reasonably important",
[2] = "views competition as a crucial driving force of the world",
[3] = "holds the idea of competition among the most important and would encourage it whenever possible"},
[df.value_type.PERSEVERENCE] =
{[-3] = "finds the notion that one would persevere through adversity completely abhorrent",
[-2] = "thinks there is something deeply wrong with people the persevere through adversity",
[-1] = "sees perseverance in the face of adversity as bull-headed and foolish",
[0] = "doesn't think much about the idea of perseverance",
[1] = "respects perseverance",
[2] = "greatly respects individuals that persevere through their trials and labors",
[3] = "believes that perseverance is one of the greatest qualities somebody can have"},
[df.value_type.LEISURE_TIME] =
{[-3] = "believes that those that take leisure time are evil and finds the whole idea disgusting",
[-2] = "is offended by leisure time and leisurely living",
[-1] = "finds leisure time wasteful", -- also "prefers a noisy, bustling life to boring days without activity",?
[0] = "doesn't think one way or the other about leisure time",
[1] = "values leisure time",
[2] = "treasures leisure time and thinks it is very important in life",
[3] = "believes it would be a fine thing if all time were leisure time"},
[df.value_type.COMMERCE] =
{[-3] = "holds the view that commerce is a vile obscenity",
[-2] = "finds those that engage in trade and commerce to be fairly disgusting",
[-1] = "is somewhat put off by trade and commerce",
[0] = "doesn't particularly respect commerce",
[1] = "respects commerce",
[2] = "really respects commerce and those that engage in trade",
[3] = "sees engaging in commerce as a high ideal in life"},
[df.value_type.ROMANCE] =
{[-3] = "finds even the abstract idea of romance repellent",
[-2] = "is somewhat disgusted by romance",
[-1] = "finds romance distasteful",
[0] = "doesn't care one way or the other about romance",
[1] = "values romance",
[2] = "thinks romance is very important in life",
[3] = "sees romance as one of the highest ideals"},
[df.value_type.NATURE] =
{[-3] = "would just as soon have nature and the great outdoors burned to ashes and converted into a great mining pit",
[-2] = "has a deep dislike for the natural world",
[-1] = "finds nature somewhat disturbing",
[0] = "doesn't care about nature one way or another",
[1] = "values nature",
[2] = "has a deep respect for animals, plants and the natural world",
[3] = "holds nature to be of greater value than most aspects of civilization"},
[df.value_type.PEACE] =
{[-3] = "thinks that the world should be engaged into perpetual warfare",
[-2] = "believes war is preferable to peace in general",
[-1] = "sees was as a useful means to an end",
[0] = "doesn't particularly care between war and peace",
[1] = "values peace over war",
[2] = "believes that peace is always preferable to war",
[3] = "believes that the idea of war is utterly repellent and would have peace at all costs"},
[df.value_type.KNOWLEDGE] =
{[-3] = "sees the attainment and preservation of knowledge as an offensive enterprise engaged in by arrogant fools",
[-2] = "thinks the quest for knowledge is a delusional fantasy",
[-1] = "finds the pursuit of knowledge to be a waste of effort",
[0] = "doesn't see the attainment of knowledge as important",
[1] = "values knowledge",
[2] = "views the pursuit of knowledge as deeply important",
[3] = "finds the quest for knowledge to be of the very highest value"}}
--=====================================
local knowledge =
{[0] = {[df.knowledge_scholar_flags_0.philosophy_logic_formal_reasoning] = "Philosophy, Logic, Formal reasoning",
[df.knowledge_scholar_flags_0.philosophy_logic_deductive_reasoning] = "Philosophy, Logic, Deductive reasoning",
[df.knowledge_scholar_flags_0.philosophy_logic_syllogistic_logic] = "Philosophy, Logic, Syllogistic logic",
[df.knowledge_scholar_flags_0.philosophy_logic_hypothetical_syllogisms] = "Philosophy, Logic, Hypothetical syllogisms",
[df.knowledge_scholar_flags_0.philosophy_logic_propositional_logic] = "Philosophy, Logic, Propositional",
[df.knowledge_scholar_flags_0.philosophy_logic_dialectic_reasoning] = "Philosophy, Logic, Dialectic reasoning",
[df.knowledge_scholar_flags_0.philosophy_logic_analogical_inference] = "Philosophy, Logic, Analogical inference",
[df.knowledge_scholar_flags_0.philosophy_ethics_applied_medical] = "Philosophy, Ethics, Medical",
[df.knowledge_scholar_flags_0.philosophy_ethics_individual_value] = "Philosophy, Ethics, Individual value",
[df.knowledge_scholar_flags_0.philosophy_ethics_state_consequentialism] = "Philosophy, Ethics, State consequentialism",
[df.knowledge_scholar_flags_0.philosophy_epistemology_truth] = "Philosophy, Epistemology, Truth",
[df.knowledge_scholar_flags_0.philosophy_epistemology_perception] = "Philosophy, Epistemology, Perception",
[df.knowledge_scholar_flags_0.philosophy_epistemology_justification] = "Philosophy, Epistemology, Justification",
[df.knowledge_scholar_flags_0.philosophy_epistemology_belief] = "Philosophy, Epistemology, Belief",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_existence] = "Philosophy, Metaphysics, Existence",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_time] = "Philosophy, Metaphysics, Time",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_mind_body] = "Philosophy, Metaphysics, Mind-body",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_objects_and_properties] = "Philosophy, Metaphysics, Objects and properties",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_wholes_and_parts] = "Philosophy, Metaphysics, Wholes and parts",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_events] = "Philosophy, Metaphysics, Events",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_processes] = "Philosophy, Metaphysics, Processes",
[df.knowledge_scholar_flags_0.philosophy_metaphysics_causation] = "Philosophy, Metaphysics, Causation",
[df.knowledge_scholar_flags_0.philosophy_ethics_applied_military] = "Philosophy, Ethics applied, Military",
[df.knowledge_scholar_flags_0.philosophy_ethics_applied_interpersonal_conduct] = "Philosophy, Ethics applied, Interpersonal ethics",
[df.knowledge_scholar_flags_0.philosophy_specialized_law] = "Philosophy, Specialized, Law",
[df.knowledge_scholar_flags_0.philosophy_specialized_education] = "Philosophy, Specialized, Education",
[df.knowledge_scholar_flags_0.philosophy_specialized_language_grammar] = "Philosophy, Specialized language, Grammar",
[df.knowledge_scholar_flags_0.philosophy_specialized_language_etymology] = "Philosophy, Specialized language Etymology",
[df.knowledge_scholar_flags_0.philosophy_specialized_politics_diplomacy] = "Philosophy, Specialized politics, Diplomacy",
[df.knowledge_scholar_flags_0.philosophy_specialized_politics_government_forms] = "Philosophy, Specialized politics, Government forms",
[df.knowledge_scholar_flags_0.philosophy_specialized_politics_economic_policy] = "Philosophy, Specialized politics, Economic policy",
[df.knowledge_scholar_flags_0.philosophy_specialized_politics_social_welfare] = "Philosophy, Specialized politics, Social welfare"},
[1] = {[df.knowledge_scholar_flags_1.philosophy_logic_inductive_reasoning] = "Philosophy, Logic, Inductive reasoning",
[df.knowledge_scholar_flags_1.philosophy_logic_direct_inference] = "Philosophy, Logic, Direct inference",
[df.knowledge_scholar_flags_1.philosophy_aesthetics_nature_of_beauty] = "Philosophy, Aesthetics, Nature of beauty",
[df.knowledge_scholar_flags_1.philosophy_aesthetics_value_of_art] = "Philosophy, Aesthetics, Value of art",
[df.knowledge_scholar_flags_1.philosophy_specialized_language_dictionary] = "Philosophy, Specialized language, Dictionary"},
[2] = {[df.knowledge_scholar_flags_2.mathematics_method_proof_by_contradiction] = "Mathematics, Method, Proof by contradiction",
[df.knowledge_scholar_flags_2.mathematics_notation_zero] = "Mathematics, Notation, Zero",
[df.knowledge_scholar_flags_2.mathematics_notation_negative_numbers] = "Mathematics, Notation, Negative numbers",
[df.knowledge_scholar_flags_2.mathematics_notation_large_numbers] = "Mathematics, Notation, Scientific notation",
[df.knowledge_scholar_flags_2.mathematics_notation_positional] = "Mathematics, Notation, Positional",
[df.knowledge_scholar_flags_2.mathematics_geometry_basic_objects] = "Mathematics, Geometry, Basic objects",
[df.knowledge_scholar_flags_2.mathematics_method_exhaustion] = "Mathematics, Method, Exhaustion",
[df.knowledge_scholar_flags_2.mathematics_geometry_similar_and_congruent_triangles] = "Mathematics, Geometry, Similar and congruent triangles",
[df.knowledge_scholar_flags_2.mathematics_geometry_geometric_mean_theorem] = "Mathematics, Geometry, Geometric mean theorem",
[df.knowledge_scholar_flags_2.mathematics_geometry_isosceles_base_angles_equal] = "Mathematics, Geometry, Isosceles base angles equal",
[df.knowledge_scholar_flags_2.mathematics_geometry_inscribed_triangle_on_diameter_is_right] = "Mathematics, Geometry, Inscribed triangle on diameter is right",
[df.knowledge_scholar_flags_2.mathematics_geometry_pythagorean_theorem] = "Mathematics, Geometry, Pythagorean theorem",
[df.knowledge_scholar_flags_2.mathematics_geometry_pythagorean_triples_small] = "Mathematics, Geometry, Pythagorean triples small",
[df.knowledge_scholar_flags_2.mathematics_geometry_pythagorean_triples_3_digit] = "Mathematics, Geometry, Pythagorean triples 3 digit",
[df.knowledge_scholar_flags_2.mathematics_geometry_pythagorean_triples_4_digit] = "Mathematics, Geometry, Pythagorean triples 4 digit",
[df.knowledge_scholar_flags_2.mathematics_geometry_existence_of_incommensurable_ratios] = "Mathematics, Geometry, Irrational numbers",
[df.knowledge_scholar_flags_2.mathematics_method_axiomatic_reasoning] = "Mathematics, Method, Axiomatic reasoning",
[df.knowledge_scholar_flags_2.mathematics_numbers_unique_prime_factorization] = "Mathematics, Numbers, Unique prime factorization",
[df.knowledge_scholar_flags_2.mathematics_numbers_algorithm_for_computing_gcd] = "Mathematics, Numbers, Algorithm for computing GCD",
[df.knowledge_scholar_flags_2.mathematics_geometry_volume_of_pyramid] = "Mathematics, Geometry, Volume of pyramid",
[df.knowledge_scholar_flags_2.mathematics_geometry_volume_of_cone] = "Mathematics, Geometry, Volume of cone",
[df.knowledge_scholar_flags_2.mathematics_geometry_volume_of_sphere] = "Mathematics, Geometry, Volume of Sphere",
[df.knowledge_scholar_flags_2.mathematics_geometry_pi_to_4_digits] = "Mathematics, Geometry, Pi to 4 digits",
[df.knowledge_scholar_flags_2.mathematics_numbers_division_algorithm] = "Mathematics, Numbers, Division algorithm",
[df.knowledge_scholar_flags_2.mathematics_geometry_table_of_chord_values] = "Mathematics, Geometry, Chord tables",
[df.knowledge_scholar_flags_2.mathematics_geometry_area_of_triangle_from_side_lengths] = "Mathematics, Geometry, Area of triangle from side lengths",
[df.knowledge_scholar_flags_2.mathematics_geometry_area_of_circle] = "Mathematics, Geometry, Area of circle",
[df.knowledge_scholar_flags_2.mathematics_geometry_pi_to_6_digits] = "Mathematics, Geometry, Pi to 6 digits",
[df.knowledge_scholar_flags_2.mathematics_geometry_definitions_and_basic_properties_of_conic_sections] = "Mathematics, Geometry, Conic sections",
[df.knowledge_scholar_flags_2.mathematics_numbers_chinese_remainder_algorithm] = "Mathematics, Numbers, Chinese remainder algorithm",
[df.knowledge_scholar_flags_2.mathematics_geometry_area_enclosed_by_line_and_parabola] = "Mathematics, Geometry, Area enclosed by line and parabola",
[df.knowledge_scholar_flags_2.mathematics_numbers_sieve_algorithm_for_primes] = "Mathematics, Numbers, Sieve algorithm for primes"},
[3] = {[df.knowledge_scholar_flags_3.mathematics_numbers_root_2_to_5_digits] = "Mathematics, Numbers, Approximation of root 2",
[df.knowledge_scholar_flags_3.mathematics_numbers_infinite_primes] = "Mathematics, Numbers, Euclid's Theorem",
[df.knowledge_scholar_flags_3.mathematics_numbers_root_2_irrational] = "Mathematics, Numbers Irrationality of root 2",
[df.knowledge_scholar_flags_3.mathematics_geometry_surface_area_of_sphere] = "Mathematics, Gometry, Surface area of sphere",
[df.knowledge_scholar_flags_3.mathematics_algebra_finite_summation_formulas] = "Mathematics, Algebra, Large sums",
[df.knowledge_scholar_flags_3.mathematics_algebra_solving_linear_systems] = "Mathematics, Algebra, Systems of equations",
[df.knowledge_scholar_flags_3.mathematics_algebra_balancing_and_completion] = "Mathematics, Algbra, Balancing and completion",
[df.knowledge_scholar_flags_3.mathematics_algebra_quadratic_by_completing_square] = "Mathematics, Algebra, Quadratic by completing square",
[df.knowledge_scholar_flags_3.mathematics_algebra_quadratic_formula] = "Mathematics, Algebra, Quadratic formula",
[df.knowledge_scholar_flags_3.mathematics_notation_syncopated_algebra] = "Mathematics, Notation, Syncopated algebra",
[df.knowledge_scholar_flags_3.mathematics_geometry_law_of_sines] = "Mathematics, Geometry, Law of sines",
[df.knowledge_scholar_flags_3.mathematics_geometry_angle_sum_difference_trig_identities] = "Mathematics, Geometry, Sum-difference trig identities",
[df.knowledge_scholar_flags_3.mathematics_algebra_pascals_triangle] = "Mathematics, Algebra, Pascal's triangle",
[df.knowledge_scholar_flags_3.mathematics_algebra_solving_higher_order_polynomials] = "Mathematics, Algebra, Solving higher order polynomials",
[df.knowledge_scholar_flags_3.mathematics_notation_early_symbols_for_operations] = "Mathematics, Notation, Symbol for addition",
[df.knowledge_scholar_flags_3.mathematics_algebra_divergence_of_harmonic_series] = "Mathematics, Algebra, Divergence of harmonic series",
[df.knowledge_scholar_flags_3.mathematics_geometry_properties_of_chords] = "Mathematics, Geometry, Properties of chords"},
[4] = {[df.knowledge_scholar_flags_4.history_sourcing_basic_reliability] = "History, Sourcing, Source reliability",
[df.knowledge_scholar_flags_4.history_sourcing_role_of_systemic_bias] = "History, Sourcing, Role of systemic bias",
[df.knowledge_scholar_flags_4.history_sourcing_role_of_state_bias_and_propaganda] = "History, Sourcing, Role of state bias and propaganda",
[df.knowledge_scholar_flags_4.history_sourcing_personal_interviews] = "History, Sourcing, Personal interviews",
[df.knowledge_scholar_flags_4.history_theory_historical_causation] = "History, Theory, Historical causation",
[df.knowledge_scholar_flags_4.history_theory_historical_cycles] = "History, Theory, Historical cycles",
[df.knowledge_scholar_flags_4.history_theory_social_cohesion] = "History, Theory, Sociology",
[df.knowledge_scholar_flags_4.history_theory_social_conflict] = "History, Theory, Social conflict",
[df.knowledge_scholar_flags_4.history_form_biography] = "History, Form, Biography",
[df.knowledge_scholar_flags_4.history_form_comparative_biography] = "History, Form, Comparative biography",
[df.knowledge_scholar_flags_4.history_form_biographical_dictionaries] = "History, Form, Biographical dictionaries",
[df.knowledge_scholar_flags_4.history_form_autobiographical_adventure] = "History, Form, Autobiographical adventure",
[df.knowledge_scholar_flags_4.history_form_genealogy] = "History, Form, Genealogy",
[df.knowledge_scholar_flags_4.history_form_encyclopedia] = "History, Form, Encyclopedia",
[df.knowledge_scholar_flags_4.history_form_cultural_history] = "History, Form, Cultural history",
[df.knowledge_scholar_flags_4.history_form_cultural_comparison] = "History, Form, Comparative anthropology",
[df.knowledge_scholar_flags_4.history_sourcing_role_of_cultural_differences] = "History, Sourcing, Role of cultural differences",
[df.knowledge_scholar_flags_4.history_form_alternate_history] = "History, Form, Alternate history",
[df.knowledge_scholar_flags_4.history_sourcing_basic_archaeology] = "History, Sourcing, Archaeology",
[df.knowledge_scholar_flags_4.history_form_treatise_on_tech_evolution] = "History, Form, Treatise on tech evolution"},
[5] = {[df.knowledge_scholar_flags_5.astronomy_phases_of_the_moon] = "Astronomy, -, Phases of the moon",
[df.knowledge_scholar_flags_5.astronomy_summer_winter_moon] = "Astronomy, -, Summer winter moon",
[df.knowledge_scholar_flags_5.astronomy_path_of_the_moon] = "Astronomy, -, Path of the moon",
[df.knowledge_scholar_flags_5.astronomy_tides_and_the_moon] = "Astronomy, -, Tides and the moon",
[df.knowledge_scholar_flags_5.astronomy_height_of_tides_vs_moon_and_sun] = "Astronomy, -, Tides and the moon",
[df.knowledge_scholar_flags_5.astronomy_summer_winter_sun] = "Astronomy, -, Summer winter sun",
[df.knowledge_scholar_flags_5.astronomy_relationship_between_lunar_solar_year] = "Astronomy, -, Relationship between lunar solar year",
[df.knowledge_scholar_flags_5.astronomy_daylight_variation_with_solar_year] = "Astronomy, -, Daylight variation with solar year",
[df.knowledge_scholar_flags_5.astronomy_geocentric_model] = "Astronomy, -, Geocentric model",
[df.knowledge_scholar_flags_5.astronomy_heliocentric_model] = "Astronomy, -, Heliocentric model",
[df.knowledge_scholar_flags_5.astronomy_dates_of_lunar_and_solar_eclipses] = "Astronomy, -, Dates of lunar and solar eclipses",
[df.knowledge_scholar_flags_5.astronomy_star_charts] = "Astronomy, -, Astrography",
[df.knowledge_scholar_flags_5.astronomy_star_catalogues_100] = "Astronomy, -, Star catalogues 100",
[df.knowledge_scholar_flags_5.astronomy_star_catalogues_1000] = "Astronomy, -, Star catalogues 1000",
[df.knowledge_scholar_flags_5.astronomy_star_color_classification] = "Astronomy, -, Stellar Spectroscopy",
[df.knowledge_scholar_flags_5.astronomy_star_magnitude_classification] = "Astronomy, -, Star magnitude classification",
[df.knowledge_scholar_flags_5.astronomy_shape_of_the_world] = "Astronomy, -, Shape of the world",
[df.knowledge_scholar_flags_5.astronomy_precession_of_equinoxes] = "Astronomy, -, Precession of equinoxes",
[df.knowledge_scholar_flags_5.astronomy_method_empirical_observation] = "Astronomy, Method, Empirical observation",
[df.knowledge_scholar_flags_5.astronomy_method_path_models] = "Astronomy, Method, Path models"},
[6] = {[df.knowledge_scholar_flags_6.naturalist_method_dissection] = "Naturalist, Method, Dissection",
[df.knowledge_scholar_flags_6.naturalist_observation_anatomy] = "Naturalist, Observation, Anatomy",
[df.knowledge_scholar_flags_6.naturalist_theory_comparative_anatomy] = "Naturalist, Theory, Comparative anatomy",
[df.knowledge_scholar_flags_6.naturalist_theory_classification_by_physical_features] = "Naturalist, Theory, Physical taxonomy",
[df.knowledge_scholar_flags_6.naturalist_observation_migration_patterns] = "Naturalist, Observation, Migration patterns",
[df.knowledge_scholar_flags_6.naturalist_observation_reproductive_behavior] = "Naturalist, Observation, Reproductive behavior",
[df.knowledge_scholar_flags_6.naturalist_observation_foraging_behavior_and_diet] = "Naturalist, Observation, Foraging behavior",
[df.knowledge_scholar_flags_6.naturalist_theory_food_chain] = "Naturalist, Theory, Food chain",
[df.knowledge_scholar_flags_6.naturalist_observation_social_behavior] = "Naturalist, Observation, Social behavior",
[df.knowledge_scholar_flags_6.naturalist_observation_diseases] = "Naturalist, Observation, Veterinary medicine",
[df.knowledge_scholar_flags_6.naturalist_theory_climactic_adaptation] = "Naturalist, Theory, Climactic adaptation",
[df.knowledge_scholar_flags_6.naturalist_observation_embriological_development] = "Naturalist, Observation, Embryology",
[df.knowledge_scholar_flags_6.naturalist_theory_struggle_for_existence] = "Naturalist, Theory, Struggle for existence"},
[7] = {[df.knowledge_scholar_flags_7.chemistry_classification_combustibles] = "Chemistry, Classification, Combustibles",
[df.knowledge_scholar_flags_7.chemistry_classification_ores] = "Chemistry, Classification, Ores",
[df.knowledge_scholar_flags_7.chemistry_metallurgy_alloys] = "Chemistry, Metallurgy, Alloys",
[df.knowledge_scholar_flags_7.chemistry_classification_scratch_test] = "Chemistry, Classification, Scratch test",
[df.knowledge_scholar_flags_7.chemistry_classification_elemental_theory] = "Chemistry, Classification, Elemental theory",
[df.knowledge_scholar_flags_7.chemistry_chemicals_adhesives] = "Chemistry, Chemicals, Adhesives",
[df.knowledge_scholar_flags_7.chemistry_laboratory_blast_furnace] = "Chemistry, Laboratory, Blast furnace",
[df.knowledge_scholar_flags_7.chemistry_laboratory_alembic] = "Chemistry, Laboratory, Alembic",
[df.knowledge_scholar_flags_7.chemistry_laboratory_theory_of_liquid_liquid_extraction] = "Chemistry, Laboratory, Theory of liquid liquid extraction",
[df.knowledge_scholar_flags_7.chemistry_laboratory_theory_of_distillation] = "Chemistry, Laboratory, Theory of distillation",
[df.knowledge_scholar_flags_7.chemistry_laboratory_theory_of_evaporation] = "Chemistry, Laboratory, Theory of evaporation",
[df.knowledge_scholar_flags_7.chemistry_classification_alkali_and_acids] = "Chemistry, Classification, Alkali and acids",
[df.knowledge_scholar_flags_7.chemistry_laboratory_systematic_experiments] = "Chemistry, Laboratory, Systematic experiments",
[df.knowledge_scholar_flags_7.chemistry_laboratory_glass_flask] = "Chemistry, Laboratory, Glass flask",
[df.knowledge_scholar_flags_7.chemistry_laboratory_glass_beaker] = "Chemistry, Laboratory, Glass beaker",
[df.knowledge_scholar_flags_7.chemistry_laboratory_glass_vial] = "Chemistry, Laboratory, Glass vial",
[df.knowledge_scholar_flags_7.chemistry_laboratory_glass_funnel] = "Chemistry, Laboratory, Glass funnel",
[df.knowledge_scholar_flags_7.chemistry_laboratory_crucible] = "Chemistry, Laboratory, Crucible",
[df.knowledge_scholar_flags_7.chemistry_chemicals_nitric_acid] = "Chemistry, Chemicals, Spirit of niter",
[df.knowledge_scholar_flags_7.chemistry_chemicals_sulfuric_acid] = "Chemistry, Chemicals, Oil of vitriol",
[df.knowledge_scholar_flags_7.chemistry_chemicals_aqua_regia] = "Chemistry, Chemicals, Aqua regia",
[df.knowledge_scholar_flags_7.chemistry_laboratory_glass_ampoule] = "Chemistry, Laboratory, Glass ampoule",
[df.knowledge_scholar_flags_7.chemistry_laboratory_glass_retort] = "Chemistry, Laboratory, Glass retort",
[df.knowledge_scholar_flags_7.chemistry_laboratory_lab_ovens] = "Chemistry, Laboratory, Lab ovens"},
[8] = {[df.knowledge_scholar_flags_8.geography_surveying_basic] = "Geography, Surveying, Basic",
[df.knowledge_scholar_flags_8.geography_surveying_staff] = "Geography, Surveying, Surveying staff",
[df.knowledge_scholar_flags_8.geography_cartography_basic] = "Geography, Cartography, Basic",
[df.knowledge_scholar_flags_8.geography_surveying_triangulation] = "Geography, Surveying, Triangulation",
[df.knowledge_scholar_flags_8.geography_surveying_cartographical] = "Geography, Surveying, Cartographical surveying",
[df.knowledge_scholar_flags_8.geography_surveying_land] = "Geography, Surveying, Land surveying",
[df.knowledge_scholar_flags_8.geography_surveying_military] = "Geography, Surveying, Military surveying",
[df.knowledge_scholar_flags_8.geography_surveying_engineering] = "Geography, Surveying, Engineering surveying",
[df.knowledge_scholar_flags_8.geography_cartography_geological] = "Geography, Cartography, Geological",
[df.knowledge_scholar_flags_8.geography_cartography_grid_system] = "Geography, Cartography, Grid system",
[df.knowledge_scholar_flags_8.geography_cartography_distance_scale] = "Geography, Cartography, Distance scale",
[df.knowledge_scholar_flags_8.geography_cartography_height_measurements] = "Geography, Cartography, Height measurements",
[df.knowledge_scholar_flags_8.geography_method_economic_data_collection] = "Geography, Methods, Econometrics",
[df.knowledge_scholar_flags_8.geography_cartography_economic] = "Geography, Cartography, Economic",
[df.knowledge_scholar_flags_8.geography_form_atlas] = "Geography, Form, Atlas",
[df.knowledge_scholar_flags_8.geography_theory_delta_formation] = "Geography, Theory, Delta formation",
[df.knowledge_scholar_flags_8.geography_theory_wind_patterns] = "Geography, Theory, Anemology (Wind patterns)",
[df.knowledge_scholar_flags_8.geography_theory_origin_of_rainfall_from_evap_condense] = "Geography, Theory, Origin of rainfall from evap condense",
[df.knowledge_scholar_flags_8.geography_theory_water_cycle] = "Geography, Theory, Water cycle",
[df.knowledge_scholar_flags_8.geography_theory_latitude_climate_zones] = "Geography, Theory, Latitude climate zones",
[df.knowledge_scholar_flags_8.geography_cartography_accurate_maps] = "Geography, Cartography, Accurate maps",
[df.knowledge_scholar_flags_8.geography_cartography_map_projections] = "Geography, Cartography, Map projections"},
[9] = {[df.knowledge_scholar_flags_9.medicine_theory_disease_and_fouled_water] = "Medicine, Theory, Disease and fouled water",
[df.knowledge_scholar_flags_9.medicine_method_physical_examination] = "Medicine, Method, Physical examination",
[df.knowledge_scholar_flags_9.medicine_method_autopsy] = "Medicine, Method, Autopsy",
[df.knowledge_scholar_flags_9.medicine_theory_prognosis] = "Medicine, Theory, Prognosis",
[df.knowledge_scholar_flags_9.medicine_tool_herbal_remedies] = "Medicine, Tool, Herbal remedies",
[df.knowledge_scholar_flags_9.medicine_tool_animal_remedies] = "Medicine, Tool, Animal remedies",
[df.knowledge_scholar_flags_9.medicine_tool_mineral_remedies] = "Medicine, Tool, Mineral remedies",
[df.knowledge_scholar_flags_9.medicine_tool_bandages] = "Medicine, Tool, Bandages",
[df.knowledge_scholar_flags_9.medicine_theory_disease_classification] = "Medicine, Theory, Pathology",
[df.knowledge_scholar_flags_9.medicine_theory_toxicology] = "Medicine, Theory, Toxicology",
[df.knowledge_scholar_flags_9.medicine_theory_acute_and_chronic_conditions] = "Medicine, Theory, Acute and chronic conditions",
[df.knowledge_scholar_flags_9.medicine_theory_endemic_disease] = "Medicine, Theory, Endemic disease",
[df.knowledge_scholar_flags_9.medicine_theory_epidemic_disease] = "Medicine, Theory, Epidemic disease",
[df.knowledge_scholar_flags_9.medicine_theory_exacerbation] = "Medicine, Theory, Exacerbation",
[df.knowledge_scholar_flags_9.medicine_theory_paroxysm] = "Medicine, Theory, Paroxysm",
[df.knowledge_scholar_flags_9.medicine_theory_relapse] = "Medicine, Theory, Relapse",
[df.knowledge_scholar_flags_9.medicine_theory_convalescence] = "Medicine, Theory, Convalescence",
[df.knowledge_scholar_flags_9.medicine_method_treatment_of_traumatic_injuries] = "Medicine, Method, Traumatic injury treatment",
[df.knowledge_scholar_flags_9.medicine_method_fracture_treatment] = "Medicine, Method, Fracture treatment",
[df.knowledge_scholar_flags_9.medicine_theory_fracture_classification] = "Medicine, Theory, Fracture classification",
[df.knowledge_scholar_flags_9.medicine_tool_traction_bench] = "Medicine, Tool, Traction bench",
[df.knowledge_scholar_flags_9.medicine_method_fracture_immobilization] = "Medicine, Method, Fracture immobilization",
[df.knowledge_scholar_flags_9.medicine_tool_orthopedic_cast] = "Medicine, Tool, Orthopedic cast",
[df.knowledge_scholar_flags_9.medicine_method_surgery_excision] = "Medicine, Method, Surgery excision",
[df.knowledge_scholar_flags_9.medicine_method_surgery_incision] = "Medicine, Method, Surgery incision",
[df.knowledge_scholar_flags_9.medicine_method_hernia_surgery] = "Medicine, Method, Hernia surgery",
[df.knowledge_scholar_flags_9.medicine_method_tracheotomy_surgery] = "Medicine, Method, Tracheotomy surgery",
[df.knowledge_scholar_flags_9.medicine_method_lithotomy_surgery] = "Medicine, Method, Lithotomy surgery",
[df.knowledge_scholar_flags_9.medicine_method_surgery_scraping] = "Medicine, Method, Surgery scraping",
[df.knowledge_scholar_flags_9.medicine_method_surgery_draining] = "Medicine, Method, Surgery draining",
[df.knowledge_scholar_flags_9.medicine_method_surgery_probing] = "Medicine, Method, Surgery probing",
[df.knowledge_scholar_flags_9.medicine_method_surgery_suturing] = "Medicine, Method, Surgery suturing"},
[10] = {[df.knowledge_scholar_flags_10.medicine_method_surgery_ligature] = "Medicine, Method, Surgery ligature",
[df.knowledge_scholar_flags_10.medicine_theory_surgical_models] = "Medicine, Theory, Surgical models",
[df.knowledge_scholar_flags_10.medicine_tool_mud_bags_as_surgical_models] = "Medicine, Tool, Mud bags as surgical models",
[df.knowledge_scholar_flags_10.medicine_tool_plants_as_surgical_models] = "Medicine, Tool, Plants as surgical models",
[df.knowledge_scholar_flags_10.medicine_tool_animals_as_surgical_models] = "Medicine, Tool, Plants as surgical models",
[df.knowledge_scholar_flags_10.medicine_theory_specialized_surgical_instruments] = "Medicine, Theory, Specialized surgical instruments",
[df.knowledge_scholar_flags_10.medicine_tool_forceps] = "Medicine, Tool, Forceps",
[df.knowledge_scholar_flags_10.medicine_tool_scalpel] = "Medicine, Tool, Scalpel",
[df.knowledge_scholar_flags_10.medicine_tool_surgical_scissors] = "Medicine, Tool, Surgical scissors",
[df.knowledge_scholar_flags_10.medicine_tool_surgical_needles] = "Medicine, Tool, Surgical needles",
[df.knowledge_scholar_flags_10.medicine_method_cataract_surgery] = "Medicine, Method, Cataract surgery",
[df.knowledge_scholar_flags_10.medicine_method_cauterization] = "Medicine, Method, Cauterization",
[df.knowledge_scholar_flags_10.medicine_method_anesthesia] = "Medicine, Method, Anesthesia",
[df.knowledge_scholar_flags_10.medicine_theory_pulmonary_medicine] = "Medicine, Theory, Pulmonary medicine",
[df.knowledge_scholar_flags_10.medicine_theory_anatomical_studies] = "Medicine, Theory, Anatomical studies",
[df.knowledge_scholar_flags_10.medicine_theory_classification_of_bodily_fluids] = "Medicine, Theory, Classification of bodily fluids",
[df.knowledge_scholar_flags_10.medicine_theory_eye_anatomy] = "Medicine, Theory, Eye anatomy",
[df.knowledge_scholar_flags_10.medicine_theory_motor_vs_sensory_nerves] = "Medicine, Theory, Motor vs sensory nerves",
[df.knowledge_scholar_flags_10.medicine_theory_nervous_system_function] = "Medicine, Theory, Nervous system function",
[df.knowledge_scholar_flags_10.medicine_theory_reaction_time] = "Medicine, Theory, Reaction time",
[df.knowledge_scholar_flags_10.medicine_theory_blood_vessels] = "Medicine, Theory, Blood vessels",
[df.knowledge_scholar_flags_10.medicine_theory_pulmonary_circulation] = "Medicine, Theory, Pulmonary circulation",
[df.knowledge_scholar_flags_10.medicine_theory_comparative_anatomy] = "Medicine, Theory, Comparative anatomy",
[df.knowledge_scholar_flags_10.medicine_theory_the_voice] = "Medicine, Theory, The voice",
[df.knowledge_scholar_flags_10.medicine_theory_classification_of_muscles] = "Medicine, Theory, Classification of muscles",
[df.knowledge_scholar_flags_10.medicine_theory_classification_of_mental_illnesses] = "Medicine, Classification of mental illnesses",
[df.knowledge_scholar_flags_10.medicine_theory_treatment_of_mental_illnesses] = "Medicine, Treatment of mental illnesses",
[df.knowledge_scholar_flags_10.medicine_tool_dedicated_hospitals] = "Medicine, Tool, Dedicated hospitals",
[df.knowledge_scholar_flags_10.medicine_method_professional_hospital_staff] = "Medicine, Method, Professional hospital staff",
[df.knowledge_scholar_flags_10.medicine_method_specialized_wards] = "Medicine, Method, Specialized wards",
[df.knowledge_scholar_flags_10.medicine_method_hospital_lab] = "Medicine, Method, Hospital lab",
[df.knowledge_scholar_flags_10.medicine_method_medical_school] = "Medicine, Method, Medical school"},
[11] = {[df.knowledge_scholar_flags_11.medicine_method_asylum_for_mentally_ill] = "Medicine, Method, Asylum for mentally ill"},
[12] = {[df.knowledge_scholar_flags_12.engineering_horology_shadow_clock] = "Engineering, Horology, Shadow clock",
[df.knowledge_scholar_flags_12.engineering_horology_water_clock] = "Engineering, Horology, Water clock",
[df.knowledge_scholar_flags_12.engineering_horology_conical_water_clock] = "Engineering, Horology, Conical water clock",
[df.knowledge_scholar_flags_12.engineering_horology_water_clock_reservoir] = "Engineering, Horology, Water clock reservoir",
[df.knowledge_scholar_flags_12.engineering_horology_astrarium] = "Engineering, Horology, Astrarium",
[df.knowledge_scholar_flags_12.engineering_horology_hourglass] = "Engineering, Horology, Hourglass",
[df.knowledge_scholar_flags_12.engineering_horology_mechanical_clock] = "Engineering, Horology, Mechanical Clock",
[df.knowledge_scholar_flags_12.engineering_machine_theory_of_pulley] = "Engineering, Machine, Theory of pulley",
[df.knowledge_scholar_flags_12.engineering_machine_pulley] = "Engineering, Machine, Pulley",
[df.knowledge_scholar_flags_12.engineering_machine_theory_of_screw] = "Engineering, Machine, Theory of screw",
[df.knowledge_scholar_flags_12.engineering_machine_screw] = "Engineering, Machine, Screw",
[df.knowledge_scholar_flags_12.engineering_machine_theory_of_wheel_and_axle] = "Engineering, Machine, Theory of wheel and axle",
[df.knowledge_scholar_flags_12.engineering_machine_windlass] = "Engineering, Machine, Windlass",
[df.knowledge_scholar_flags_12.engineering_machine_theory_of_wedge] = "Engineering, Machine, Theory of wedge",
[df.knowledge_scholar_flags_12.engineering_machine_theory_of_lever] = "Engineering, Machine, Theory of lever",
[df.knowledge_scholar_flags_12.engineering_machine_lever] = "Engineering, Machine, Lever",
[df.knowledge_scholar_flags_12.engineering_machine_straight_beam_balance] = "Engineering, Machine, Straight beam balance",
[df.knowledge_scholar_flags_12.engineering_machine_theory_of_gears] = "Engineering, Machine, Theory of gears",
[df.knowledge_scholar_flags_12.engineering_machine_warded_lock] = "Engineering, Machine, Warded lock",
[df.knowledge_scholar_flags_12.engineering_machine_tumbler_lock] = "Engineering, Machine, Tumbler lock",
[df.knowledge_scholar_flags_12.engineering_machine_padlock] = "Engineering, Machine, Padlock",
[df.knowledge_scholar_flags_12.engineering_machine_camshaft] = "Engineering, Machine, Camshaft",
[df.knowledge_scholar_flags_12.engineering_machine_crankshaft] = "Engineering, Machine, Crankshaft",
[df.knowledge_scholar_flags_12.engineering_machine_water_powered_sawmill] = "Engineering, Machine, Water powered sawmill",
[df.knowledge_scholar_flags_12.engineering_machine_chariot_odometer] = "Engineering, Machine, Chariot odometer",
[df.knowledge_scholar_flags_12.engineering_machine_chain_drive] = "Engineering, Machine, Chain drive",
[df.knowledge_scholar_flags_12.engineering_machine_mechanical_compass] = "Engineering, Machine, Mechanical compass",
[df.knowledge_scholar_flags_12.engineering_machine_differential_gear] = "Engineering, Machine, Differential gear",
[df.knowledge_scholar_flags_12.engineering_machine_combination_lock] = "Engineering, Machine, Combination lock",
[df.knowledge_scholar_flags_12.engineering_machine_verge_escapement] = "Engineering, Machine, Verge escapement",
[df.knowledge_scholar_flags_12.engineering_machine_balance_wheel] = "Engineering, Machine, Balance wheel",
[df.knowledge_scholar_flags_12.engineering_fluid_theory_of_siphon] = "Engineering, Fluid, Theory of siphon"},
[13] = {[df.knowledge_scholar_flags_13.engineering_fluid_valves] = "Engineering, Fluid, Valves",
[df.knowledge_scholar_flags_13.engineering_fluid_force_pump] = "Engineering, Fluid, Force pump",
[df.knowledge_scholar_flags_13.engineering_optics_crystal_lens] = "Engineering, Optics, Crystal lens",
[df.knowledge_scholar_flags_13.engineering_optics_water_filled_spheres] = "Engineering, Optics, Water filled spheres",
[df.knowledge_scholar_flags_13.engineering_optics_glass_lens] = "Engineering, Optics, Glass lens",
[df.knowledge_scholar_flags_13.engineering_optics_camera_obscura] = "Engineering, Optics, Camera obscura",
[df.knowledge_scholar_flags_13.engineering_optics_parabolic_mirror] = "Engineering, Optics, Parabolic mirror",
[df.knowledge_scholar_flags_13.engineering_optics_theory_of_color] = "Engineering, Optics, Theory of color",
[df.knowledge_scholar_flags_13.engineering_optics_theory_of_rainbows] = "Engineering, Optics, Theory of rainbows",
[df.knowledge_scholar_flags_13.engineering_optics_law_of_refraction] = "Engineering, Optics, Law of refraction",
[df.knowledge_scholar_flags_13.engineering_design_models_and_templates] = "Engineering, Design, Models and templates",
[df.knowledge_scholar_flags_13.engineering_construction_wood_lamination] = "Engineering, Construction, Wood lamination",
[df.knowledge_scholar_flags_13.engineering_astronomy_dioptra] = "Engineering, Astronomy, Dioptra",
[df.knowledge_scholar_flags_13.engineering_astronomy_astrolabe] = "Engineering, Astronomy, Astrolabe",
[df.knowledge_scholar_flags_13.engineering_astronomy_armillary_sphere] = "Engineering, Astronomy, Armillary sphere",
[df.knowledge_scholar_flags_13.engineering_astronomy_spherical_astrolabe] = "Engineering, Astronomy, Spherical astrolabe",
[df.knowledge_scholar_flags_13.engineering_astronomy_mural_instrument] = "Engineering, Astronomy, Mural instrument",
[df.knowledge_scholar_flags_13.engineering_astronomy_orrery] = "Engineering, Astronomy, Orrery",
[df.knowledge_scholar_flags_13.engineering_machine_water_powered_trip_hammer] = "Engineering, Machine, Water powered trip hammer",
[df.knowledge_scholar_flags_13.engineering_machine_double_acting_piston_bellows] = "Engineering, Machine, Double acting piston bellows",
[df.knowledge_scholar_flags_13.engineering_fluid_archimedes_principle] = "Engineering, Fluid, Archimedes principle",
[df.knowledge_scholar_flags_13.engineering_optics_atmospheric_refraction] = "Engineering, Optics, Atmospheric refraction",
[df.knowledge_scholar_flags_13.engineering_optics_cause_of_twilight] = "Engineering, Optics, Cause of twilight",
[df.knowledge_scholar_flags_13.engineering_optics_height_of_atmosphere] = "Engineering, Optics, Height of atmosphere",
[df.knowledge_scholar_flags_13.engineering_machine_piston] = "Engineering, Machine, Piston",
[df.knowledge_scholar_flags_13.engineering_machine_crank] = "Engineering, Machine, Crank",
[df.knowledge_scholar_flags_13.engineering_machine_bellows] = "Engineering, Machine, Bellows",
[df.knowledge_scholar_flags_13.engineering_machine_water_powered_piston_bellows] = "Engineering, Machine, Water powered piston bellows",
[df.knowledge_scholar_flags_13.engineering_machine_water_wheel] = "Engineering, Machine, Water wheel",
[df.knowledge_scholar_flags_13.engineering_machine_trip_hammer] = "Engineering, Machine, Trip hammer"}}
--=====================================
-- TODO note these are not populated or used (yet).
---type string?[] # in CP437
Zmap_itemid_to_writing_title = {} -- GLOBAL, PERSISTANT
---type string?[] # in CP437
Zmap_itemid_to_writing_author_name = {} -- GLOBAL, PERSISTANT
---type (df.historical_figure.id|integer)?[]
-- nil or -1 or index into df.historical_figure:get_vector()
Zmap_itemid_to_writing_author_hfid = {} -- GLOBAL, PERSISTANT
-- probably I don't want to get into the weeds.
---type (df.historical_figure.id|integer)?[]
-- nil or -1 or index into df.historical_figure:get_vector()
--Zmap_itemid_to_writing_subject_hfid = {} -- GLOBAL, PERSISTANT
---type (df.written_content.id|integer)?[]
-- nil or -1 or index into df.written_content:get_vector()
Zmap_itemid_to_written_content_id = {} -- GLOBAL, PERSISTANT
---type (df.artifact_record.id|integer)?[]
-- nil or -1 or index into df.artifact_record:get_vector()
Zmap_itemid_to_artifact_id = {} -- GLOBAL, PERSISTANT
-- probably I don't want to get into the weeds.
---type (df.world_site.id|integer)?[]
-- nil or -1 or index into df.world_site:get_vector()
--Zmap_itemid_to_world_site_id = {} -- GLOBAL, PERSISTANT
-- NOT FINISHED
-- This function parses an item, filling in the title and author cache-maps, and returns the item title.
-- TODO should it fill in all relevant cache-maps?
--
-- It expects to deal with a slab, a book, or a scroll.
--
---param item df.item_slabst|df.item_bookst|df.item_toolst|df.item.id|integer
-- # an item or item.id that potentially has a written contents
---return string # a (possibly blank) writing title, in CP437.
local function Zget_title( item )
if type(item) == "number" then
item = df.item.find(item)
end
-- note that in the case of a destroyed item, we cannot clean up the caches.
-- (unless we were passed an item id, but we've already destroyed that info.)
if item == nil then return ""; end
local title = map_itemid_to_writing_title[item.id]
if title ~= nil then
return title
end
title = ""
if item.flags.artifact then
local aid = -1
for _,gref in ipairs(item.general_refs) do
if df.general_ref_is_artifactst:is_instance(gref) then
aid = gref.artifact_id
end
end
map_itemid_to_artifact_id[item.id] = aid
end
if df.item_slabst:is_instance(item) then
-- TODO should we only process artifacts? should we only process secrets?
title = item.description
map_itemid_to_writing_title[item.id] = title
-- getting into the weeds.
-- if item.topic > 0 then
-- map_itemid_to_writing_subject_hfid[item.id] = item.topic
-- end
elseif df.item_bookst:is_instance(item) then
title = item.title
map_itemid_to_writing_title[item.id] = item.title
local author_hfid = -1
for _, improvement in ipairs(item.improvements) do
-- we assume there's at most one df.itemimprovement_pagesst in the vector. no duplicate check.
if df.itemimprovement_pagesst:is_instance(improvement) then
---type df.written_content.id|number
local wcid = (#improvement.contents > 0) and improvement.contents[0] or -1
map_itemid_to_written_content_id[item.id] = wcid
if (#improvement.contents > 1) then
dprintf("warning: book %d has multiple contents, count ",
item.id, #improvement.contents)
end
-- TODO move this out of the improvements loop. and out of the item-types if.
---type df.written_content
local content = df.written_content.find(wcid)
if content then
if wcid ~= content.id then -- this can't happen.
dprintf("warning: book %d df.written_content.id mismatch %d, %d",
item.id, wcid, content.id)
end
-- TODO should the content.title override the item_bookst.title ?
-- title = content.title
author_hfid = content.author
--[[ -- getting into the weeds.
for _,gref in (content.refs) do
if false then
elseif df.general_ref_sitest.is_instance(gref) then
map_itemid_to_world_site_id[item.id] = gref.site_id
end
end
]]
end
end -- is a pages improvement
end -- foreach improvements
map_itemid_to_writing_author_hfid[item.id] = author_hfid
local hf = df.historical_figure.find(author_hfid)
local author = (hf) and translateName(hf.name) or ""
map_itemid_to_writing_author_name[item.id] = author
-- okay, we've set title, author_hfid, and author. anything else to do?
elseif df.item_toolst:is_instance(item) and item.subtype.id == "ITEM_TOOL_SCROLL" then
local author_hfid = -1
for _, improvement in ipairs(item.improvements) do
if df.itemimprovement_writingst:is_instance(improvement) then
---type df.written_content.id|number
local wcid = (#improvement.contents > 0) and improvement.contents[0] or -1
map_itemid_to_written_content_id[item.id] = wcid
if (#improvement.contents > 1) then
dprintf("warning: scroll %d has multiple contents, count ",
item.id, #improvement.contents)
end
-- TODO move this out of the improvements loop. and out of the item-types if.
---type df.written_content
local content = df.written_content.find(wcid)
if content then
if wcid ~= content.id then -- this can't happen.
dprintf("warning: book %d df.written_content.id mismatch %d, %d",
item.id, wcid, content.id)
end
title = content.title
author_hfid = content.author
end
end
end
map_itemid_to_writing_author_hfid[item.id] = author_hfid
local hf = df.historical_figure.find(author_hfid)
local author = (hf) and translateName(hf.name) or ""
map_itemid_to_writing_author_name[item.id] = author
-- okay, we've set title, author_hfid, and author. anything else to do?
else
-- complain?
end
-- TODO complain if author_hf.info.books doesn't have the book or scroll?
-- TODO complain if artifact name ~= title ?
-- TODO complain if artifact maker ~= item.maker ?
return title
end
-- NOT FINISHED
local function Zcompare_items(item1, item2)
-- TODO error if not a book, scroll, or slab.
local title1 = get_title(item1) -- always returns a string.
local title2 = get_title(item2)
if title1 == title2 then
local wcid1 = map_itemid_to_written_content_id[item1.id] or -1
local wcid2 = map_itemid_to_written_content_id[item2.id] or -1
if wcid1 == wcid2 then
return (item1.id < item2.id)
end
return(wcid1 < wcid2)
end
return (title1 < title2)
end
---type table< df.written_content.id, df.written_content >
_map_written_content_id_to_written_content = {} -- global, potentially persistent
---param wcid df.written_content.id
---return df.written_content
local function df_written_content_find(wcid)
local wc = _map_written_content_id_to_written_content[wcid]
if not wc then
wc = df.written_content.find(wcid)
_map_written_content_id_to_written_content[wcid] = wc
end
return wc
end
---type table< df.written_content.id, string >
_map_written_content_id_to_title = _map_written_content_id_to_title or {} -- global, potentially persistent
---param wcid df.written_content.id
---return string
local function written_content_id_to_title(wcid)
local title = _map_written_content_id_to_title[wcid]
if not title then
title = tostring(df_written_content_find(wcid).title)
if title == "" then title = " <Untitled>"; end
_map_written_content_id_to_title[wcid] = title
end
return title -- ah ha ha hah, what a troublesome bug, to not return anything. hard to find.
end
-- Compare two elements in the Result array, for sorting.
-- The elements being compared are a 2-element array
-- [1] is the written_content.id
-- [2] is an array of df.item with that written_content.
-- we are sorting on: primary key written_content.title, secondary key written_content.id
-- TODO maybe we also want to populate the cache maps as return_title() does.
---param a { 1:df.written_content.id, 2:df.item[] }
---param b { 1:df.written_content.id, 2:df.item[] }
---return boolean
local function ZTake_Stock2_compare_Result_entries(a,b)
local titlea = written_content_id_to_title(a[1])
local titleb = written_content_id_to_title(b[1])
if titlea == titleb then
return (a[1] < b[1]) -- use the written_content.id as a tie breaker
end
return (titlea < titleb)
end
-- Returns: an array, values are a 2-element array:
-- [1] is a written_content.id, [2] is an array of df.item with that written_content.
-- This array is sorted by:
-- primary key df.written_content.title, secondary key df.written_content.id
-- Also returns: an array of tables ready to feed to List.setChoices().
-- The tables contain:
-- text = df.written_content.title -- DO NOT rename to something more descriptive.
-- wcid = df.written_content.id
-- items = an array of df.item
-- There are no duplicate wcids or items.
-- This array is sorted by:
-- primary key df.written_content.title, secondary key df.written_content.id
---return { 1:df.written_content.id, 2:df.item[] }[]
---return { text:string, wcid:df.written_content.id, books:df.item[], type:df.written_content_type, refcount:number }[]
local function Take_Stock2 ()
-- TODO rename temp
-- the reason we need to use temp is that there can be multiple books with the
-- same written_content.id .
-- temp is a sparse table keyed on written_content.id .
-- values are arrays of df.item with that written_content.id .
-- 123 = { item#456 }
-- 234 = { item#567, item#678, item#789 }
-- at least one item will always exist for every written_content.id.
-- it is theoretically possible to have two or more written_content.id keys
-- containing the same item, but in practice that doesn't happen.
-- this is because books (but not scrolls) have the potential to contain
-- multiple written_content.id's.
---type table< df.written_content.id, df.item[] >
local temp = {}
-- Insert an item into temp.
---param item df.item
local function Take_Stock2_Process_Item (item)
if item.pos.x == -30000 then return; end -- filter out items in play but not on the map;
-- TODO does this ever match items in buildings?
if item.flags.trader then return; end -- filter out visitor owned items.
if item.flags.in_inventory then return; end -- filter out carried items.
-- TODO is this logical? is this desired?
for _, improvement in ipairs (item.improvements) do
if df.itemimprovement_pagesst:is_instance(improvement) or
df.itemimprovement_writingst:is_instance(improvement)
then
-- currently improvement.contents always contains exactly one entry.
for _, wcid in ipairs (improvement.contents) do
temp[wcid] = temp[wcid] or {} -- init if necessary.
table.insert(temp[wcid], item)
end
end
end
end -- process_item
for _, item in ipairs (df.global.world.items.other.BOOK) do
Take_Stock2_Process_Item(item)
end
for _, item in ipairs (df.global.world.items.other.TOOL) do
Take_Stock2_Process_Item(item)
end
---type { 1:df.written_content.id, 2:df.item[] }[]
local Result = {}
---type { text:string, wcid:df.written_content.id, books:df.item[], type:df.written_content_type, refcount:number }[]
local Result2 = {}
-- collapse the temp sparse table into the Result and Result2 array.
for wcid, items in pairs(temp) do
wc = df_written_content_find(wcid)
table.insert(Result, { wcid, items } )
table.insert(Result2, {
text = written_content_id_to_title(wcid),
wcid = wcid,
books = items,
type = wc.type,
refcount = #wc.refs, -- Q: is this really useful enough to preload?
-- anything else? -- A: it helps with Filter_Stock2, so yes.
} )
end
table.sort(Result, function(a,b)
local titlea = written_content_id_to_title(a[1])
local titleb = written_content_id_to_title(b[1])
if titlea == titleb then
return (a[1] < b[1]) -- use the written_content.id as a tie breaker
end
return (titlea < titleb)
end
)
table.sort(Result2, function(a,b)
if a.text == b.text then
return a.wcid < b.wcid -- use the written_content.id as a tie breaker
end
return a.text < b.text
end
)
return Result, Result2
end
-- Called with Main_Page.Stock2
-- returns a Data_Matrix2, which is:
-- an array [1..14] of
-- arrays [1..something] (the number of flags in this *scholar_flagst subtype) of
-- SORTED-by-title filtered Stock2 entries that can be fed directly to List:SetChoices().
-- note that the DF internal arrays are 0-based: [0..13] and [0..something] .
--
---param Stock2 { text:string, wcid:df.written_content.id, books:df.item[], type:df.written_content_type, refcount:number }[]
---return { text:string, wcid:df.written_content.id, books:df.item[], type:df.written_content_type, refcount:number }[][][]
local function Take_Science_Stock2 (Stock2)
---type { text:string, wcid:df.written_content.id, books:df.item[], type:df.written_content_type, refcount:number }[][][]
local Result = {}