This is a client implementation and set of scripts for automating portions of playing Lacuna Expanse
Perl
Switch branches/tags
Nothing to show
Pull request Compare This branch is 284 commits behind popiel:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cache
.gitignore
Client.pm
Planet_Name.queue.template
README
Tools.pm
activities
archaeologist
build_queue
call
config.json.template
cron_target.template
exchange
get_buildable_info
get_json
get_planetary_state
glyphinator.pl
haste
park_ranger
project.pl
repairman
scowler
show_planet
star_db_util.pl
trade_push
trashman
upgrade_building

README

This is a simple client implementation for Lacuna Expanse (https://lacunaexpanse.com/),
with some ability to automate building on your planets.

This client is not as complete as Games::Lacuna::Client,
but it does make reasonable attempts to handle cache invalidation properly.

The main scripts of interest are:

activities
  Give a brief overview of what each planet is working on,
  both in the build queue and in the individual work queues.

show_planet [--body Name]
  Give a text representation of the status of one of your planets.

build_queue [--body Name] [--queue Name]
  Try to build / upgrade something on one of your planets,
  based on a queue of desired builds.
  This is intended to be run from cron, once per minute, for each planet.
  It doesn't do any real locking, though, and it outputs to stdout and stderr,
  so you probably want to put it in a wrapper script.
  Look at the sample build queue template for an idea of how to format the build queue.

  Commands:
  build [<x> <y>] <building name>
    Build a new building.
    The coordinate of where to place it on the map is optional;
    if the specified space is already taken (or no space is given),
    then the building will be placed randomly outside the central
    square -1 <= x <= 1, -1 <= y <= 1.

  upgrade <level> <building name>
    Upgrade a building of a particular level.
    If level is given as 0, then any level will match.
    If multiple buildings match, then one is chosen arbitrarily.

  wait <timestamp>
    Wait until a particular time.

  resources <options>
    Upgrade resources, picking whichever resource (food, ore, water, energy)
    is most needed, and upgrading the building with the greatest payoff in
    resource/time investment.  If storage space is running low, then it will
    upgrade storage, too.
    Options are a comma separated list of:
      max level <level>       : don't upgrade beyond given level
      <count>x<building name> : maximum number of building type that should be maintained
      storage only            : only upgrade storage buildings
      production bias <hours> : amount of time to consider for secondary production impacts

    Building priority is actually equalizing storage building levels, then
    upgrading storage if within 95% of capacity, then upgrading resource
    production.

    Note that the resources command will only upgrade buildings; it will not
    build new ones.

  Additional options:
  Prefix a queue entry with ! to make it non-skippable.
  Prefix a queue entry with - to make emit less noise to the logs.
  Prefix a build or upgrade entry with + or ++ to requeue another upgrade for
    the same building at the tail or head of the queue.

park_ranger [--body Name]
  Try to throw parties in all parks on the planet.
  This is intended to be run from cron, once per minute,
  for each planet where you want continuous parties.

trashman [--body Name]
  Recycle some waste if capacity > half full.
  Distributes the waste proportionally to space available in ore, water, and energy.
  This will recycle waste in chunks of about 10 minutes duration.

scowler [--body Name]
  Shoot some waste into the local star if capacity > 3/4 full.

repairman [--body Name]
  Repair any damaged buildings.

archaeologist [--body Name] --ore type
  Search for a glyph in a bunch of ore.

trade_push --body Name --target Name --ship Name --cargo 'stuff' [--stay]
  Push some resources between two planets.
  The cargo is specified either as a single resource name
  (in which case the ship will be fully filled),
  or as a json hash of resource : quantity mappings.

exchange --body Colony --body Supplier [--ship NamePattern] [--equalize]
  Supply the Colony with as close to equal amounts of each food and ore
  as possible, keep it supplied with water and energy, and also cart away
  excess waste.  You must have ships parked at each planet, named to match
  the NamePattern (which defaults to the space-separated --body arguments).

  If the --equalize argument is given, then resources are split evenly
  between the two planets, treating them as peers.

call api method args
  Call an arbitrary api method.  A valid session_id will be inserted
  as the first argument automatically; this will not work for methods
  that do not accept the session_id (e.g. many empire creation methods).

cron_target.template
  Sample wrapper script for build_queue, park_ranger, repairman, and trashman.

project.pl [--body Name]
  Try to predict resource levels and completion times for a sequence of builds.
  Only supports buildings you already have at least one copy of on the planet,
  due to limitations of the API.

get_json [element/path [file ...]]
  This pretty-prints json, optionally selecting just a portion of the input
  (picking hash elements per the supplied path).
  Input is from stdin, or files named after the element path.