| 1 |
elmex |
1.1 |
package GCE::MapArch; |
| 2 |
|
|
=head1 NAME |
| 3 |
|
|
|
| 4 |
elmex |
1.2 |
GCE::MapArch - a class for handling deliantra maps |
| 5 |
elmex |
1.1 |
|
| 6 |
|
|
=over 4 |
| 7 |
|
|
|
| 8 |
|
|
=cut |
| 9 |
|
|
|
| 10 |
|
|
sub new { |
| 11 |
|
|
my $class = shift; |
| 12 |
|
|
my $self = { @_ }; |
| 13 |
|
|
bless $self, $class; |
| 14 |
|
|
return $self; |
| 15 |
|
|
} |
| 16 |
|
|
|
| 17 |
|
|
sub init_from_displaymap { |
| 18 |
|
|
my ($self, $dispmap) = @_; # map is the arch2map returnvalue |
| 19 |
|
|
|
| 20 |
|
|
$self->{dispmap} = $dispmap; |
| 21 |
|
|
} |
| 22 |
|
|
|
| 23 |
|
|
sub get_arch_params { |
| 24 |
|
|
my ($self, $arch) = @_; |
| 25 |
|
|
|
| 26 |
|
|
my %attrmap = ( |
| 27 |
|
|
'msg' => [qw/msg/], |
| 28 |
|
|
'name' => [qw/name/], |
| 29 |
|
|
'enter_x' => [qw/hp enter_x/], |
| 30 |
|
|
'enter_y' => [qw/sp enter_y/], |
| 31 |
|
|
'width' => [qw/x width/], |
| 32 |
|
|
'height' => [qw/y height/], |
| 33 |
|
|
'reset_timeout' => [qw/weight reset_timeout/], |
| 34 |
|
|
'swap_time' => [qw/value swap_time/], |
| 35 |
|
|
'difficulty' => [qw/level difficulty/], |
| 36 |
|
|
'darkness' => [qw/invisible darkness/], |
| 37 |
|
|
'fixed_resettime' => [qw/stand_still fixed_resettime/], |
| 38 |
|
|
'unique' => [qw/unique/], |
| 39 |
|
|
'template' => [qw/template/], |
| 40 |
|
|
'region' => [qw/region/], |
| 41 |
|
|
'shopitems' => [qw/shopitems/], |
| 42 |
|
|
'shopgreed' => [qw/shopgreed/], |
| 43 |
|
|
'shopmin' => [qw/shopmin/], |
| 44 |
|
|
'shopmax' => [qw/shopmax/], |
| 45 |
|
|
'shoprace' => [qw/shoprace/], |
| 46 |
|
|
'outdoor' => [qw/outdoor/], |
| 47 |
|
|
'temp' => [qw/temp/], |
| 48 |
|
|
'pressure' => [qw/pressure/], |
| 49 |
|
|
'humid' => [qw/humid/], |
| 50 |
|
|
'windspeed' => [qw/windspeed/], |
| 51 |
|
|
'winddir' => [qw/winddir/], |
| 52 |
|
|
'sky' => [qw/sky/], |
| 53 |
|
|
'nosmooth' => [qw/nosmooth/], |
| 54 |
|
|
); |
| 55 |
|
|
|
| 56 |
|
|
my $params = {}; |
| 57 |
|
|
|
| 58 |
|
|
for (keys %attrmap) { |
| 59 |
|
|
for my $from_attr (@{$attrmap{$_}}) { |
| 60 |
|
|
defined $arch->{$from_attr} |
| 61 |
|
|
and $params->{$_} = $arch->{$from_attr}; |
| 62 |
|
|
} |
| 63 |
|
|
} |
| 64 |
|
|
|
| 65 |
|
|
return $params; |
| 66 |
|
|
} |
| 67 |
|
|
|
| 68 |
|
|
|
| 69 |
|
|
=head1 AUTHOR |
| 70 |
|
|
|
| 71 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 72 |
|
|
http://home.schmorp.de/ |
| 73 |
|
|
|
| 74 |
|
|
Robin Redeker <elmex@ta-sa.org> |
| 75 |
|
|
http://www.ta-sa.org/ |
| 76 |
|
|
|
| 77 |
|
|
=cut |