-
Notifications
You must be signed in to change notification settings - Fork 1
/
plant.pl
38 lines (36 loc) · 1.54 KB
/
plant.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# external, plants seed
if ($player{'inven'}=~/Ei/) {
($slot,$item)=split(/\-/, $form{'j'});
if ($slot<$NumInven) {
if (length($item)==2) {
if (substr($player{'inven'},$slot*10,2) eq $item) {
open (FILE, "$datadir/maps/$player{'tmap'}/t.txt"); $tileset=<FILE>; close (FILE);
$g=substr($tileset,$player{'tz'}*2,1);
if ($g eq "F" || $g eq "G") {
if ($item eq "Fa") { $plant="Ia"; $estamp=60; $new="Za00000000"; }
if ($item eq "Fb") { $plant="Ia"; $estamp=60; $new="Fa".substr($player{'inven'},($slot*10)+2,8); }
if ($item eq "Fc") { $plant="Ia"; $estamp=60; $new="Fb".substr($player{'inven'},($slot*10)+2,8); }
if ($item eq "Fd") { $plant="Ia"; $estamp=60; $new="Fc".substr($player{'inven'},($slot*10)+2,8); }
if ($plant) {
if (!-d "$datadir/dynamic/$player{'tmap'}") { mkdir "$datadir/dynamic/$player{'tmap'}"; }
if (!-w "$datadir/dynamic/$player{'tmap'}") { chmod 0777, "$datadir/dynamic/$player{'tmap'}" }
$estamp=$cstamp+$estamp;
$estamp=sprintf("%08x", $estamp);
open (FILE,">$datadir/dynamic/$player{'tmap'}/$plant $estamp $player{'tz'}.txt");
print FILE "\n";
close FILE;
substr($player{'inven'},$slot*10,10)="$new";
$player{'inven'}=~s/Ei/Bd/;
do 'inv.pl';#print "inv=$player{'inven'}\n";
print "pop=Planted\n";
}
} else {
print "pop=Not Here\n";
}
}
}
}
} else {
print "pop=Need Water!\n";
}
1;