1 |
#!@PERL@ |
2 |
# Adds the throwing skill to to the old player files. This script |
3 |
# is likely no longer needed, since skills have been around for quite a while. |
4 |
# |
5 |
|
6 |
$end = 0; |
7 |
if (!-e $ARGV[0]) { |
8 |
die("Can not find file $ARGV[0]\n"); |
9 |
} |
10 |
if (-e $ARGV[0].".old") { |
11 |
die("$ARGV[0].new already exists.\n"); |
12 |
} |
13 |
rename($ARGV[0], $ARGV[0].".old"); |
14 |
open(PLAYER,"<".$ARGV[0].".old") || die("can not open $ARGV[0].old"); |
15 |
open(PL_NEW,">".$ARGV[0]) || die("can not open $ARGV[0]"); |
16 |
|
17 |
while (<PLAYER>) { |
18 |
if (/^end$/) { |
19 |
if ($end) { |
20 |
print PL_NEW "arch skill_throwing\nend\nend\n"; |
21 |
} |
22 |
else {print PL_NEW $_;} |
23 |
$end=1; |
24 |
} |
25 |
else { |
26 |
print PL_NEW $_; |
27 |
$end=0; |
28 |
} |
29 |
} |
30 |
close(PLAYER); |
31 |
close(PL_NEW); |