Commit Graph
7 Commits
Author SHA1 Message Date
N0VAN0M4LY 655db2ab4a docs(native): describe the LocalMP loadout module in its header
The header of local_mp_loadout.c still named per-unit economic multipliers that
the economy rework removed from the module. It now says what the module does: on a
host the client has no receiver for its own vehicle change request, so the send
hook builds the ChangeUnitReflection and calls Unit::changeAircraft. Comment only.

Checked: native build, check-offsets.
2026-11-28 13:03:29 +08:00
N0VAN0M4LY e3c5880023 refactor(native): limit the LocalMP bridge to engine gaps
- Scoreboard scores come from the local service: BattleEconomy
  missionScores() writes the official mission scores into the stock
  mission block customScoreParams, which the client copies into
  MissionSettings+0x6d8 without reading it; local_mp_scores.c reads them
  with DataBlock::getReal. The hardcoded scores and the death score go.
- countActivePlayers already counts players with a living vehicle; the
  only LocalMP gap is its filter skipping bots (MPlayer+0x1d8 bit 7). A
  one-byte exe patch drops that filter bit instead of a rewrite hook.
- ucavLaunch returns early on a host; an exe patch skips that return
  instead of clearing the global host flag around the call.
- onBecameDead no longer runs with isLocalMP cleared: that only queued an
  EventOnPlayerDeath stock LocalMP skips on purpose, and broke the local
  player id remap inside the function.
- The host chat object keeps its two-field layout, now documented from
  the host chat handler that reads it.
2026-11-28 07:09:07 +08:00
N0VAN0M4LY 7c27d09f78 fix(battle): calculate LocalMP rewards in the local service
The LocalMP host has no battle server, and the previous bridge filled the
gap by computing money in the client: the native ledger wrote invented
amounts into SessionStatsNet, the spawn patch derived reward rates from
warpoints.blk, and the settlement patch summed and rescaled the result.
Rewards came out as zero or several orders of magnitude too high.

Now the client reports facts and the local service prices them.

Native (wto_ws.dll):
- local_mp_ledger.c is removed together with its SessionStatsNet
  offsets and four signatures (43 -> 39).
- local_mp_awards.c raises the HUD script event wtoLocalMpExpEvent for
  every combat event of the local player (event code, victim expClass
  and name, player or AI victim, friendly, naval damage). The DataBlock
  helpers and the HUD event queue are resolved from call sites inside
  GameSaveData::addScoreMessage, which already has a signature.

GUI patches:
- record-local-battle-awards records events and lives in nestdb and
  raises the stock InBattleReward banner from launch-time parameters.
- report-local-battle-settlement sends only facts and rebuilds the
  debriefing from the settled table; failures show the stock error box.
- use-settled-debriefing-stats makes gatherDebriefingResult read that
  table instead of the empty stat_get_exp().
- pass-spawn-modifications-blk no longer computes economy factors.

Local service:
- battle-economy dataset reads every reward factor from wpcost.blk,
  warpoints.blk and rank.blk; tuning/battle-economy.jsonc holds the
  mission score per event with its source (official values where
  published, otherwise marked).
- battle-economy.ts is the single pricing function, shared by the
  banner parameters and the settlement; battle-rewards.ts adds battle
  time, timed award, win/defeat bonus, activity, premium account,
  talisman, skill bonus and free research points; the debriefing table
  has the stat_get_exp() layout and travels in EULT_SESSION_RESULT.
- Crews earn skill points from the battle's research points.
- A battle left before it ends counts as a defeat.

Verified: npm run typecheck, check-gui (35 patches), check-patches,
check-offsets, native build. Not yet run in game.
2026-11-28 04:42:27 +08:00
N0VAN0M4LY b260d2899e chore(battle): snapshot the LocalMP rework baseline
Records the uncommitted battle-session work exactly as it was left
(local service matchmaking, settlement, chat, native LocalMP hooks,
battle gui/exe patches) so the following review and rework commits
show every correction as a diff against this state.

This commit is not reviewed and is known to be incomplete: in-game
testing reported wrong settlement rewards, single-country teams,
missing random/fixed supplement slots, misattributed hit messages and
other regressions. Do not merge this branch before the rework lands.
2026-11-28 03:15:47 +08:00
N0VAN0M4LY ddb381d7f9 fix(native): handle local HTTPS and allow shared log reads
Use the loopback service certificate for the offline HTTPS path. Retain
original host names for host-based routing and allow the network log
to be read while the client is running.
2026-11-25 06:05:20 +08:00
N0VAN0M4LY b6b6effef3 fix(native): preserve stock socket export ordinals
Keep the original ordinals for functions imported by number so Windows
can resolve the socket library imports during startup.
2026-11-25 05:04:28 +08:00
N0VAN0M4LY 2428b34497 feat(native): route client traffic to the loopback service
Build the socket library and client-local port configuration for redirecting
traffic to the offline service. Accept HTTPS and the existing matching and
HTTP protocols on the same port. Route requests by the original host.
2026-11-25 05:02:34 +08:00