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.
35 lines
1.8 KiB
PowerShell
35 lines
1.8 KiB
PowerShell
<#
|
|
Build wto_ws.dll with the Visual Studio C compiler (x64).
|
|
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File native\wto-net\build.ps1 [-Out <folder>]
|
|
|
|
Output: <Out>\wto_ws.dll (default build\native). Static C runtime (/MT), so the DLL needs
|
|
nothing but the system's ws2_32.dll. MinHook comes from native\third_party\minhook (BSD-2).
|
|
#>
|
|
param([string]$Out = (Join-Path $PSScriptRoot '..\..\build\native'))
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
|
|
$vs = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
|
if (-not $vs) { throw 'Visual Studio with the x64 C++ tools was not found' }
|
|
$vcvars = Join-Path $vs 'VC\Auxiliary\Build\vcvars64.bat'
|
|
|
|
$src = Join-Path $PSScriptRoot 'src'
|
|
$mh = Join-Path $PSScriptRoot '..\third_party\minhook'
|
|
New-Item -ItemType Directory -Force $Out | Out-Null
|
|
$obj = Join-Path $Out 'obj'
|
|
New-Item -ItemType Directory -Force $obj | Out-Null
|
|
|
|
$sources = @(
|
|
"$src\dll_main.c", "$src\hook_config.c", "$src\redirect_rules.c", "$src\resolver_hooks.c", "$src\connection_hooks.c",
|
|
"$src\local_mp_core.c", "$src\local_mp_players.c", "$src\local_mp_loadout.c", "$src\local_mp_actions.c", "$src\local_mp_awards.c", "$src\local_mp_kills.c", "$src\local_mp_events.c",
|
|
"$mh\src\hook.c", "$mh\src\buffer.c", "$mh\src\trampoline.c", "$mh\src\hde\hde64.c"
|
|
) | ForEach-Object { '"' + (Resolve-Path $_) + '"' }
|
|
|
|
$command = "`"$vcvars`" >nul && cl /nologo /LD /O2 /MT /W4 /wd4100 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN " +
|
|
"/I`"$mh\include`" /Fo`"$obj\\`" $($sources -join ' ') /Fe`"$Out\wto_ws.dll`" " +
|
|
"/link /DEF:`"$src\wto_ws.def`" ws2_32.lib"
|
|
cmd /c $command
|
|
if ($LASTEXITCODE -ne 0) { throw "cl failed with $LASTEXITCODE" }
|
|
Write-Output (Join-Path $Out 'wto_ws.dll')
|