Games-Lacuna-Client

 view release on metacpan or  search on metacpan

examples/glyphinator.pl  view on Meta::CPAN

                $zone = "$x_zone|$y_zone";
            }
            push @results, [$dest_name, $row->{x}, $row->{y}, $dist, $zone, $row->{checked_epoch} || 0];
            push @$skip, $dest_name;
        }
    }

    return @results;
}

sub update_last_sent {
    my ($x, $y) = @_;

    my $r = $star_db->do(q{update orbitals set last_excavated = datetime(?,'unixepoch') where x = ? and y = ?}, {}, time(), $x, $y);
    unless ($r > 0) {
        diag("Warning: could not update orbitals table for body at $x, $y!\n");
    }
}

sub mark_orbit_empty {
    my ($x, $y) = @_;

examples/map/lib/LacunaMap/DB.pm  view on Meta::CPAN

sub max_y {
  my $row = LacunaMap::DB->selectrow_arrayref("SELECT MAX(y) FROM stars");
  ref($row) && ref($row) eq 'ARRAY' && @$row > 0 && defined($row->[0])
    or die "Is the stars database empty? Did you load a database?";
  return $row->[0];
}


package LacunaMap::DB::Bodies;

sub update_from_news {
  my $class = shift;
  my $client = shift;
  my $news = shift;

  my $updater = sub {
    my $news = $_;
    my $res = $news->parse_title;
    return if not $res;
    if ($res->{type} eq 'new colony') {
      warn "NEW COLONY";

examples/map/merge_bodies.pl  view on Meta::CPAN

        process( $old, $new );
        $bodies->{ $star_id }{ $name } = $old;
    }
    else
    {
        $bodies->{ $star_id }{ $name } = $new;
    }
    updater( $bodies->{ $star_id }{ $name } );
}

sub updater
{
    my $res = shift;
    my $bodies = LacunaMap::DB::Bodies->select(
        'where star_id = ? and name = ?', $res->{star_id}, $res->{name}
    );
    if ( not @$bodies )
    {
        # new entry
        delete $res->{updated};
        warn "no bodies found in DB, adding\n", Dumper( $res );

examples/merge_probe.pl  view on Meta::CPAN

  }
  return $data;
}

sub ownership_test {
  my ($elem, $ename) = @_;
  return join(":",$elem->{name}, $elem->{observatory}->{empire},
              $elem->{observatory}->{oid}, $elem->{observatory}->{pid}, $ename);
}

sub update_vacate {
  my ($curr_m, $updt_m, $curr_e, $updt_e) = @_;

  if ($updt_e ne '' and $curr_e ne $updt_e) {
      push @{$curr_m}, $updt_e;
  }
  push @{$curr_m}, @{$updt_m};
  my %thash;
  for (@{$curr_m}) {
    $thash{$_} = 1 if ($_ ne '' and $_ ne "nobody");
  }

examples/star_db_util.pl  view on Meta::CPAN


        output("Inserting star $name at $x, $y\n");
        $insert_star ||= $star_db->prepare('insert into stars (id, name, x, y, color, zone, last_checked) values (?,?,?,?,?,?,?)');
        $insert_star->execute($id, $name, $x, $y, $color, $zone, $when)
            or die "Can't insert star: " . $insert_star->errstr;
    }
}

{
    my $update_star;
    sub update_star {
        my ($star) = @_;
        my ($x, $y, $name, $color, $zone) = @{$star}{qw/x y name color zone/};

        my $when = $star->{last_checked} || strftime "%Y-%m-%d %T", gmtime;

        output("Updating star at $x, $y to name $name, color $color, zone $zone\n");
        $update_star ||= $star_db->prepare(q{update stars set last_checked = ?, name = ?, color = ?, zone = ? where x = ? and y = ?});
        $update_star->execute($when, $name, $color, $zone, $x, $y);
    }
}

examples/wr.pl  view on Meta::CPAN

  ---
  api_key: the_public_key
  empire_name: Name of empire
  empire_password: password of empire
  server_uri: https://us1.lacunaexpanse.com/

END_USAGE

}

sub update_wr {
  my $wr = shift;
  my $iwr = shift;

  output("checking WR stats for WR $iwr");
  my $wr_stat = $wr->view;

  my $busy_seconds = $wr_stat->{building}{work}{seconds_remaining};
  if ($busy_seconds) {
    output("Still busy for $busy_seconds, waiting");
    return $busy_seconds+3;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.525 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )