moth

Monarch Of The Hill game server
git clone https://git.woozle.org/neale/moth.git

moth / docs
Neale Pickett  ·  2023-11-21

download-everything.md

 1Download All Unlocked Puzzles
 2========================
 3
 4We get a lot of requests to "download everything" from an event.
 5Here's how you could do that:
 6
 7What You Need
 8------------
 9
10* The URL to your puzzle server. We will call this `$url`.
11* Your Team ID. We will call this `$teamid`.
12* A way to POST `id=$teamid` 
13    with `Content-Type: x-www-form-encoded` to a URL, 
14    and save the result. 
15    We will call this procedure "Fetch".
16* A way to parse JSON files
17
18Steps
19-----
20
211. Fetch `$url/state`. This is the State object.
222. In the State object, `Puzzles` maps category name to a list of open puzzle point values.
233. For each category (we will call this `$category`):
24    1. For each point value:
25        1. If the point value is 0, skip it. 0 indicates all puzzles in this category are unlocked.
26        2. Fetch `$url/content/$category/$points/index.json`. This is the Puzzle object.
27        3. In the Puzzle object, `Body` contains the HTML body of the puzzle.
28        4. In the Puzzle object, `Attachments` contains a list of attachments.
29            For each attachment (we will call this `$attachment`):
30            1. Fetch `$url/content/$category/$points/$attachment`.