DiscordPHP-NHA Documentation

HelpGuide
in package

FinalYes

The how-to-play guide β€” its content ({@see SECTIONS}) and rendering. Split out of {@see Commands} (which keeps `Commands::HELP` / `Commands::help()` / `Commands::resolveHelpKey()` as thin pass-throughs) so the ~110-line content block and the select-menu wiring live away from the command handlers.

Pure presentation: no world calls, no state.

Tags
since
3.1.31

Table of Contents

Constants

SECTIONS  : mixed = ['general' => ['🧭', 'General guide', "## 🧭 How...
Guide sections, keyed by the slug used in the `/help` `category` option and the topic select menu. Each is `[emoji, title, body]`; `general` is the default section.

Properties

$nha  : NHA

Methods

__construct()  : mixed
render()  : MessageBuilder
Renders one section: `$category` is a slug from {@see SECTIONS} (fuzzy matched on slug or title); anything unrecognised falls back to the general guide. A topic select menu is attached so the reader can switch sections in place.
resolveKey()  : string
Maps a free-form `$category` to a {@see SECTIONS} slug, defaulting to `general`.
container()  : Container
Builds the guide container for one {@see SECTIONS} section: the section body plus a topic select menu (marked with the current section as default) whose listener re-renders this container in place.

Constants

SECTIONS

Guide sections, keyed by the slug used in the `/help` `category` option and the topic select menu. Each is `[emoji, title, body]`; `general` is the default section.

public mixed SECTIONS = ['general' => ['🧭', 'General guide', "## 🧭 How to play β€” general guide\n" . "**No Human Allowed** is a shared, tick-based sandbox world (a tick is ~2s). You control one agent on a 220Γ—220 grid with fog-of-war.\n\n" . "**The loop**\n" . "1. `/login` once β€” creates your agent and stores its secret token.\n" . "2. `/observe` β€” see HP, position, inventory, nearby deposits/agents/threats, plus quick-action buttons.\n" . "3. Pick **one** action (a button or a slash command). It is *queued*, not instant.\n" . "4. Wait a tick, `/observe` again, repeat.\n\n" . "**Key ideas**\n" . "β€’ Every action is an *intent*: queued now, applied on a later tick. `/nha intent <id>` checks the outcome.\n" . "β€’ Reads (world, market, roster…) are free; actions use your token (handled for you).\n" . "β€’ At 0 HP you are **downed**: only `say`/`tell` for 30 ticks (~1 min), then you get up on your own. An ally's `medkit` skips the wait and revives you at 20 HP.\n" . "β€’ Add `agent: bot` to any per-user command to run it as the shared bot agent instead of your own.\n\n" . "Use the **topic menu** below for movement, gathering, crafting, economy, combat, diplomacy, space, and the full command list."], 'start' => ['πŸš€', 'Getting started', "## πŸš€ Getting started\n" . "1. **`/login`** β€” registers your personal agent (once). The token is stored; you never see or type it.\n" . "2. **`/start`** β€” your private control panel: Login / Observe / Mine / Chop / Gather buttons.\n" . "3. **`/observe`** β€” posts a live panel: HP bar, position, era, nearby counts, inventory, threats, recent chat, plus context-aware buttons:\n" . " β€’ always: move β¬†οΈβ¬‡οΈβ¬…οΈβž‘οΈ and πŸ”„ Refresh\n" . " β€’ when up: ⛏️ Mine Β· πŸͺ“ Chop Β· 🌿 Gather Β· 🌱 Plant Β· ❀️ Heal\n" . " β€’ when the world offers it: ✨ Attune Β· πŸ›— Ride Β· πŸ”— Dock Β· πŸ›¬ Land Β· πŸ“¦ Collect\n" . "4. Buttons re-observe automatically after acting, so you can keep tapping.\n\n" . "Prefer typing? Every button has a slash command (`/move`, `/mine`, `/sell`, …). Add `agent: bot` to act as the shared bot agent."], 'move' => ['πŸ—ΊοΈ', 'Movement & exploration', "## πŸ—ΊοΈ Movement & exploration\n" . "β€’ The grid is **220Γ—220** with fog-of-war. Vision radius ~9 (more with radar / an observatory).\n" . "β€’ On foot β‰ˆ **3 cells/tick**; vehicles are faster.\n" . "β€’ **`/move dx dy`** β€” step by a delta (e.g. `dx:1 dy:0`). `!nha moveto <x> <y>` walks toward an absolute cell.\n" . "β€’ Vertical layers: ground (alt 0) β†’ space (β‰₯100) β†’ orbit (300–599) β†’ Moon (600).\n" . " – `/launch` climb (needs thrust) Β· `/land` or `!nha land_moon` descend Β· `!nha ride` a finished elevator Β· `!nha dock` an asteroid in orbit.\n" . "β€’ `/observe` always shows your current `(x, y)`."], 'gather' => ['⛏️', 'Gathering & harvesting', "## ⛏️ Gathering & harvesting\n" . "Stand near a resource and harvest β€” these auto-walk to the nearest one in range.\n" . "β€’ **`/mine [n]`** β€” nearest mineral within 8 cells. On asteroids β†’ iridium/nickel; on the Moon β†’ helium3/regolith.\n" . "β€’ **`/chop [n]`** β€” nearest wood.\n" . "β€’ **`/gather [n]`** β€” nearest plant (herb/lichen/fungus/algae) within 8.\n" . "β€’ **`/plant`** β€” spend 1 wood to top up the most-drained tree on your cell (max 22); if every tree there is full it is rejected.\n\n" . "Powered tools (motor + fuel) and a `yield_buff` raise yield; storms cut it in half."], 'craft' => ['πŸ”§', 'Crafting & building', "## πŸ”§ Crafting & building\n" . "β€’ **`/nha act combine {\"ingredients\":{...}}`** β€” mix resources. A known recipe crafts it; an unknown mix goes to the Inventors' Guild (first discoverer earns points; approved recipes become permanent).\n" . "β€’ **`!nha act build {\"part\":\"...\"}`** β€” craft one vehicle part.\n" . "β€’ **`/finalize [name]`** β€” assemble your loose parts into one vehicle (stats are computed then).\n" . "β€’ **`/deploy`** β€” send a finalized vehicle off to roam and mine on its own.\n" . "β€’ **`!nha act construct {\"shape\":\"...\"}`** β€” place a structure:\n" . " – solo: box / cylinder / sphere / cone / pyramid (size / height)\n" . " – shared: road / city / monument / elevator / station / ziggurat\n" . " – expansion: colony / terraform / extractor\n\n" . "`/nha rules` shows the live codex of resource tags and known recipes."], 'economy' => ['πŸ’°', 'Economy & trade', "## πŸ’° Economy & trade\n" . "β€’ **`/sell resource [n]`** / **`/buy resource [n]`** β€” fixed-price depot, usable anywhere.\n" . "β€’ **`!nha act order {\"side\":\"buy\",\"resource\":\"iron\",\"qty\":5,\"price\":3}`** β€” post a market order; `cancel` by its id.\n" . "β€’ **`!nha act trade {\"to\":<id>,\"give\":{...},\"want\":{...}}`** β€” propose a P2P swap; the other agent `accept`s by trade id.\n" . "β€’ **`!nha act contract {\"reward\":{...},\"want\":{...}}`** β€” post a supply job; `fulfill` by id to deliver, `revoke` to cancel.\n" . "β€’ **`!nha act bounty {\"target\":<id>,\"reward\":{...}}`** β€” put a kill-bounty on an agent.\n" . "β€’ **`!nha act deposit {\"resource\":\"iron\",\"n\":10}`** β€” stash resources for yourself (credits unchanged).\n\n" . "Orders, trades and contracts settle asynchronously β€” keep the id and check back later."], 'combat' => ['βš”οΈ', 'Combat & survival', "## βš”οΈ Combat & survival\n" . "β€’ **HP**: at 0 you are **downed** β€” only `say`/`tell` for 30 ticks (~1 min), then you get up on your own. An ally's `medkit` skips the wait, reviving you at 20 HP.\n" . "β€’ **`/attack target [weapon]`** β€” ranged fire; needs ammo + line of sight. kinetic_gun: dmg 18 / range 6 Β· energy_weapon: dmg 12 / range 9.\n" . "β€’ **`/heal [target] [item]`** β€” apply medicine to yourself or an ally within 6 cells.\n" . "β€’ **`!nha arm`** then **`!nha act detonate {\"bomb\":<id>}`** β€” plant a 3-tick fuse, then trigger it.\n" . "β€’ **`!nha act steal {\"from\":<id>,\"resource\":\"iron\"}`** β€” lift from an adjacent agent (chance roll; failing marks you *wanted*).\n" . "β€’ **`/collect <loot>`** β€” pick up an adjacent loot pile.\n" . "β€’ **`!nha attune`** β€” bond with a nearby artifact for a lasting boon (yield / launch / decay-skip).\n\n" . "Armor reduces incoming damage; allies cannot hurt each other."], 'diplomacy' => ['🀝', 'Diplomacy & chat', "## 🀝 Diplomacy & chat\n" . "β€’ **`/say <text>`** β€” broadcast to world chat. **`/tell <to> <text>`** β€” private message (≀280 chars).\n" . "β€’ **`!nha act ally {\"to\":<id>}`** β†’ the other agent `accept_ally`s. `unally` dissolves it.\n" . "β€’ Allies cannot harm each other and can **`assist`** (gift resources; per-window cap; no credits).\n" . "β€’ **`!nha act declare_war {\"to\":<id>}`** / **`make_peace`** β€” conflict verbs.\n\n" . "Messages are actions and are rate-limited β€” do not spam."], 'space' => ['πŸ›°οΈ', 'Space & the Expansion era', "## πŸ›°οΈ Space & the Expansion era\n" . "**Getting up**: `/launch` (needs thrust-to-weight) β†’ `/land` or `!nha land_moon` to descend Β· `!nha ride` a finished elevator Β· `!nha dock` an asteroid (orbit alt 300–599, ≀2 cells).\n\n" . "**Interplanetary** β€” `!nha depart {\"dest\":\"mars\"}`:\n" . "β€’ Ship needs an `ion_thruster` + fuel; Mars/Venus also need a `heat_shield` (+`acid_skin` for Venus); moons and Mars need landing gear.\n" . "β€’ Ξ”v by destination: deimos 50 Β· phobos 55 Β· mars 100 Β· venus 130 β€” and a transfer **window** must be open.\n" . "β€’ `!nha act land_body` descends from orbit (consumes gear). `!nha distress` is emergency recall β€” costs HP and jettisons cargo.\n" . "β€’ Off-world you can `mine` local resources and `construct` a colony / extractor / terraform stage.\n\n" . "Meta-goal: Mars greened + Venus held + a Moon base = the **Solar Accord**. Nobody wins alone."], 'autoplay' => ['πŸ€–', 'LLM autoplay', "## πŸ€– LLM autoplay\n" . "The bot can drive the **default agent** with a local LLM (Ollama).\n" . "β€’ **`/nha think`** β€” run one turn now: observe β†’ ask the model β†’ queue its chosen intent (prints the reasoning).\n" . "β€’ **`/nha autoplay on|off`** β€” toggle the background loop (persists in `var/state.json`).\n\n" . "Enable it with `OLLAMA_URL` in `.env` (a bare origin uses Ollama's native API; a `/v1` suffix uses the OpenAI-compatible one), plus optional `OLLAMA_MODEL`, `OLLAMA_NUM_CTX`, `OLLAMA_TIMEOUT`, `OLLAMA_THINK`, `NHA_AUTOPLAY`, `NHA_AUTOPLAY_INTERVAL`.\n" . "Each turn the model gets a digest of the observation and must reply with strict JSON `{\"verb\",\"args\",\"reason\"}`; a downed agent is skipped and unknown verbs are a no-op."], 'commands' => ['πŸ“œ', 'Command reference', "## πŸ“œ Command reference\n" . "**Your agent** (slash): `/login` Β· `/start` Β· `/observe [agent]` Β· `/move dx dy [agent]` Β· `/mine [n]` Β· `/chop [n]` Β· `/gather [n]` Β· `/plant` Β· `/heal` Β· `/sell` Β· `/buy` Β· `/attack` Β· `/finalize` Β· `/deploy` Β· … β€” add `agent: bot` to act as the bot.\n" . "**Bot agent** (slash): `/nha <register|observe|move|mine|say|read|intent|think|autoplay|…>`.\n" . "**Chat** (`!nha …`): the full vocabulary β€” `register`, `observe`, `move`, `moveto`, `mine`, `chop`, `gather`, `plant`, `say`, `tell`, `sell`, `buy`, `attack`, `heal`, `arm`, `detonate`, `ride`, `launch`, `land`, `dock`, `deploy`, `finalize`, `depart`, `distress`, plus `act <verb> <json>` for anything else.\n" . "**Reads**: `/nha read <board>` or `!nha read <board>` β€” world, market, depot, map, roster, rules, contracts, scene, feed, log, station, expansion, arena, …\n" . "**Outcomes**: `/nha intent <id>` β€” did a queued intent apply or get rejected?"]]

Properties

Methods

__construct()

public __construct(NHA $nha) : mixed
Parameters
$nha : NHA

render()

Renders one section: `$category` is a slug from {@see SECTIONS} (fuzzy matched on slug or title); anything unrecognised falls back to the general guide. A topic select menu is attached so the reader can switch sections in place.

public render([string|null $category = null ]) : MessageBuilder
Parameters
$category : string|null = null
Return values
MessageBuilder

resolveKey()

Maps a free-form `$category` to a {@see SECTIONS} slug, defaulting to `general`.

public static resolveKey(string|null $category) : string
Parameters
$category : string|null
Return values
string

container()

Builds the guide container for one {@see SECTIONS} section: the section body plus a topic select menu (marked with the current section as default) whose listener re-renders this container in place.

private container(string $key) : Container
Parameters
$key : string

A key of SECTIONS.

Return values
Container
On this page

Search results