103 lines
4.1 KiB
Perl
103 lines
4.1 KiB
Perl
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
use Data::Dumper;
|
|
use YAML qw/LoadFile/;
|
|
|
|
use List::Util;
|
|
|
|
our $resdb;
|
|
|
|
=for comment
|
|
'natural_noob' => {
|
|
'Subzones' => {},
|
|
'EnterMessage' => 'Welcome %player to %residence, owned by %owner.',
|
|
'LeaveMessage' => 'Now leaving %residence.',
|
|
'Permissions' => {
|
|
'Owner' => 'simcop2387',
|
|
'AreaFlags' => {
|
|
'move' => 'true',
|
|
'use' => 'true',
|
|
'firespread' => 'false',
|
|
'creeper' => 'false',
|
|
'tnt' => 'false',
|
|
'container' => 'false',
|
|
'build' => 'false'
|
|
},
|
|
'World' => 'main',
|
|
'GroupFlags' => {},
|
|
'PlayerFlags' => {
|
|
'simcop2387' => {
|
|
'admin' => 'true',
|
|
'move' => 'true',
|
|
'use' => 'true',
|
|
'container' => 'true',
|
|
'build' => 'true'
|
|
}
|
|
}
|
|
},
|
|
'Areas' => {
|
|
'main' => {
|
|
'X2' => '2571',
|
|
'Z1' => '-175',
|
|
'Y1' => '101',
|
|
'Z2' => '-180',
|
|
'Y2' => '71',
|
|
'X1' => '2576'
|
|
}
|
|
}
|
|
},
|
|
=cut
|
|
|
|
|
|
sub checkres {
|
|
my ($res, $x, $y, $z) = @_;
|
|
my $areas = $res->{Areas};
|
|
|
|
for my $area (keys %$areas) {
|
|
my ($mx, $my, $mz, $nx, $ny, $nz) = @{$res->{Areas}{$area}}{qw(X2 Y2 Z2 X1 Y1 Z1)};
|
|
|
|
if ($x >= $mx && $y >= $my && $z >= $mz && $x < $nx && $y < $ny && $z < $nz) { # check the rectangle
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
sub findres
|
|
{
|
|
}
|
|
|
|
sub grepres
|
|
{
|
|
my ($x,$y,$z) = @_;
|
|
|
|
my @residences = keys %{$resdb->{Residences}};
|
|
|
|
for my $res (@residences)
|
|
{
|
|
my $rr = $resdb->{Residences}{$res};
|
|
if (
|
|
}
|
|
}
|
|
|
|
sub getsubres {
|
|
my ($res, $x, $y, $z) = @_;
|
|
|
|
|
|
}
|
|
|
|
sub loadres
|
|
{
|
|
$resdb = LoadFile("var/res.yml");
|
|
}
|
|
|
|
|
|
loadres();
|
|
|
|
#17:19:20 < simcop2387> !coords lee
|
|
#17:19:21 < dirkobot> Lee1138 was in world 'main' at -1041x 60y -733z right now
|
|
#17:19:26 < simcop2387> !coords sugna
|
|
#17:19:26 < dirkobot> sugna_z was in world 'main' at -170x 66y -701z 5 seconds ago
|
|
|
|
print findres(-1041, 61, -733);
|