Improve 200 rocks exploit fix
[slashemextended.git] / xlog.readme
blobe5d58ae7d628e0e8f2091004c79c61b8869c54fc
1 Extended logfile patch for Nethack 3.4.3
2 Version 3
4 This patch creates a new, more verbose logfile of all of the games
5 completed, in order to make interpreting the logfile easier, as well as
6 providing a simple way to add new fields to the log.  A new file (named, by
7 default, 'xlogfile') is created, with each line representing a completed
8 game.  The format looks something like:
10 version=3.4.3:points=24978:deathdnum=4:deathlev=8:maxlvl=12:hp=-4:maxhp=95:death
11 s=1:deathdate=20051215:birthdate=20051215:uid=1000:role=Bar:race=Hum:gender=Mal:
12 align=Neu:name=aardvark:death=killed by a gargoyle, while helpless:conduct=0xf80
13 :turns=5925:achieve=0x200:realtime=1414:starttime=1134705144:endtime=1134706562
15 The standard record and logfile both work the same as usual.
17 All of the information from the standard logfile is stored in the extended
18 logfile.  In addition, code to record some extra game data is included.
20 version   - the version of nethack (eg '3.4.3')
21 points    - the final score
22 deathdnum - death dungeon number
23 deathlev  - death level
24 maxlvl    - max dungeon level
25 hp        - final hit points
26 maxhp     - max hit points
27 deaths    - number of deaths
28 deathdate - the date that the game ended (eg '20041130' is Nov 30, 2004)
29 birthdate - the date that the game started
30 uid       - the player's UID
31 role      - the player's role (3-letter abbreviation, eg 'Sam')
32 race      - the player's race (3-letter abbreviation, eg 'Hum')
33 gender    - the player's gender (3-letter abbreviation, eg 'Mal')
34 align     - the player's alignment (3-letter abbreviation, eg 'Law')
35 name      - the player's name
36 death     - the death string (eg 'killed by a woodchuck')
38 * turns   - The number of turns elapsed during the game
40 * conduct - The conducts followed during the game
41   The conducts are encoded as a bitfield, with each bit representing one
42   conduct.  If a bit is set, then the corresponding conduct was followed
43   during the game.  (Note: this is backwards from my original conduct
44   patch, but it seems more natural this way.)
46   Bit 1  (0x0001) - Went without food
47   Bit 2  (0x0002) - Strict vegan diet
48   Bit 3  (0x0004) - Vegetarian diet
49   Bit 4  (0x0008) - Atheist
50   Bit 5  (0x0010) - Never hit with a wielded weapon
51   Bit 6  (0x0020) - Pacifist
52   Bit 7  (0x0040) - Illiterate
53   Bit 8  (0x0080) - Never polymorphed an object
54   Bit 9  (0x0100) - Never changed form
55   Bit 10 (0x0200) - Used no wishes
56   Bit 11 (0x0400) - Did not wish for any artifacts
57   Bit 12 (0x0800) - Never genocided any monsters
59 * realtime - The amount of time spent playing the game
60   Records the time (in seconds) actually spent playing the game.  (Or, more
61   accurately, all of the time that nethack is loaded and running the game.)
62   Specifically, the timer is started right before giving the welcome
63   message, and stopped when you save or when the game is over.
65   Note that this will invalidate save files, because the current value of
66   the timer is recorded in the save file.  Bones files should not be
67   invalidated.
68   
69 * achieve - Whether or not the player reached certain milestones
70   This is another bitfield that records whether or not certain things were
71   achieved.
73   Achievement bitfield:
74   bit  meaning
75    1   obtained the Bell of Opening
76    2   entered gehennom (by any means)
77    3   obtained the Candelabrum of Invocation
78    4   obtained the Book of the Dead
79    5   performed the invocation ritual
80    6   obtained the amulet
81    7   entered elemental planes
82    8   entered astral plane
83    9   ascended (not "escaped in celestial disgrace!")
84    10  obtained the luckstone from the Mines
85    11  obtained the sokoban prize
86    12  defeated Medusa (killed her by any means)
88   This will also invalidate save files, as a structure (u_achieve)
89   containing flags corresponding to a few of these achievements is added
90   to the savefile.  Bones files should not be invalidated.
92 * starttime - The time the game was started, as obtained from time(2).
93               (That is, stored as a 32-bit integer number of seconds
94               since 00:00:00 UTC, January 1, 1970.)  This is the same 
95               time as "birthdate" above, but with greater precision.
97 * endtime - The time the game ended; it is the same time as "deathdate"
98             above.
100 * gender0 - The player's original gender (3 letter abbreviation, eg 'Mal')
102 * align0 - The player's original alignment (3 letter abbreviation, eg 'Law')
104 The file sys/unix/Makefile.top is modified to add xlogfile to the install
105 target.  If you are using a different system, you may need to either initially
106 create xlogfile, or modify your makefiles appropriately.
108 Also included in this patch is an option to display the actual elapsed time
109 (the time that RECORD_REALTIME logs) on the status line.  It is disabled
110 by default, so to enable it you can uncomment the definition of
111 REALTIME_ON_BOTL in config.h (and then set the flag showrealtime in either
112 nethackrc or via the options menu.)  
114 The REALTIME_ON_BOTL option does not depend on XLOGFILE being defined; I
115 just added it to the same patch because they share most of the same code.
116 It does break savefile compatibility for the same reasons that
117 RECORD_REALTIME does.
119 Breakdown of files changed:
120 include/config.h
121   Added a definition for XLOGFILE, the extended logfile filename
122   Added definition of REALTIME_ON_BOTL
123   Added definitions for RECORD_CONDUCT, RECORD_TURNS, RECORD_ACHIEVE,
124   RECORD_REALTIME, RECORD_START_END_TIME, RECORD_GENDER0, RECORD_ALIGN0 
125   in order to give fine-grained control of what should be logged.
126 include/decl.h
127   add d_mineend_level and d_sokoend_level to dungeon_topology structure
128   declaration of u_achieve structure and extern definition of achieve
129   declaration of realtime_data structure and extern definition
130 include/dungeon.h
131   add definitions of Is_mineend_level() and Is_sokoend_level()
132 include/extern.h
133   declaration of get_realtime function
134 include/flag.h
135   added showrealtime to iflags structure
136 include/obj.h
137   add definition of "record_achieve_special" as "corpsenm"
138 src/allmain.c
139   update the status line whenever the number of elapsed minutes changes
140   start the realtime timer and store the time that the game started
141   add get_realtime() function to calculate elapsed time
142 src/botl.c
143   display elapsed time
144 src/decl.c
145   declaration of globals achieve, realtime_data
146 src/do.c
147   set enter_gehennom=1 when the player enters gehennom
148 src/dungeon.c
149   add the mine end and sokoban end levels to the level_map list
150 src/end.c
151   update the realtime counter when the game ends
152 src/invent.c
153   set get_amulet=1, get_candelabrum=1, get_bell=1, and get_book=1 when the
154   corresponding item enters your inventory
155   set get_luckstone and finish_sokoban when the mines luckstone or sokoban
156   prize enters your inventory
157 src/mklev.c
158   set perform_invocation=1 when you successfully perform the invocation
159   ritual
160 src/mon.c
161   set killed_medusa=1 when Medusa is killed
162 src/options.c
163   add "showrealtime" option
164 src/pray.c
165   set ascended=1 when ascending
166 src/restore.c
167   read the stored value of the realtime timer from the savefile, and set the
168   restore time properly
169 src/save.c
170   write the elapsed time to the savefile
171 src/sp_lev.c
172   set otmp->record_achieve_special = 1 when generating mines luckstone and
173   sokoban prize
174 src/topten.c
175   add definition of deathtime
176   add munge_xlstring to convert any ':' in a string to '_'
177   add write_xlentry which writes a single xlogfile entry
178   add encodeconduct which converts the current player's conduct to a number
179   add encodeachieve which converts the game achievements to a number
180   store the time to deathtime when deathdate is calculated
181   open and write to the xlogfile just after writing to the logfile
182 sys/unix/Makefile.top
183   create and set permissions on xlogfile when doing a 'make install'
184 util/makedefs.c
185   add entries for XLOGFILE, RECORD_*, and REALTIME_ON_BOTL to
186   build_opts[] list