# Aeshnidae.Codex

A book in every pack - *Aeshnidae Codex* - whose pages are the server's readouts,
rewritten each time it is opened. Works in every client, because it is an ordinary
book (retail's blank fifty-page "Book", wcid 364): the client already knows how to
open, page and render it. `/codex` opens it; so does using it from the pack.

```
/codex                 open it
/codex <section>       open it at that section, e.g. /codex bank
/codex sections        which sections currently answer
/codex-reload          admin: re-read Settings.json
```

## Why a book

`ops/research-player-gui.md` (2026-09-11): the stock client opens its book window on
one server message, carrying arbitrary multi-page text, with no dat change and no
plugin. The HUD (`Aeshnidae.Hud`) does more, but only for OpenAC; this is the version
everybody gets.

Two ways in. Using the book from the pack is the retail path and needs no assumption.
`/codex` asks ACE to send the same book again (`Player.ReadBook`), which the research
expects to open the window too - the one thing here not yet seen in a client. If it
does not, the command still rebuilds the pages and the book in the pack is the door.

## Sections

The pages come from the other mods. Each one that has something to show carries, in
its root namespace:

```csharp
public static class CodexPage
{
    public static string Title => "Bank";
    public static string[] Pages(Player player);   // one string per page, plain text
}
```

This mod finds them by reflection through the mod host, in `Settings.Sections` order,
and calls them - reflection because mods cannot share a type across their load
contexts, but `Player` and `string` are ACE's. A mod that is off, throws, or has no
`CodexPage` contributes nothing; the book is never held up by one section. Page one is
always the contents, with the page number of each section.

Writing a page: plain text, under a thousand characters, ragged - the book font is
proportional, so columns padded with spaces do not line up. `Label: value` lines and
blank-line grouping read well; right-aligned numbers do not.

## The object

Made at login if the character has none, or by `/codex`. Attuned, bonded, retained: it
cannot be dropped, traded, sold or lost on death. Its pages are authored by a server id
that is nobody's, with `IgnoreAuthor` false, so the client's writable-book editing is
refused for players (staff can scribble; the next opening erases it). Recognised by
weenie and name, so renaming it in settings orphans the old ones - they become plain
books, and everyone gets a new one.

| File | |
| --- | --- |
| `Codex.cs` | Find or make the book; rebuild its pages; open it. |
| `Providers.cs` | The reflection over the other mods' `CodexPage`. |
| `Patches.cs` | Grant at login; rebuild when the book is used from the pack. |
| `Commands.cs` | `/codex`. |
| `Settings.cs` | Weenie, name, page size, section order. |
