… | |
… | |
58 | qw(move_type move_block move_allow move_on move_off move_slow); |
58 | qw(move_type move_block move_allow move_on move_off move_slow); |
59 | |
59 | |
60 | # same as in server save routine, to (hopefully) be compatible |
60 | # same as in server save routine, to (hopefully) be compatible |
61 | # to the other editors. |
61 | # to the other editors. |
62 | our @FIELD_ORDER_MAP = (qw( |
62 | our @FIELD_ORDER_MAP = (qw( |
|
|
63 | file_format_version |
63 | name attach swap_time reset_timeout fixed_resettime difficulty region |
64 | name attach swap_time reset_timeout fixed_resettime difficulty region |
64 | shopitems shopgreed shopmin shopmax shoprace |
65 | shopitems shopgreed shopmin shopmax shoprace |
65 | darkness width height enter_x enter_y msg maplore |
66 | darkness width height enter_x enter_y msg maplore |
66 | unique template |
67 | unique template |
67 | outdoor temp pressure humid windspeed winddir sky nosmooth |
68 | outdoor temp pressure humid windspeed winddir sky nosmooth |
… | |
… | |
199 | while (my ($k, $v) = each %attack_mask) { |
200 | while (my ($k, $v) = each %attack_mask) { |
200 | $ob->{"resist_$k"} = min 100, max -100, $ob->{"resist_$k"} + $value if $mask & $v; |
201 | $ob->{"resist_$k"} = min 100, max -100, $ob->{"resist_$k"} + $value if $mask & $v; |
201 | } |
202 | } |
202 | } |
203 | } |
203 | |
204 | |
|
|
205 | my %MATERIAL = reverse |
|
|
206 | paper => 1, |
|
|
207 | iron => 2, |
|
|
208 | glass => 4, |
|
|
209 | leather => 8, |
|
|
210 | wood => 16, |
|
|
211 | organic => 32, |
|
|
212 | stone => 64, |
|
|
213 | cloth => 128, |
|
|
214 | adamant => 256, |
|
|
215 | liquid => 512, |
|
|
216 | tin => 1024, |
|
|
217 | bone => 2048, |
|
|
218 | ice => 4096, |
|
|
219 | |
|
|
220 | # guesses |
|
|
221 | runestone => 12, |
|
|
222 | bronze => 18, |
|
|
223 | "ancient wood" => 20, |
|
|
224 | glass => 36, |
|
|
225 | marble => 66, |
|
|
226 | ice => 68, |
|
|
227 | stone => 70, |
|
|
228 | stone => 80, |
|
|
229 | cloth => 136, |
|
|
230 | ironwood => 144, |
|
|
231 | adamantium => 258, |
|
|
232 | glacium => 260, |
|
|
233 | blood => 544, |
|
|
234 | ; |
|
|
235 | |
204 | # object as in "Object xxx", i.e. archetypes |
236 | # object as in "Object xxx", i.e. archetypes |
205 | sub normalize_object($) { |
237 | sub normalize_object($) { |
206 | my ($ob) = @_; |
238 | my ($ob) = @_; |
|
|
239 | |
|
|
240 | # convert material bitset to materialname, if possible |
|
|
241 | if (exists $ob->{material}) { |
|
|
242 | if (!$ob->{material}) { |
|
|
243 | delete $ob->{material}; |
|
|
244 | } elsif (exists $ob->{materialname}) { |
|
|
245 | if ($MATERIAL{$ob->{material}} eq $ob->{materialname}) { |
|
|
246 | delete $ob->{material}; |
|
|
247 | } else { |
|
|
248 | warn "object $ob->{_name} has both materialname ($ob->{materialname}) and material ($ob->{material}) set.\n"; |
|
|
249 | delete $ob->{material}; # assume materilname is more specific and nuke material |
|
|
250 | } |
|
|
251 | } elsif (my $name = $MATERIAL{$ob->{material}}) { |
|
|
252 | delete $ob->{material}; |
|
|
253 | $ob->{materialname} = $name; |
|
|
254 | } else { |
|
|
255 | warn "object $ob->{_name} has unknown material ($ob->{material}) set.\n"; |
|
|
256 | } |
|
|
257 | } |
207 | |
258 | |
208 | # nuke outdated or never supported fields |
259 | # nuke outdated or never supported fields |
209 | delete @$ob{qw( |
260 | delete @$ob{qw( |
210 | can_knockback can_parry can_impale can_cut can_dam_armour |
261 | can_knockback can_parry can_impale can_cut can_dam_armour |
211 | can_apply pass_thru can_pass_thru |
262 | can_apply pass_thru can_pass_thru |
… | |
… | |
517 | |
568 | |
518 | my $inv = delete $a{inventory}; |
569 | my $inv = delete $a{inventory}; |
519 | my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some |
570 | my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some |
520 | my $anim = delete $a{anim}; |
571 | my $anim = delete $a{anim}; |
521 | |
572 | |
|
|
573 | if ($a{_atype} eq 'object') { |
|
|
574 | $str .= join "\n", "anim", @$anim, "mina\n" |
|
|
575 | if $anim; |
|
|
576 | } |
|
|
577 | |
522 | my @kv; |
578 | my @kv; |
523 | |
579 | |
524 | for ($a{_name} eq "map" |
580 | for ($a{_name} eq "map" |
525 | ? @Crossfire::FIELD_ORDER_MAP |
581 | ? @Crossfire::FIELD_ORDER_MAP |
526 | : @Crossfire::FIELD_ORDER) { |
582 | : @Crossfire::FIELD_ORDER) { |
… | |
… | |
570 | } |
626 | } |
571 | } |
627 | } |
572 | |
628 | |
573 | if ($inv) { |
629 | if ($inv) { |
574 | $append->($_) for @$inv; |
630 | $append->($_) for @$inv; |
575 | } |
|
|
576 | |
|
|
577 | if ($a{_atype} eq 'object') { |
|
|
578 | $str .= join "\n", "anim", @$anim, "mina\n" |
|
|
579 | if $anim; |
|
|
580 | } |
631 | } |
581 | |
632 | |
582 | $str .= "end\n"; |
633 | $str .= "end\n"; |
583 | |
634 | |
584 | if ($a{_atype} eq 'object') { |
635 | if ($a{_atype} eq 'object') { |