-
Notifications
You must be signed in to change notification settings - Fork 1
/
g-Ia.pl
84 lines (73 loc) · 1.97 KB
/
g-Ia.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# g-expires Ia tomato plant
# $z=$tokens[2];
# get x and y
# tomato fit on screen?
# is there item left?
# is there item right?
# is there item up?
# is there item down?
$estamp=$cstamp+60; $estamp=sprintf("%08x", $estamp);
$y=int($tokens[2]/$MapWide);
$x=$tokens[2]-($y*$MapWide);
$gz=$tokens[2];
#if (glob "$dir/????????????$gz.txt") {} else {
# open (FILE,">$dir/Dh $estamp $gz.txt"); print FILE "\n"; close FILE;
#}
if (rand(100)<25) {
if ($x<$MapWide-1) {
$gz=$tokens[2]+1;
if (glob "$dir/????????????$gz.txt") {} else {
$f="F".chr(int(rand(4)+97));
open (FILE,">$dir/$f $estamp $gz.txt"); print FILE "\n"; close FILE;
$items.="$f".sprintf("%02x", $gz);
}
}
}
if (rand(100)<25) {
if ($x>0) {
$gz=$tokens[2]-1;
if (glob "$dir/????????????$gz.txt") {} else {
$f="F".chr(int(rand(4)+97));
open (FILE,">$dir/$f $estamp $gz.txt"); print FILE "\n"; close FILE;
$items.="$f".sprintf("%02x", $gz);
}
}
}
if (rand(100)<25) {
if ($y<$MapSizeY-1) {
$gz=$tokens[2]+$MapSizeX+1;
if (glob "$dir/????????????$gz.txt") {} else {
$f="F".chr(int(rand(4)+97));
open (FILE,">$dir/$f $estamp $gz.txt"); print FILE "\n"; close FILE;
$items.="$f".sprintf("%02x", $gz);
}
}
}
if (rand(100)<25) {
if ($y>0) {
$gz=$tokens[2]-$MapSizeX-1;
if (glob "$dir/????????????$gz.txt") {} else {
$f="F".chr(int(rand(4)+97));
open (FILE,">$dir/$f $estamp $gz.txt"); print FILE "\n"; close FILE;
$items.="$f".sprintf("%02x", $gz);
}
}
}
if (rand(100)<50) {
# tomato plant lives
open (FILE,">$dir/Ia $estamp $tokens[2].txt");
print FILE "\n";
close FILE;
$items.=$tokens[0].sprintf("%02x", $tokens[2]);
} else {
if (rand(100)<50) {
$f="F".chr(int(rand(4)+97));
open (FILE,">$dir/$f $estamp $tokens[2].txt");
print FILE "\n";
close FILE;
$items.="$f".sprintf("%02x", $tokens[2]);
}
}
# check if item is on ground left right up down
# if not, randomly place new tomato
1;