1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | # cfmap2html - convert deliantra maps to html |
3 | # cfmap2html - convert deliantra maps to html |
4 | # Copyright (C) 2005,2007,2008 Marc Lehmann <cfmaps@schmorp.de> |
4 | # Copyright (C) 2005,2007,2008,2009 Marc Lehmann <cfmaps@schmorp.de> |
5 | # |
5 | # |
6 | # CFMAP2HTML is free software; you can redistribute it and/or modify |
6 | # CFMAP2HTML is free software; you can redistribute it and/or modify |
7 | # it under the terms of the GNU General Public License as published by |
7 | # it under the terms of the GNU General Public License as published by |
8 | # the Free Software Foundation; either version 2 of the License, or |
8 | # the Free Software Foundation; either version 2 of the License, or |
9 | # (at your option) any later version. |
9 | # (at your option) any later version. |
… | |
… | |
15 | # |
15 | # |
16 | # You should have received a copy of the GNU General Public License |
16 | # You should have received a copy of the GNU General Public License |
17 | # along with cfmaps; if not, write to the Free Software |
17 | # along with cfmaps; if not, write to the Free Software |
18 | # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | |
19 | |
20 | our $VERSION = '2.11'; |
20 | our $VERSION = '2.122'; |
21 | |
21 | |
22 | use strict; |
22 | use strict; |
23 | |
23 | |
24 | use List::Util qw(min max); |
24 | use List::Util qw(min max); |
25 | use Deliantra; |
25 | use Deliantra; |
… | |
… | |
124 | |
124 | |
125 | print "<p class='m'>", |
125 | print "<p class='m'>", |
126 | escape_html delete $info->{msg}, |
126 | escape_html delete $info->{msg}, |
127 | "</p>"; |
127 | "</p>"; |
128 | |
128 | |
|
|
129 | if (open my $fh, "<", "$base.png.err") { |
|
|
130 | local $/; |
129 | print "<p class='i'><table>", |
131 | print "<p class='m'>", |
|
|
132 | (escape_html scalar <$fh>), |
|
|
133 | "</p>"; |
|
|
134 | } |
|
|
135 | |
|
|
136 | print "<table class='i'>", |
130 | (map "<tr><td>" . (escape_html $_) . "</td><td>" . (escape_html $info->{$_}) . "</td></tr>", |
137 | (map "<tr><td>" . (escape_html $_) . "</td><td>" . (escape_html $info->{$_}) . "</td></tr>", |
131 | grep !/^_/, keys %$info), |
138 | grep !/^_/, keys %$info), |
132 | "</table></p>"; |
139 | "</table>", |
|
|
140 | "<p />"; |
133 | |
141 | |
134 | print "<table class='map'>"; |
142 | print "<table class='map'>"; |
135 | |
143 | |
136 | my %ignore = map +($_ => 1), qw(name _name _atype x y); |
144 | my %ignore = map +($_ => 1), qw(name _name _atype x y); |
137 | my %is_exit = map +($_ => 1), 41, 57, 66; |
145 | my %is_exit = map +($_ => 1), 41, 57, 66; |
… | |
… | |
155 | |
163 | |
156 | print "<div>($x|$y)"; |
164 | print "<div>($x|$y)"; |
157 | |
165 | |
158 | sub print_archs { |
166 | sub print_archs { |
159 | print "<ul>"; |
167 | print "<ul>"; |
160 | for my $a (@{$_[0]}) { |
168 | for my $a (reverse @{$_[0]}) { |
161 | my $o = $ARCH{$a->{_name}}; |
169 | my $o = $ARCH{$a->{_name}}; |
162 | my $type = $a->{type} || $o->{type}; |
170 | my $type = $a->{type} || $o->{type}; |
163 | my $aname = escape_html $a->{_name}; |
171 | my $aname = escape_html $a->{_name}; |
164 | my $name = escape_html $a->{name} || $o->{name}; |
172 | my $name = escape_html $a->{name} || $o->{name}; |
165 | |
173 | |