ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/bin/cfmap-plushify
(Generate patch)

Comparing deliantra/Deliantra/bin/cfmap-plushify (file contents):
Revision 1.11 by root, Wed Oct 28 08:51:27 2009 UTC vs.
Revision 1.12 by root, Wed Oct 28 10:17:01 2009 UTC

4#TODO: fix dialogue 4#TODO: fix dialogue
5#TODO: update file format version 5#TODO: update file format version
6 6
7# this script checks, fixes and simplifies @match expressions in a map 7# this script checks, fixes and simplifies @match expressions in a map
8 8
9use Deliantra;
9use Deliantra::Map; 10use Deliantra::Map;
11
12load_archetypes;
10 13
11our $dirty; 14our $dirty;
12 15
13sub fix_msg($) { 16sub fix_msg($) {
14 my ($msg) = @_; 17 my ($msg) = @_;
39 warn "$path ($_) unexpected characters in match\n" if /[\[\]]/; 42 warn "$path ($_) unexpected characters in match\n" if /[\[\]]/;
40 43
41 $_ 44 $_
42} 45}
43 46
44sub patch_face($) { 47sub patch_arch($) {
45 if ($_[0]{face} =~ /\.[1-9]\d\d$/) { 48 if ($_[0]{face} =~ /\.[1-9]\d\d$/) {
46 $_[0]{face} =~ s/\.([2-9])\1\1$/.x1$1/; # 222, 333, 444 49 $_[0]{face} =~ s/\.([2-9])\1\1$/.x1$1/; # 222, 333, 444
47 $_[0]{face} =~ s/\.1(\d\d)$/.x$1/; # 1AB xAB 50 $_[0]{face} =~ s/\.1(\d\d)$/.x$1/; # 1AB xAB
48 $dirty++; 51 $dirty++;
52 }
53
54 unless (exists $ARCH{ $_[0]{_name} }) {
55 die "$_[0]{_name}\n";#d#
49 } 56 }
50} 57}
51 58
52sub patch_inv($) { 59sub patch_inv($) {
53 my ($arch) = @_; 60 my ($arch) = @_;
54 61
55 my $inv = $arch->{inventory} || []; 62 my $inv = $arch->{inventory} || [];
56 63
57 for (@$inv) { 64 for (@$inv) {
58 patch_face $_; 65 patch_arch $_;
59 66
60 if ($_->{type} == 116 || $_->{_name} =~ /^event_/) { 67 if ($_->{type} == 116 || $_->{_name} =~ /^event_/) {
61 # deliantra to old deliantra+ 68 # deliantra to old deliantra+
62 if ($_->{slaying} eq '/python/IPO/send.py') { 69 if ($_->{slaying} eq '/python/IPO/send.py') {
63 $_->{title} = 'perl'; 70 $_->{title} = 'perl';
134 or die "$path: file load error\n"; 141 or die "$path: file load error\n";
135 142
136 $dirty = 0; 143 $dirty = 0;
137 144
138 for my $a (map @$_, grep $_, map @$_, grep $_, @{ $map->{map} }) { 145 for my $a (map @$_, grep $_, map @$_, grep $_, @{ $map->{map} }) {
139 patch_face $a; 146 patch_arch $a;
140
141 patch_inv $a if $a->{inventory}; 147 patch_inv $a if $a->{inventory};
142 148
143 next unless $a->{msg} =~ /^\@match /; 149 next unless $a->{msg} =~ /^\@match /;
144 150
145 my $old = $a->{msg}; 151 my $old = $a->{msg};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines