lib/lacuna_util/task/make_halls.rb
# Array of the 4 recipes used to make Halls of Vrbansk
Array of the 4 recipes used to make Halls of Vrbansk
Array of the 4 recipes used to make Halls of Vrbansk
def _run(args, config)
        total = 0
        Lacuna::Empire.planets.each do |id, name|
            Logger.log "Checking on #{name}"
            buildings = Lacuna::Body.get_buildings(id)['buildings']
            archaeology = Lacuna::Body.find_building(buildings, 'Archaeology Ministry')
            next if archaeology.nil?
            next unless archaeology['efficiency'].to_i == 100
            inventory = Lacuna::Archaeology.get_inventory(archaeology['id'])
            made = 0
            RECIPES.each do |recipe|
                numbers = recipe.collect { |item| inventory[item] || 0 }
                number = numbers.sort.first
                list = recipe.map { |item| item.capitalize }.join ', '
                next if number ==  0
                Logger.log "Making #{number} halls with #{list}"
                rs = Lacuna::Archaeology.assemble_glyphs(archaeology['id'], recipe, number)
                made += rs['quantity']
            end
            if made > 0
                Logger.log "Made #{made} Halls on #{name}"
                total += made
            end
        end
        if total > 0
            Logger.log "Finished making #{total} Halls of Vrbansk"
        end
    end
def _run ( args , config ) total = 0 Lacuna :: Empire . planets . each do | id , name | Logger . log "Checking on #{name}" buildings = Lacuna :: Body . get_buildings ( id ) [ 'buildings' ] archaeology = Lacuna :: Body . find_building ( buildings , 'Archaeology Ministry' ) next if archaeology . nil? next unless archaeology [ 'efficiency' ] . to_i == 100 inventory = Lacuna :: Archaeology . get_inventory ( archaeology [ 'id' ] ) made = 0 RECIPES . each do | recipe | numbers = recipe . collect { | item | inventory [ item ] || 0 } number = numbers . sort . first list = recipe . map { | item | item . capitalize } . join ', ' next if number == 0 Logger . log "Making #{number} halls with #{list}" rs = Lacuna :: Archaeology . assemble_glyphs ( archaeology [ 'id' ] , recipe , number ) made += rs [ 'quantity' ] end if made > 0 Logger . log "Made #{made} Halls on #{name}" total += made end end if total > 0 Logger . log "Finished making #{total} Halls of Vrbansk" end end
Array of the 4 recipes used to make Halls of Vrbansk
Array of the 4 recipes used to make Halls of Vrbansk
# Note: there is a limit of 5000 plans made per request. #   I'll fix this 'issue' when it actually becomes one. :)
args
config