package SM::Server::Packet::Location::Initial; use SM::Constants; use base SM::Server::Packet; my $type = DATA_Location; my $sub_type = DATA_SUB_Initial; sub new { my $class = shift; my $direction = shift; my $self; if ( $diretion == IN ) { my $raw_data = shift @_; my ( $type, $sub_type, $x, $y ) = unpack "nnff", $raw_data; $self = bless { type => $type, sub_type => $sub_type, x => $x, y => $y, raw_data => $raw_data; }, $class; } elsif ( $direction == OUT ) { #my $type = shift @_; #my $sub_type = shift @_; my $x = shift @_; my $y = shift @_; my $raw_data = pack "nnff", $type, $sub_type, $x, $y; $self = bless { type => $type, sub_type => $sub_type, x => $x, y => $y, raw_data => $raw_data; }, $class; } return $self; } sub get_x { my ($self) = @_; return $self->{x}; } sub get_y { my ($self) = @_; return $self->{y}; } sub get_xy { my ($self) = @_; return ($self->get_x(), $self->get_y()); }