Games-Lacuna-Task

 view release on metacpan or  search on metacpan

lib/Games/Lacuna/Task/Action/Archaeology.pm  view on Meta::CPAN

    my $total_glyphs = sum(values %{$all_glyphs});
    my $max_glyphs = max(values %{$all_glyphs});
    my $timestamp = time();
    
    # Get archaeology ministry
    my $archaeology_ministry = $self->find_building($planet_stats->{id},'Archaeology');
    
    return
        unless defined $archaeology_ministry;
    
    # Check archaeology is busy
    if (defined $archaeology_ministry->{work}) {
        my $work_end = parse_date($archaeology_ministry->{work}{end});
        if ($work_end > $timestamp) {
            return;
        }
    }
    
    my $archaeology_ministry_object = $self->build_object($archaeology_ministry);
    
    # Get searchable ores

lib/Games/Lacuna/Task/Action/StationPlanBuilder.pm  view on Meta::CPAN

    my $timestamp = time();
    
    # Get space station lab
    my $spacestaion_lab = $self->find_building($planet_home->{id},'SSLA');
    return $self->log('error','Could not find space station labs')
        unless $spacestaion_lab;

    if (defined $spacestaion_lab->{work}) {
        my $work_end = parse_date($spacestaion_lab->{work}{end});
        if ($work_end > $timestamp) {
            return $self->log('info','Space station lab is busy until %s',format_date($work_end))
        }
    }

    my $spacestaion_lab_object = $self->build_object($spacestaion_lab);
    
    # Get plans on planet
    my $planet_plans = $self->get_plans_stored($planet_home->{id});
    
    # Get plans on space station
    my ($space_station,$space_station_plans,$space_station_modules);

lib/Games/Lacuna/Task/Action/StationPlanBuilder.pm  view on Meta::CPAN

    my $total_plans = _merge_plan_hash($planet_plans,$space_station_plans,$space_station_modules);
    
    # Get space station lab details
    my $spacestaion_lab_data = $self->request(
        object  => $spacestaion_lab_object,
        method  => 'view',
    );
    
    if (defined $spacestaion_lab_data->{building}{work}) {
        my $work_end = parse_date($spacestaion_lab->{building}{work}{end});
        return $self->log('info','Space station lab is busy until %s %s',format_date($work_end))
    }
    
    # Get max level
    my $max_level = min(
        $spacestaion_lab_data->{building}{level},
        max(map { keys %{$_} } values %{$total_plans}) + 1
    );
    
    PLAN_LEVEL:
    foreach my $level (1..$max_level) {

lib/Games/Lacuna/Task/Action/WasteRecycle.pm  view on Meta::CPAN

    foreach my $resource (@RESOURCES_RECYCLEABLE) {
        $resources{$resource}[2] = ($resources{$resource}[1] / $total_resources_coeficient);
    }
    
    # Loop all recycling buildings
    foreach my $recycling_building (@recycling_buildings) {
        
        last
            if $waste_disposeable <= 0;
        
        # Check recycling is busy
        if (defined $recycling_building->{work}) {
            my $work_end = parse_date($recycling_building->{work}{end});
            if ($work_end > $timestamp) {
                next;
            }
        }
        
        my $recycling_object = $self->build_object($recycling_building);
        my $recycling_data = $self->request(
            object  => $recycling_object,



( run in 0.284 second using v1.01-cache-2.11-cpan-87723dcf8b7 )