5 no warnings 'qw'; # you know what you doing
6 no warnings 'uninitialized'; # save some useless checks for more legible code
11 if (exists $get{ascii}) {
12 $ascii = $get{ascii} ne '0'; # manual override
13 } elsif (defined $ENV{HTTP_ACCEPT_CHARSET}) {
15 for (split q{,}, $ENV{HTTP_ACCEPT_CHARSET}) {
16 $ascii = 0, last if $_ eq '*' or m{utf-?8}i;
20 my $charset = $ascii ? 'us-ascii' : 'utf-8';
21 my $ctype = "text/html; charset=$charset";
22 $header{content_type} = $ctype;
24 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
25 "http://www.w3.org/TR/html4/loose.dtd">
29 <title>nethack cheat sheet</title>
30 <meta http-equiv="content-type" content="<:= $ctype :>">
31 <link rel="stylesheet" type="text/css" media="all" href="base.css">
32 <!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->
33 <!--[if lte IE 7]><style> .help dl.legend dd {float:none} </style><![endif]--><:
34 my %styles = map {$_ => $_} qw(dark circus mono red terse);
35 our $style = exists $get{style} && $styles{$get{style}} || 'light';
36 printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
37 $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_
40 our $showkeys = exists $get{keys} && $get{keys} ne '0';
41 print "\n<style> .no {visibility:hidden} </style>" unless $showkeys;
42 print "\n<style> .no, .alias {opacity:.5} </style>"
43 if $showkeys and $get{keys} eq 'ghost';
45 <script type="text/javascript" src="/keys.js"></script>
49 <h1>NetHack cheat sheet</h1>
51 <h2>normal gameplay</h2>
56 <ul class="keys omni">
57 <li class="me" onclick="setmode()"><b>Esc</b>
58 <!-- static reset button, even though it's not (officially) in the game -->
64 arg => $ascii ? '.' : '·', # described as 'dot'
65 args => $ascii ? ':' : '⁚',
66 argi => $ascii ? "'" : '′',
67 argm => $ascii ? '|' : '↕',
68 motion => $ascii ? '|' : '↕',
69 alias => $ascii ? 'see: ' : '»',
70 up => $ascii ? 'up' : '▲',
71 right => $ascii ? 'right' : '▶',
72 down => $ascii ? 'down' : '▼',
73 left => $ascii ? 'left' : '◀',
74 sep => $ascii ? '*' : '•',
75 _ => exists $get{ascii} && !$ascii ? "\x{200b}" : '<wbr>',
76 # use the correct ZWNJ only when unicode is forced on
77 # default to use unofficial html for best support
80 use Shiar_Sheet::Keyboard;
81 my $keys = Shiar_Sheet::Keyboard->new({do 'nethack.inc.pl'});
82 $keys->map($get{map}) or undef $get{map};
83 $keys->print_rows($get{static});
91 <dl class="legend legend-types">
92 <dt class="pm">direction
93 <dd>Direction to move to or target a command (<:= $sign{motion} :>).
95 <dd>Other character movement.
97 <dd>Direct action command: takes a turn.
99 <dd>Informational command: shows/does something without ending the turn.
100 <dt class="mo">invertory
101 <dd>Display invertory menu.
103 <dd>Enters some other menu.
108 <dl class="legend legend-options">
109 <dt>key<:= $sign{arg} :>
110 <dd>Commands with a dot need at least one argument afterwards.
111 <dt>key<:= $sign{argi} :>
112 <dd>Asks for an inventory item.
113 <dt>key<:= $sign{argm} :>
114 <dd>Requires a direction afterwards.
117 <ul class="legend legend-set">
118 <li>keyboard <strong>map</strong> is
119 <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
120 <li><strong>ascii</strong> mode is
121 <:= exists $get{ascii} && 'forced ' :><em><:=
122 $ascii ? 'on' : 'off' :></em>
123 <li><strong>keys</strong> are
124 <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
125 !exists $get{keys} && ' by default' :>
126 <li>default <strong>style</strong> is
127 <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
133 <a href="http://sheet.shiar.nl/" rel="home">sheet.shiar.nl</a>/nethack
134 <a href="git://dev.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= "v$VERSION" :></a>
135 created by <a href="http://shiar.nl/" rel="author">Shiar</a> <:= $sign{sep} :>
136 <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
137 href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a> <:= $sign{sep} :>
139 use Time::Format qw(time_format);
140 print time_format('yyyy-mm-dd', (stat 'nethack.inc.pl')[9]);