… | |
… | |
18 | use Crossfire; |
18 | use Crossfire; |
19 | use Crossfire::MapWidget; |
19 | use Crossfire::MapWidget; |
20 | use File::Spec::Functions; |
20 | use File::Spec::Functions; |
21 | use Cwd 'abs_path'; |
21 | use Cwd 'abs_path'; |
22 | |
22 | |
23 | our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget quick_msg def arch_is_exit map2abs exit_paths); |
23 | our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget quick_msg def arch_is_exit map2abs exit_paths pseudohtml2txt); |
|
|
24 | |
|
|
25 | sub pseudohtml2txt { |
|
|
26 | my ($html) = @_; |
|
|
27 | |
|
|
28 | $html =~ s/<br\s*?\/?>/\n/gsi; |
|
|
29 | $html =~ s/<b>(.*?)<\/b>/_\1_/gsi; |
|
|
30 | $html =~ s/<li>/\n* /gi; |
|
|
31 | $html =~ s/<\/?\s*li>//gi; |
|
|
32 | $html =~ s/<\/?\s*ul>//gi; |
|
|
33 | $html =~ s/>/>/g; |
|
|
34 | $html =~ s/</</g; |
|
|
35 | $html |
|
|
36 | } |
24 | |
37 | |
25 | sub exit_paths { |
38 | sub exit_paths { |
26 | my ($mappath, $map1path, $map2path) = @_; |
39 | my ($mappath, $map1path, $map2path) = @_; |
27 | $mappath = abs_path $mappath; |
40 | $mappath = abs_path $mappath; |
28 | $map1path = abs_path $map1path; |
41 | $map1path = abs_path $map1path; |
… | |
… | |
52 | } |
65 | } |
53 | |
66 | |
54 | sub map2abs { |
67 | sub map2abs { |
55 | my ($dest, $mape) = @_; |
68 | my ($dest, $mape) = @_; |
56 | |
69 | |
|
|
70 | $mappath = abs_path $mappath; |
57 | my $dir; |
71 | my $dir; |
58 | if (File::Spec->file_name_is_absolute($dest)) { |
72 | if (File::Spec->file_name_is_absolute($dest)) { |
59 | $dir = catdir ($::CFG->{MAPDIR}, $dest); |
73 | $dir = catdir ($::CFG->{MAPDIR}, $dest); |
60 | } else { |
74 | } else { |
61 | my ($v, $p, $f) = File::Spec->splitpath ($mape->{path}); |
75 | my ($v, $p, $f) = File::Spec->splitpath ($mape->{path}); |