diff --git a/layouts/partials/nethack/logentry.html b/layouts/partials/nethack/logentry.html index 6ea1e6f..caa9494 100644 --- a/layouts/partials/nethack/logentry.html +++ b/layouts/partials/nethack/logentry.html @@ -13,7 +13,20 @@ {{- $startDatetime := time.Format "2006-01-02" .start_date -}} Began {{ .score | lang.FormatNumber 0 }} points - Level {{ .character.max_level }} + {{/* + When I first wrote the importer script, I read about the log file + format on the Nethackwiki. It labeled a field as "maximum level", + which I interpreted as maximum character level. Turns out it's + actually maximum *dungeon* level. The script has been updated, but I + won't be able to update all the imported logfiles. + + https://nethackwiki.com/wiki/Logfile + */}} + {{ with .dungeon.max_level }} + {{ .descriptive }} + {{ else }} + {{ with .character.max_level }}Level {{ . }}{{ end }} + {{ end }} {{ cond (gt .character.hp.n 0) (printf "%s / %s" .character.hp.n .character.hp.max) .character.hp.max }} hp diff --git a/scripts/import-nethack-logfile.py b/scripts/import-nethack-logfile.py index 752dace..36bed69 100755 --- a/scripts/import-nethack-logfile.py +++ b/scripts/import-nethack-logfile.py @@ -24,7 +24,7 @@ DUNGEONS = { 3: 'The Quest', 4: 'Sokoban', 5: 'Fort Ludios', - 6: "Vlad's Tower", + 6: 'Vlad’s Tower', 7: 'The Elemental Planes', } @@ -97,6 +97,12 @@ def main(argv): else: dungeon_level_descriptive = SPECIAL_DUNGEON_LEVELS[dungeon_level] + max_dungeon_level = int(fields[4]) + if max_dungeon_level > 0: + max_dungeon_level_descriptive = f"Level {max_dungeon_level}" + else: + max_dungeon_level_descriptive = SPECIAL_DUNGEON_LEVELS[max_dungeon_level] + start_date = datetime.datetime.strptime(fields[9], '%Y%m%d').strftime('%Y-%m-%d') end_date = datetime.datetime.strptime(fields[8], '%Y%m%d').strftime('%Y-%m-%d') @@ -112,13 +118,13 @@ def main(argv): 'n': int(fields[2]), 'name': dungeon_name, 'level': {'n': dungeon_level, 'descriptive': dungeon_level_descriptive}, + 'max_level': {'n': max_dungeon_level, 'descriptive': max_dungeon_level_descriptive}, }, 'end_date': end_date, 'start_date': start_date, 'character': { 'name': name, 'descriptor': f'{name}-{role}-{race}-{gender}-{alignment}', - 'max_level': int(fields[4]), 'hp': {'n': int(fields[5]), 'max': int(fields[6])}, 'role': {'short': role, 'descriptive': ROLES[role]}, 'race': {'short': race, 'descriptive': RACES[race]},