Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
This is a client implementation and set of scripts for automating portions of playing Lacuna Expanse
Perl
tree: cc8f71512e

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Client
Tie
cache
t
.gitignore
Client.pm
Planet_Name.queue.template
README
Tools.pm
activities.pl
archaeologist.pl
autovote.pl
balance_resources.pl
build_queue.pl
call.pl
config.json.template
count_rpc.sh
count_where.sh
cron_target.template
digger.pl
entertainment.pl
evacuate.pl
exchange.pl
explorer.pl
get_buildable_info.pl
get_buildings.pl
get_json.pl
get_planetary_state.pl
get_plans.pl
get_ships.pl
glyphinator.pl
groupmind.pl
haste.pl
invalidate.pl
mailman.pl
make_glyph_building.pl
make_halls.pl
park_ranger.pl
post_newbie_pack.pl
present_captcha.sh
project.pl
repairman.pl
restocker.pl
scowler.pl
show_foods.pl
show_glyphs.pl
show_happy.pl
show_planet.pl
show_plans.pl
spacemaker.pl
sspush.pl
star_db_util.pl
trade_push.pl
trans_push.pl
trashman.pl
upgrade_building.pl
wrap.sh

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
      ignore <types>          : don't upgrade storage or production for some resource types
      focus <stored|hour>     : prioritize based on stored resources or hourly production (default is stored)

    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] [--db file]
  Maintain excavators.  Requires a sqlite db of stars and bodies, created
  by star_db_util.  It has a bunch of other options, too; read the source.

trade_push --body Name --target Name --ship Name --cargo 'stuff' [--stay]
  Push some resources between two planets.
  The cargo may be specified as:
    "all" => all available resources are shipped (leaving 100 of each type)
    a single resource name => max amount of that resource is shipped
    a json hash of resource : quantity mappings => exact cargo shipped

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.

haste [options]
  This script attempts to maintain waste levels within your specified parameters,
  sustaining a minimum amount of waste for your waste consuming planets and
  keeping waste below a maximum percentage of your storage. It adapts to the
  capacity and production levels for each planet.

  For more information, try running:
  > haste --help
Something went wrong with that request. Please try again.