> ## Documentation Index
> Fetch the complete documentation index at: https://lastwar.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Client 1.0.370

> What the Go client changed to follow Last War 1.0.370 (iOS 918, Android 1911) and tables 40413: login and transport, the Android identity, every feature's gates, 66 new opt-in features, the follow-up on the user's decisions, and what to check on the first runs.

`goclient` follows Last War **1.0.370** (iOS build 918, Android build 1911) and the data tables it bundles, **version 40413**. Live servers were already on tables 40460 when the client was audited, and no dump of 40460 exists. A November 2026 audit compared the client with the decompiled 1.0.370 Lua, C# and Java, and the fixes below came out of it. **All of it is static analysis: none of these changes has been sent to a live server yet.**

## Build and tables

* The built-in builds are 1.0.370/918 (iOS) and 1.0.370/1911 (Android). Fresh binds, `-own-device-session` and runs without a session config claim them. A session config that names no `appVersion`/`versionCode` keeps claiming the build such configs always had, 1.0.344/786 (iOS) or 1.0.364/1892 (Android), and the run warns to add the fields.
* Every generated table is regenerated from tables 40413: activities (1,451 rows, now with `tableInfoType`, `showUiType`, the group columns, `para`, `para_1`, `para_3`, `para_5`, `condition` and `condition_giftbag`), production, visitor types, duel scores (with `lw_hero` and `officer_recruit`), alliance science (with its tab), dig maps, radar events, mail groups, and the new season tables. One constant, `tableVersion` in `internal/game/tables.go`, names the version, and a test holds every generated file's header to it.
* With `LASTWAR_TABLES` pointing at a table dump, `go test ./internal/game` reruns every generator and fails on any difference, and checks the lists still copied from a table by hand. An activity id the table lacks is now logged at Warn.

## The production login (iOS)

These change what the scheduled iOS run does. Give them a config-copy test before the cron uses them. Since the follow-up a copy without a `shumeiId` takes two runs, so the second `Login` sends the `shumeiId` the first one saved: start the second only after the first logged `saved the pushed shumeiId`. A copy that already has one sends it from its first `Login`, and that run logs `pushed shumeiId already saved` when the push repeats it (see [What to check](#what-to-check-on-the-first-runs)).

* **GSL lookup before every reconnect.** As the real client does on every cold start, the run asks GSL `getserverlist.php` (no `opt`) for the role's server before the `Login`. It fails open: any lookup error keeps the configured address and token. A token the reply carries is used, and a rotated refresh token is saved before the `Login`. If the listed server can't be reached, the `Login` goes to the configured address; if a server refuses a handed-back token (`E011`), the token the lookup replaced (the configured one, or the one this run's refresh issued) is tried at the same address, after any lookup. GSL's gateway host names will likely replace the captured IPs on the first run.
* **The `Login`:** `netType` is 1 (Wi-Fi). The `ta` field `lw_version` is the claimed app version. From an iOS capture, `cmd/pcap -session-out` records the device fields (`phone_model`, `osVersion`, `mt`, `idfv`, `distinct_id`, `fromCountry`, `lang`, `phone_screen`, `afuid`, `firebaseId`) under `device`, and an iOS reconnect sends them again; without them the run warns to recapture. Since the follow-up the iOS `ta` fills `lw_device_id`, `lw_airKey` and `lw_shumei_id` and replays a captured `ta` (see [The follow-up](#the-follow-up-on-the-users-decisions)). `isUseLz4` goes out only while check-version's switches 4 and 5 are off. With switch 25 off, the `Login`'s `shumeiBoxId` is empty. About 5 % of device ids are bucketed to the `ea-` check-version hosts, as in the client.
* **Forced update:** `updateType` 2 stops the run with exit code **5**: in check-version before the GSL lookup, in a `Login` reply before `init`.
* **Ends of a session:** `push.user.gm.off` and `push.refund.restart` end the run with exit 3, like `push.user.off`. A `push.account.device.del` that names this run's device ends it with exit 2: bind again or recapture. `E015`/`E016` (the season's server window) exit 1. `E005` is unchanged (exit 2).
* **Transport:** each reply is paired with its request by `_id`, so a late reply to a timed-out request is no longer taken for the next one. Once the server has answered a ping, waits that end with no frame at all count as a dead connection when their silence adds up to more than 12 s: with the usual 8 s waits that is the end of the second silent wait in a row, about 16 s, and a single longer wait, such as the one for `init`, can pass it alone. A request body over 1,000,000 bytes is refused, the big-size flag follows the uncompressed length, and a pong is timed by the socket read that delivered it.
* `login.init` is sent with only its `_id`. An empty server list in a GSL reply is error E120 for every `opt`.

## Bind, guest and Android identity

* `-interactive` sends integers that fit 32 bits as SFS Int and larger ones as Long; a key suffix `:i`, `:l`, `:d`, `:s` or `:b` picks the type.
* The role picker binds every role with the account's top-level `loginKey`, and the bound role's zone is kept in `.lastwar_goclient_zone` and sent as the GSL `zone`. A `push.account.login.new` without a `gameUid` fails the bind.
* A new Android identity's deviceId is its Android ID plus `_n3d`. It keeps an install record in `.lastwar_goclient_android_install` (install time, AppsFlyer-style `afuid`, ThinkingData `distinct_id`), sent in the Android `Login`. The Android `Login` also sends `google_available` 1, the catalog phone's `simOp` and `simOpName`, `lat` 0, and a `ta` with `#device_type`, `#install_time`, `#ram`, `#disk` and `#carrier` as ThinkingData builds them. `gcmRegisterId` and `referrer` are Android-only.
* **ShuMei** (Android only): the fingerprint's slots follow the 1.0.370 SDK, the device catalog carries US SIMs, and a registration sends the SDK's `/v3/cloudconf` request before the device profile, keeping its counters and the cached cloud config in `shumeiInstall`. See [ShuMei](https://lastwar.tech/shumei.md).

## Features that changed in place

* **City:** the Season 7 Blessing Fountain farms 853000-856000 and the week-card farm 857000 are collected. Visitor queue 1 counts type 9. `finished-timers` leaves finished upgrades alone while the account's confirm-before-finish setting is on (HQ 16 and up), and reads a building's upgrade end from its build queue, as do `alliance-call-help` and `duel-speedups`. Since the follow-up `finished-timers` holds finished upgrades for a day that scores building power and finished research for one that scores research power, and finishes as before without a duel or when it can't read the duel. The idle reward is not claimed when the peek shows both pools empty.
* **Dailies:** `quests` leaves the Season 7 Lockhart quest 2400008 to `stage-quests`, which also knows the 40413 stage rows. The free weekly package needs HQ 8. The week-card gift is claimed when the info reply has no `dailyFree`. The truck privilege waits until the station is out of the fog. `free-recruits` logs a Warn naming the confirmation wherever the recruit window would ask one before the free pull (alert 1, 2 or 5), and still pulls.
* **Alliance Duel:** `duel-recruit-tickets` keeps a ticket where the recruit window would ask a wish confirmation (alert 1, 2 or 5) and reads `officer_recruit` 40413; a pool newer than the tables is pulled unless the wish question applies. `duel-speedups` leaves jobs that end more than a year out. `duel-troop-training` holds on Enemy Buster unless a training speed-up is held and a later run is left in the day, and trains T11 in season 4 from day 64. `secret-tasks-start` reads hero quality from the generated `lw_hero` and skips a placement the server refuses. `arms-race-chests` claims only before the stage ends. Item counts follow the client's field precedence.
* **Alliance:** the tech donation reads the charges (`al.science.refreshNum`) before donating and stops quietly on 120471 or 120836. Tab-3 techs are not donated out of season. `alliance-salary` skips only when init shows its activity closed, and the officer box only below rank 4. Fireworks of type 1 need the building's alliance, not a member. The fireworks and treasure features share one scan per run (three blocks around each member HQ, viewport-shaped requests of at most 160 blocks), its requests 0.5 s apart. A clustered alliance needs a few requests; one spread over the map needs more than before, up to about 50 for 100 HQs across the whole map, which adds about 25 s to the run.
* **Events:** the crystal boss follows the client's window, HQ condition and march reply. Seven-day boxes ignore the VIP flag except on the claim-all views. A bought battle pass also claims its state-2 tasks and high-tier rows. The T11 idle features check the camp level and season first. A `hero.event.info.get` reply that carries `success` is dropped, as the client drops it, and the Torch Relay pack needs its table row. Lucky Roll and Bargain Shop need `lastReceiveFreeTime` in the reply. LuckyShop, BattlePass\_new, BargainShop and the season preview send the entry's own id.
* **Season:** `season-dailies` sends the power-milestone pair only in a Desert (type 1) season, as the client does; any other season uses achievements v2, claimed by the new `season-achievements`. Military salary reads `para_1` (Season 7 included), the week card reads the row's card id, the Season 7 mummy yard is 858000, and `season-output` claims a stronghold output entry that names no `serverId` for the source server instead of skipping it (Seasons 2, 3, 4 and 7).
* **Radar and dig:** the dig and radar tables include Season 7 (maps 17001-17062, cave exploration 700001-700033). The vault and chest track open by activity type, Treasure Hunt reads its dig row from `tableInfoType`, and a vault open whose reply asks for a re-check re-reads the vault (any `checkOpenAll` but `false`).
* **Railway** (opt-in): a squad's present `soldierType` is kept, squads fill slots in wire order, the squad is saved before every truck attack, `train.data` is read only while the truck activity is open, a lineup the client would refuse leaves trains alone, and the attack log names the outcome.

## New opt-in features

66 features, each off by default with a summary ending "(static-only, not validated live)". None marches or sends a chat message (four read the alliance chat), and none spends anything except the user's carve-outs: `duel-gacha-draw` spends only the duel gacha's own score balance, and `truck-reroll` uses only a truck's free reroll. `secret-task-assist` is seen by the ally it helps. Each logs its first reply at Info and registers no benign error code. An error code is logged and stops that claim; depending on the feature it also stops the rest of that activity or building, or the feature for the run, while others (`city-soldiers`, `radar-rescue-claims`, `supplies-search` among them) go on to their other claims. The read-only `-plan` features send only reads.

| Area | Features |
| - | - |
| City | `city-soldiers`, `captive-visitors`, `cockatrice-visitors`, `hero-countdown-reward`, `city-garbage` |
| Dailies and mail | `flower-train-cheer-boxes`, `hero-wish-claim`, `mail-single-claims-plan` |
| Alliance Duel | `duel-gacha`, `duel-gacha-draw`, `duel-gacha-plan`, `explorer-treasure-plan`, `secret-task-assist`, `secret-task-assist-plan` |
| Alliance | `base-bubbles`, `city-first-occupation`, `s0-alliance-boss`, `alliance-star-emoji`, `zone-mobilization-tasks` |
| Events | `sunrise-foundation`, `gift-box-free-draw`, `gift-box-score-boxes`, `hero-exchange-reward`, `world-boss-kill-rewards`, `food-event-boxes`, `food-event-boxes-plan`, `banquet-v2-claims`, `banquet-v2-claims-plan`, `bounty-hunter-milestones`, `bounty-hunter-chests`, `event-milestone-boxes`, `decoration-gacha-boxes` |
| More events | `tactical-card-box-points`, `tactical-card-collection`, `offseason-tasks`, `survivor-pack`, `doomsday-quests`, `parkour-tasks`, `front-break-tasks`, `leading-quest-tasks`, `hero-trial-stage`, `sand-worm-tasks`, `crazy-rock-tasks`, `letters`, `sky-battle-boxes`, `newbie-arena-rewards`, `birthday-set-reward`, `mastery-newbie-reward`, `counter-attack-rounds`, `theme-prenotice` |
| Season | `season-achievements`, `military-rank-up`, `season-trends`, `season-outpost-boxes`, `cross-throne-rewards`, `bloody-night-tasks`, `jungle-trial-rewards`, `gold-tree-prayer` |
| Radar | `radar-rescue-claims`, `supplies-search` |
| Railway | `truck-reroll` |
| Alliance chat | `chat-scan`, `red-packets`, `fireworks-chat`, `alliance-treasures-chat` |

The progress claims among them run in the last phase, after the actions, so a run claims what its own actions earned. `duel-gacha-draw` runs there after `duel-gacha`'s pity claim, and `truck-reroll` in the first phase, before `truck-deploy` sends a truck it rerolled to UR.

## The follow-up on the user's decisions

The user ruled on the audit's open questions on 2026-11-19, and a follow-up built them. All of it is static analysis, like the rest of this page.

* **The iOS `ta`.** The iOS `Login`'s `ta` carries `lw_device_id` and `lw_airKey` (the `Login`'s own `deviceId` and `airKey`) and `lw_shumei_id` (the session config's `shumeiId`, empty until one is known), as the 1.0.370 app does before every `Login` (`Assembly-CSharp.decompiled.cs:59117-59125`, iOS). Before, the three went out blank, which the cron's August 2026 runs showed the server accepts. A session config whose captured device has a `ta` replays that `ta` byte for byte, with `#app_version`, `lw_version`, `lw_res_version`, `lw_buildcode`, `lw_zone`, `lw_device_id`, `lw_airKey` and `lw_shumei_id` taken from the run; `lw_game_session_id`, `lw_main_level` and `lw_first_launch` stay as captured. A captured device without a `ta` warns to recapture. Android keeps the three ids blank.
* **`shumeiId`.** The session config keeps the `shumeiId` the server pushes (`push.shumei.id`): `pcap -session-out` records it, and a run saves each one a push brings as it arrives, as the app does in the push handler (`PushShumeiIdMessage.lua:14-18`), so a run that then exits 1 or 3 keeps it; for the config's own `deviceId` only. The iOS `Login` sends it as `ta` `lw_shumei_id`, so the cron's `Login` sends it from the run after the first push, with no recapture.
* **`pcap -session-out`** records the iOS `ta` under `device.ta`, prints the `shumeiId` length with the others, and, written onto an existing session config, keeps every key it doesn't write (`features`, `duelPolicy`, `shumeiInstall` and any other). It drops `accessTokenTime` when the token changed and the refresh token when the `deviceId` changed, and refuses a file that isn't a JSON object. A recapture can go straight onto the live config. A run's own saves (tokens, the pushed `shumeiId`, the save-back) write only the keys the session config models, so a key `goclient` doesn't know is dropped at the first such save.
* **`finished-timers` holds for the duel day.** A finished upgrade (`free.building.upgrade.finish`) waits for a day whose duel entry lists type 23 (Base Expansion, Total Mobilization) and a finished research (`queue.finish`) for one that lists type 6 (Age of Science, Total Mobilization). It holds only in an alliance with the duel activity open and readable, and a rest day with no current entry holds too. With no duel (no alliance, no open duel activity, HQ below 10) it finishes as before; when it can't read the duel it finishes with a Warn. A held research leaves its Tech Center's queue idle until a scoring day. Repairs, healing and camp output are never held, and the confirm-before-finish setting still applies.
* **New opt-in features:** `secret-task-assist` (`hero.dispatch.assist`, up to 5 a day, never `hero.dispatch.steal`), `duel-gacha-draw` (`al.duel.lottery.lottery {configId, num: 1}`, paid only from the gacha's own score, on a Sunday or while the duel runs), `truck-reroll` (`train.change`, a truck's one free reroll, N, R and SR trucks only), and the chat consumers `fireworks-chat` and `alliance-treasures-chat` next to `chat-scan` and `red-packets`. See [Alliance Duel](https://lastwar.tech/alliance-duel.md), [World map](https://lastwar.tech/world-map.md#railway-trucks-and-alliance-trains) and [Alliance, chat & mail](https://lastwar.tech/alliance-chat-mail.md#chat-websocket-transport).
* **The chat reader** sends only `room.joinMulti` and `history.roomsv2`. One chat read per run serves all four chat features, and it drops the phone's chat connection, as the run's game login drops the phone's game session.
* **Not built: the free research finish** (`queue.ccd.m.new {qUUID, itemIDs: ""}` inside effect 30100's window). The same bytes are the client's diamond instant finish, and on a 3-hour cron it would complete nothing earlier: the window is at most 3 h, and `finished-timers` completes the research on the next run anyway.

## What to check on the first runs

* The GSL lookup line before the `Login`, and whether the saved address changed.
* `season-dailies`: the logged season config and type; in a non-Desert season no power-milestone pair goes out.
* Two claims move from features the production config enables to opt-in ones that are off by default and not validated live: the achievement grades outside a Desert season (`season-dailies` to `season-achievements`) and the Season 7 Lockhart quest 2400008 (`quests` to `stage-quests`). Nothing claims them until `season-achievements` and `stage-quests` are validated and enabled.
* `alliance-salary`: the gate depends on init listing activity 28 (the only type-372 row in 40413). Revert the gate if it skips an account that used to claim.
* `card-dailies`: the truck privilege claim needs init `monopolyStageInfo.stageId`; without it nothing is claimed.
* `free-chests`: no weekly package below HQ 8, and a Warn each run while init has no `weekFreeReward`.
* `treasure-digs`: a vault open reply with `checkOpenAll` now re-reads the vault, at most 12 rounds a run.
* The tech donation logs `useNum`, `donateAvailable` and `maxdonate.count` before donating; 120836 after the day reset is a Warn, not a run error.
* `arms-race-chests` claims nothing when the info reply has no `stage_end_time`.
* `finished-timers` leaves finished upgrades alone while the account's confirm-before-finish setting (19) is on, from HQ 16.
* `event-shop-freebies` skips Lucky Roll and Bargain Shop, with a Warn, when the reply has no `lastReceiveFreeTime`.
* The crystal boss sends nothing without an `activityId` in the march reply, and drops a progress reply for another season.
* `battle-pass` sends the new state-2 premium claims for a bought pass.
* `treasure-digs` spends owned hammers in the Season 7 off-season vault and chest track too (activities 2300011-2300015, 2300017 and 2300018-2300021).
* `season-dig` sends its first Season 7 requests: `season.dig.game.open` on the free alliance vaults 17043-17052 and `season.dig.game.get.personal.reward` on 17001-17042 and 17053-17062. `treasure-hunt` reads dig row 6 for 1071012.
* `free-chests` claims the week-card gift whenever the info reply has no `dailyFree`. If the server leaves the field out for an account without the card and refuses the claim with a code other than 120289, every run exits 1.
* check-version logs when the device falls in the early-access bucket and asks the `ea-` hosts.
* The iOS `Login`'s `ta` now carries `lw_device_id` and `lw_airKey`, and `lw_shumei_id` once a `shumeiId` is saved. Test it on a config copy before the cron uses it. A copy without a `shumeiId` (one from before the follow-up, or one where `pcap` printed `shumeiId (0 chars)`) takes **two runs**: its first `Login` sends `lw_shumei_id` empty, and that run saves the pushed id when the push arrives. Start the second run only after the first one logged `saved the pushed shumeiId` (a first run without that line got no push; run it again); only the second run's `Login` sends the filled form. A copy that already has a `shumeiId` (`pcap -session-out` records the capture's) sends the filled form from its first `Login`, so one run tests it; that run logs `pushed shumeiId already saved` when the push repeats the id, or `saved the pushed shumeiId` when it brings a new one. Each run kicks the phone's session.
* `finished-timers` logs each held upgrade and research with `today` and `waitsFor`, and which case the duel read took. On a Sunday the rest-day branch logs the duel activity's window: whether activity 55000 is open on the rest day decides whether completions are held through Sunday.
* Enabling any chat feature drops the phone's chat connection once per run.

Before enabling an opt-in feature of the follow-up, check its first reply on a config copy:

* `duel-gacha-draw`: `spent` against `expectedCost` (10,000,000) in the first draw reply, and whether `protectNum` keeps counting past `protect.num`.
* `truck-reroll`: the reply's `myTrain` (`uuid`, `cfgId`) and `changeCountByGold`, expected 1 after the first reroll.
* `secret-task-assist`: whether a `push.act.score.obtain` follows an assist on a Tuesday or Saturday, which would make it a duel action.
* The chat features: run `chat-scan` first, then `alliance-treasures-chat` and `fireworks-chat` with a card in chat (their first-reply lines show `replyKeys`, `numPresent`, `currServerId` and `pointId`).

## Not done

Built in the follow-up (opt-in where new, static-only): the duel gacha draw (`duel-gacha-draw`), Secret Task assists (`secret-task-assist`), the free truck reroll (`truck-reroll`), holding finished timers for their duel day, the `Login`'s `ta` device fields, and the chat consumers. Left open by it: whether a replayed `ta` should refresh `lw_game_session_id`, `lw_main_level` and `lw_first_launch`; whether Android's `ta` fills the three ids too; `truck-reroll` stops below SSR (an SSR reroll can't be undone, so widening it is the user's call); the chat reader reads only the alliance room. Still waiting for a decision: the `E005` exit code, GSL 211/212 during the pre-login refresh, the alliance challenge box, Ghost Recon actions, other alliances' shared treasures, alliance treasure boxes of types 2/5/8 (the same ruling decides whether `base-bubbles` keeps its built, opt-in Thanksgiving claim on other members' bases), supplies search past level 1, arena attacks, survey mail 146, AllianceCongratulation visitors, expired-item exchange, treasure-map digs, joining an alliance train, opening Explorer Treasure chests. Waiting for a capture or a live retest: `isSimulator` and the Android sensor lists, the ShuMei service class name, the forwarded-send framing (switch 29), the guest path's stored tokens, and a pong that waits in the kernel buffer.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.