# Nightmist Legacy Client 0.4.8

Native Linux desktop client and Android APK for Nightmist Legacy. Both use the same Java gameplay engine, the game's HTTPS login/character APIs, and its authenticated WebSocket command connection. No browser or simulated input is used.

## Start

Linux: extract the complete archive, then run `./Nightmist.sh`. The archive includes its Java runtime. Android: install the signed APK (Android 8.0 or newer), then open Nightmist Client. Enable installation from your download application if Android requests it.

Sign in, select your character, and connect. Enable **Remember login on this device** before signing in to save a successful login and restore the fields next time. **Forget login** removes it; unchecking Remember login also removes the saved entry. Saving does not sign in, connect, or start automation automatically. Press **Adventure & Explore** to start continuous exploration with combat skills, loot, equipment upgrades, training and nearby quest interactions, or configure the gameplay tabs and press Start. Adventure permits PvP-marked rooms (never player targets), uses named target filters and HP-based monster limits (plus level limits where the server provides a monster level), and enables tavern healing at 100 carried gold per rest. Your named target/item filters and healing commands remain in effect. Adventure also enables Auto equipment, Auto train and self-healing skills. If you have no weapon, it can buy one suitable weapon from a discovered starter shop for at most 100 gold; when needed it withdraws only the exact shortfall from the bank. It will not buy armour or replace a weapon automatically. It preserves your stat plan (Class primary by default; choose Save points to keep earned points unspent). Automatic features still require Start or Adventure: automation always starts OFF, including after restarting the application. Linux Stop/F8 and Android Stop stop new automated commands; combat already engaged on the server can continue. Manual commands pause automation. Disconnect closes the game connection.

## Options

- **Combat:** valid, priority, and avoid monster names/template IDs; optional HP and level limits; passive-creature preference; melee with automatic selection of known single-target combat skills, or a preferred skill / ordered list. Unaffordable or unavailable skills fall back to melee; they do not leave the bot waiting indefinitely for mana. Each swing needs its own command. The bot sends another swing after its interval and a server combat result, then waits when stamina is exhausted. It no longer waits indefinitely just because a monster is engaged. The default relative HP limit is eight times your maximum HP; level 1 and 2 characters also get a 40 / 80 HP safety cap when no absolute cap is configured and the relative limit is enabled. These are selection rules, not a guarantee that a creature is easy to defeat. Monster levels are checked only if the server supplies them. Missing equipment is reported after connecting. NPCs, players, and player-owned familiars are excluded. Offensive casts keep your configured mana reserve. Smite and Berserk are checked against their 10/25 HP costs and must leave you above the recovery threshold; stamina-draining attacks require a full bar. HP-cost attacks are skipped against passive creatures, so a new Berserker does not spend health farming harmless Deer. Rage, Morph, Covert, area attacks and unknown support/toggle skills are excluded from automatic offensive selection. Fighters without an eligible offensive skill use melee. Only skills already returned by your character’s ability/spell API are used; this release does not buy or learn spells automatically.
- **Equipment:** inspect carried and worn equipment through the server’s `/lookat` response, then compare weapons, body armour, helmets, shields, amulets, boots, gloves, bracers, rings and bracelets. Choose Class balanced, Damage, Survival or Caster scoring. The score weights damage, armour and stat bonuses, with weights for magical damage, vampirism and mana leech; it is a configurable heuristic, not a guarantee of the best item against every enemy. Class and level requirements are checked. Ties keep existing gear. Rings/bracelets must beat every currently worn accessory in the group because the equip API chooses the slot. A protected accessory prevents automatic changes to its group; Founders Ring and Pioneer's Ring are protected by default. Satchels and unsupported slots stay manual. Unknown stats are skipped. Changes use the official equipment API and are counted only after fresh server equipment/inventory reads. Failed inspections/equips back off for five minutes. Outside Adventure, gear is never bought automatically. Adventure equips carried upgrades first, sells eligible carried loot to fund purchases, then searches discovered shops for verified weapon or armour upgrades within the configurable 250 gold per-item cap, using carried gold only. Pet and floral shops are excluded from gear shopping. A missing weapon uses a separate 100 gold cap and exact bank shortfall rule. No gear is sold or discarded.
- **Progression:** when sufficient XP is available, clear the room, collect allowed loot, and seek the Training Arena below level 3 or the character’s class guild thereafter. Both “Training Area” and “Training Arena” identify the beginner trainer. Routes use discovered connections and visible trainer exits. Explore mode searches further when no trainer route is known. After training, refresh skills/equipment and return to the adventure on a known route when possible. Level gains and stat changes require server character-state confirmation. Class primary prioritizes STR for Fighter/Berserker, DEX for Ranger/Thief, INT then WIS for Mage, and WIS for Cleric/Druid/Paladin, then defensive stats up to racial caps. Specific-stat plans and Save points are available. Automatic point spending requires Auto train. The current level, XP remaining, unspent points, skill casts and equipment changes are visible in both clients.
- **Loot:** collect ground items, optionally restrict to selected item names, and reject named items. Rejects win; an empty selected list collects nothing when Only selected is on. Adventure checks all currently carried items, including items that were already in the bag at login, and sells one eligible item at a time only when a discovered shop's live stock quotes a buyback price. Rooms advertising `/buy`, `/sell`, or `/trade` are saved as seller locations; Market Square exits are recognized. Rabbit Fur, Rabbit Meat, and Deer Meat are prioritized for sale, while explicitly flagged quest items, equipment, bags, keys, and ordinary consumables remain protected. An item a shop does not buy stays in the bag while the client searches another known shop or continues exploring. The activity log records confirmed sales, unreachable buyers, unavailable quotes, and a short inventory/reason summary when no named sale candidate is found.
- **Quests:** inspect friendly static/service NPCs with `/lookat`, follow quest IDs returned by the server, talk to marked quest NPCs, accept available quests, and turn in ready quests. Optional quest name/ID filters. Use Combat and Loot for ordinary kill/collect objectives and Travel routes for the required locations. This release does not infer complete story walkthroughs, quest destinations, cutscene completion, puzzles, or special item-use requirements. Those remain manual.
- **Travel:** stay in the current room, follow directions, explore, or travel to a discovered room via confirmed connections. Under Explore, choose **Level & gear**, **Quest & hunt**, **Find quests**, **Find monsters**, or **Explore everything**. Adventure starts with Level & gear: it prioritizes known safe hunting locations and waits briefly for respawns before continuing, while a visible beginner trainer is preferred when a level-up is ready. Quest and hunting modes rank useful locations across the reachable discovered graph before ordinary side streets. Editable name clues are hints, not proof of quests/monsters. Below level 3, visible Training Area/Arena exits take priority for beginner hunting. Excluded hostile encounters are left rather than fighting a small creature alongside much stronger enemies. Dangerous rooms are avoided for 15 minutes, and a room where death is reported is avoided for 30 minutes. This reduces repeat routes into known danger; it does not guarantee survival in an unexplored room. The bot remembers encountered NPC types, quest locations and creature templates, and avoids immediately revisiting a checked site. The current goal, NPC/creature counts, eligible targets and confirmed combat actions appear above the map; the log explains skipped targets.
- **Rejected movement:** any notice saying an entrance is restricted, access is denied, entry is forbidden, or an entry requirement is unmet triggers an alternate route. Class-guild refusals are remembered by class across restarts. Other access denials and locked entrances (including messages such as “The way north is locked. You need … to pass.”) avoid the exit for 30 minutes in the current session. The required item name is not hardcoded. Unresponsive exits are avoided for a minute. The job stays running. With no available alternative, it waits and retries after temporary blocks expire.
- **Unconfirmed movement:** after eight seconds the bot requests `/look`; if movement still lacks confirmation four seconds later, it attempts a different exit without stopping the job. The failed movement adds no step, route progress or connection. When its position is uncertain, the subsequent room update resynchronizes position without inventing a connection for that uncertain move. Fixed direction routes may no longer describe the location after a detour; review the route if you need a precise scripted trip. A limit of 0 permits unlimited normal travel; Adventure uses 0. No reverse connection is assumed until traversed.

- **Recovery:** exhausted movement pauses gameplay commands, keeps the connection heartbeat alive, and retries the same exit after the server reports stamina recovery. The wait interval and hunting respawn pause are configurable. Shared low-HP pause/resume thresholds; optional travel to a saved healing room along learned connections; optional healing command; return to the original room after recovery when a route is known. The bot uses confirmed outward routes; if a return route is unavailable, it stays active and resumes the configured travel from the current room. Optional automatic tavern recovery finds a reachable discovered tavern or pub and uses `/rest` when you have at least 100 carried gold. It also rests before leaving a discovered tavern if HP is below the resume threshold. With no available healing method, it waits for HP recovery without stopping; an unconfirmed heal/rest command is retried after a delay. Once HP reaches the resume threshold, combat and travel resume automatically. Exploration resumes encounters from the current recovered room instead of walking past suitable targets to finish an old return trip. Known single-target healing skills can be used on yourself during recovery, before paid rest. Optional low-mana recovery seeks a reachable tavern only when at least 100 gold is available; without that option/resources, melee remains available. On a server death notice, cancel recovery/training trips, wait for respawn room state, then resume from the tavern. No death teleport is recorded as a walked connection. When no healing route exists, attempt to get clear of creatures before waiting for recovery. `/rest` is a paid tavern action, not a universal heal. Food/drink options use matching items from inventory.
- **Settings:** command pacing, optional reconnect using the in-memory session, optional job resume after fresh state, PvP-room pause, daily reward claim, game protocol version. Reconnect and resume default OFF. Expired sessions require signing in again.

Apply settings pauses automation. Start applies and saves the current settings. Profiles contain gameplay settings only, never account credentials. Linux profiles live in `~/.config/luls-nightmist/profile.json`. Android saves them in private app preferences; Settings also imports/exports JSON profiles through the Android file picker.

Android background automation uses a foreground service, a visible notification with Stop, and a partial wake lock while enabled. Stop or Disconnect releases the wake lock. Device battery management can still interrupt connectivity. This is a sideloaded APK, not a Play Store release.

## Map

Both clients have a native map tab: your current room is blue, taverns are gold, arrows show observed one-way connections, red × stubs mark restricted exits for the current class, and dashed stubs are unexplored exits. The layout is a connection diagram, not a geographic survey. Drag to pan, zoom with the mouse wheel on Linux or pinch on Android, and use Center to follow your character again. Select a discovered room and choose Travel to selected room to navigate using confirmed connections. A destination without a known route requires further exploration.

The local map saves room names/IDs, zone/type, PvP flags, visits, coordinates, exits and class restrictions, temporary dangerous-room expiry times, plus encountered NPC names/types, quest-site flags and monster names/template IDs/HP limits for destination planning. Individual live mob slot IDs, player names, ground loot, credentials and chat are excluded. Linux map: `~/.config/luls-nightmist/world-map.json`. Android map: private app storage.

## Privacy

Passwords stay in process memory unless you enable Remember login. Linux stores the username/password entry in your desktop Secret Service keyring through `secret-tool` (libsecret); a persistent, unlocked system keyring is required for saving. On Fedora, the helper is provided by `libsecret`; on Debian/Ubuntu, by `libsecret-tools`. If secure storage is unavailable, login still works but credentials are not saved. There is no plaintext fallback. Android encrypts the entry with AES-GCM using a device/app key in Android Keystore, and stores only ciphertext in private preferences. Login tokens and session cookies remain in memory. Credentials are excluded from gameplay profiles, logs and download packages. Live account state and log history are not included in releases. Android backup is disabled. API and WebSocket traffic use TLS with standard certificate verification. The Linux and Android signing/build tools and private signing key are excluded from public downloads.

## Changes in 0.4.8

- Seller discovery now records any room whose server text advertises `/buy`, `/sell`, or `/trade`, and Market Square is a recognized sale destination even when the exit name does not include “shop”.
- Adventure prioritizes Rabbit Fur, Rabbit Meat, and Deer Meat for sale, even when generic quest text or a food classification previously hid them; items explicitly flagged as quest items remain protected.
- The activity log names the prioritized inventory item and reports when a seller room is found, so a missed sale is easier to diagnose.

## Changes in 0.4.7

- Fixed a shop-routing loop where repeated Market Square rooms were mistaken for equipment stores, pulling Adventure off the official yellow route. Market Square remains available for selling when it quotes a buyback price.
- Gear-shop trips now wait until the character has carried gold to spend; selling eligible inventory still runs first and can fund the next gear search.

## Changes in 0.4.6

- Fixed an Adventure loop that repeatedly routed an unarmed character from Grassy Meadow into Eiriol’s Pet Store as if it sold weapons. Starter-weapon searches now require a known weapon/armour shop and remember shops with no suitable stock.
- Adventure now equips carried upgrades first, sells eligible inventory for gold, checks discovered equipment shops, then handles starter weapons, training and quests. Pet and floral shops are skipped during equipment-shop searches.
- When inventory has no sellable named item, the activity log reports a short item/reason summary instead of silently skipping sales. Quest protection now matches item names as whole phrases rather than accidental substrings.

## Changes in 0.4.5

- Shop sales now consider eligible items already carried at login as well as newly collected drops; current server buyback quotes and inventory changes confirm each sale.
- Adventure checks discovered shop stock for verified weapon and armour upgrades, respects class/level requirements and protected gear, and uses carried gold only within the per-item cap.
- Shop stock parsing handles array and object responses, optional item-currency fields and common armour type spellings. Unconfirmed purchases are not blindly retried and return to exploration after a cooldown.

## Changes in 0.4.4

- Adventure follows the official server Wayfinder trail when one is active, resolving its next room from the official minimap grid if the local map has not learned that connection yet.
- The Linux and Android discovered-room maps draw the known portion of the active Wayfinder trail in yellow.
- Restricted, blocked, PvP-disallowed, or unavailable trail steps fall back to the existing travel planner; server room updates still confirm movement.
- Low-HP recovery waits and retries unconfirmed heal/rest commands without stopping automation, then resumes automatically at the configured HP threshold. If a return route is unknown, configured travel continues from the current room.

## Changes in 0.4.2

- Adventure sells confirmed ground drops for gold by routing to discovered shops and using their current server buyback quote.
- Only drops picked up by this client during the current connection are eligible; any item type present in the initial inventory, active quest items, equipment, bags, food, drinks, potions and scrolls are protected. Items a shop will not buy remain carried while exploration continues.
- Logs confirmed sales and explains when an item type is kept for safety.

## Changes in 0.4.1

- Exhaustion now pauses movement and other gameplay commands, then retries the same exit after a fresh positive stamina update.
- Adventure prioritizes safe hunting and brief respawn waits; it also prefers the beginner trainer when training becomes available.
- Recognizes the actual “Training Area” name, so a level-ready character can train there.
- Adventure can obtain one missing starter weapon from current shop stock for up to 100 gold, including an exact bank withdrawal shortfall.
- Adds conservative monster HP caps for level 1 and level 2 characters.
- Reports current XP and remaining XP to the next level in the log.

## Changes in 0.4.0

- Automatic equipment inspection, scoring and confirmed upgrades, with protected items and native Equipment controls.
- XP-aware training trips, class-based or custom stat priorities, and native Progression controls/status.
- Resource-aware single-target combat skills, self-healing skills, melee fallback and optional low-mana tavern recovery.
- Beginner hunting priorities, temporary avoidance of dangerous rooms, and recovery/respawn fixes for the supplied Deer/Magimox log.
- Retains saved login, learned maps and locked-exit rerouting from 0.3.1.

## Build

Requires Python 3, JDK 17+, Android SDK platform 35 and build-tools 35.0.0. Run:

```sh
python3 tools/build.py --jdk /path/to/jdk --sdk /path/to/android-sdk
```

Dependencies are downloaded into the FILES Downloads directory and copied into ignored `deps/`. Desktop packaging uses `jlink` to bundle a Linux x86-64 runtime. Android uses the platform framework UI and OkHttp for HTTPS/WebSockets. The same `core/` classes are compiled into both clients. The build creates and retains a private per-project APK signing key under ignored `.signing/`; keep it for future updates.

## Verification

The 0.4.8 Linux and Android builds compile. APK signature and alignment checks pass. No automated gameplay, shop purchase/sale, account mutation, device, or interface tests were run; compilation does not establish end-to-end behavior.

Game references: [getting started and training](https://nightmistlegacy.com/guides/getting-started), [class builds](https://nightmistlegacy.com/guides/classes), [spells and abilities](https://nightmistlegacy.com/abilities).

Observed game protocol: official web client 0.9.33. Profiles using the prior 0.9.30–0.9.32 value migrate to 0.9.33. Server/API changes may require an update.

## Third-party components

OkHttp 4.12.0 (Apache 2.0), Okio 3.6.0 (Apache 2.0), Kotlin standard library 1.9.10 (Apache 2.0), JetBrains annotations 13.0 (Apache 2.0), JSON-java 20240303 (public domain), and the bundled OpenJDK runtime. License notices are included with the Linux bundle and within APK assets.
