-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtile.pl
45 lines (43 loc) · 1.4 KB
/
tile.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
# external, changes tile player is standing on
$version="1.0";
if ($player{'inven'}=~/Zd/) {
if (substr($form{'j'},0,1) ge "A") {
if (substr($form{'j'},0,1) le "Z") {
if (substr($form{'j'},1,1) ge "a") {
if (substr($form{'j'},1,1) le "z") {
if (length($form{'j'})==2) {
open (FILE, "$datadir/maps/$player{'tmap'}/t.txt");
if(substr($player{'tmap'},1,1)ge'a'){
@tileset=<FILE>;
close FILE;
for(@tileset){chomp;}
$x1=$MapSizeX+1;
$y1=$MapSizeY+1;
$q=0;
$z=$player{'z'};
$y=int($z/$MapWide);
$x=$z-($y*$MapWide);
if($y>$MapSizeY){$q=2;$y-=$y1;}
if($x>$MapSizeX){$q++;$x-=$x1;}
$z=$y*$x1+$x;
while(length($tileset[$q])<$x1*$y1*2){$tileset[$q].='Ua';}
substr($tileset[$q],$z*2,2)=$form{'j'};
open (FILE, ">$datadir/maps/$player{'tmap'}/t.txt"); print FILE join("\n",@tileset)."\n";
}else{
$tileset=<FILE>;
close (FILE);
substr($tileset,$player{'tz'}*2,2)="$form{'j'}";
open (FILE, ">$datadir/maps/$player{'tmap'}/t.txt"); print FILE "$tileset\n";
}
close FILE;
open (FILE, ">$datadir/maps/$player{'tmap'}/s.txt"); print FILE "$cstamp\n"; close FILE;
# send new $tileset to client
}
}
}
}
}
} else {
print "pop=Need Sysop Key\n";
}
1;