refactor(repo)!: move apps, shared packages, and patch definitions
Everything sat in packages/: two programs next to the small libraries
they use, and the patch data loose at the root. The programs now live in
apps/ and the shared libraries in packages/:
apps/server the local server (was packages/local-service),
package @wto/server
packages/patcher builds the game copy (was packages/build),
package @wto/patcher
patches/exe exe patch definitions (was exe-patches)
patches/gui GUI script patches (was gui-patches)
Inside the server, the network layer folder becomes transport/ so it is
not server/server/, the entry module is server.ts, and startLocalService
and its types become startServer, ServerOptions and RunningServer. The
health answer names the app wto-server, and the TLS files in the data
folder are server.key and server.crt (made again on the next start).
Comments, logs and tool texts say "local server".
The patcher no longer reaches into the server's folder. It read the
default tuning/store.jsonc by a relative path to register bundle GUIDs
for the multi-vehicle packs, which also ignored the player's overrides
in <data>/tuning/. It now takes the pack ids from its caller; the
server exports multiVehiclePackIds(dataFolder), which reads them the way
the running server does. rebuildGuiPack takes the patch folder from its
caller as well.
The development build moves out of the patcher to
scripts/build-game-copy.ts, since it uses both the server and the
patcher. It needs --data (the folder the server will run with) and
defaults the patch folders and the hook library to this repository.
Checked with the root typecheck, check-patches, check-gui,
check-offsets, the native build, a run of build-game-copy.ts into a
scratch folder (12 exe patches, 35 GUI patches, 496 bundle GUIDs as
before) and a server start from apps/server answering wto-server.
BREAKING CHANGE: Use @wto/server and @wto/patcher from the new workspace paths. Run the development build with scripts/build-game-copy.ts and pass --data.
This commit is contained in:
1 parent
9c813ccf7d
commit
930ea07630
476 files changed
+275
-251
No files matched your search
@@ -0,0 +1,8 @@
|
||||
// Masked signature of BotSystem::changeUnit from the spawn point check (call 0x111a010)
|
||||
// to the g_multiplayer null guard, 0x3c bytes; rip-relative and branch targets are wildcards.
|
||||
// 2.61.0.37: unique hit at 0x11b2c14, edited instruction at +38 (0x11b2c3a).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "48 8b 05 ?? ?? ?? ?? 48 8b 88 e0 03 00 00 48 8b 5c 24 20 48 89 da 4d 89 f0 e8 ?? ?? ?? ?? 84 c0 0f 84 ?? ?? ?? ?? 48 83 3d ?? ?? ?? ?? 00 0f 84 ?? ?? ?? ?? 48 8b 54 24 20"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Let BotSystem::changeUnit spawn the AI players' vehicles on a LocalMP host (0x11b2c3a: the g_multiplayer
|
||||
// null guard becomes a jump to the Unit::changeAircraft call at 0x11b314e).
|
||||
// Why the exe: the build drops the dedicated server's script spawn permission, so with a multiplayer
|
||||
// session the function only logs "spawn denied by scripts"; non-host sessions already return at its start.
|
||||
// Without it: no AI vehicle ever spawns in a LocalMP battle.
|
||||
// Kept from the baseline; not re-reviewed in the LocalMP rework.
|
||||
{
|
||||
"id": "battle/allow-local-host-bot-spawns",
|
||||
"title": "Let BotSystem spawn AI vehicles on a LocalMP host",
|
||||
"features": [
|
||||
"K-AI 对手与队友"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 38,
|
||||
"asm": [
|
||||
"jmp 0x514",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop",
|
||||
"nop"
|
||||
],
|
||||
"bytes": "e90f050000909090909090909090",
|
||||
"expect_original": "48833d6e109d06000f8406050000"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Masked signature of the 0xf02f (UnitRespawnRequest) branch of Unit::onEvent (0x103fbc0), from the
|
||||
// human player check (call 0xfd34a0) to the spawn logic entry, 0x68 bytes; relative targets are wildcards.
|
||||
// 2.61.0.37: unique hit at 0x1044e9b, edited instruction at +49 (0x1044ecc).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "48 89 d9 e8 ?? ?? ?? ?? 84 c0 0f 84 ?? ?? ?? ?? 48 83 3d ?? ?? ?? ?? 00 0f 84 ?? ?? ?? ?? 8b 05 ?? ?? ?? ?? 83 c0 fd 49 8b 95 98 0f 00 00 83 f8 02 72 ?? 0f b6 4a 08 83 ba f8 0b 00 00 00 79 ?? 83 ba f4 0b 00 00 00 0f 88 ?? ?? ?? ?? ba 06 00 00 00 e8 ?? ?? ?? ?? 4c 89 e9 b2 01 e8 ?? ?? ?? ?? e9 ?? ?? ?? ?? 31 d2"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Let the LocalMP host's player spawn in versus modes (GM_DOMINATION and others): the UnitRespawnRequest
|
||||
// (0xf02f) branch of Unit::onEvent takes the spawn path at 0x1044f03 for every game mode (0x1044ecc jb -> jmp).
|
||||
// Why the exe: the client keeps the spawn path only for GM_SINGLE_MISSION and GM_DYNAMIC; the versus modes'
|
||||
// branch belongs to the dedicated server, which the build drops, and nothing outside the function decides it.
|
||||
// Without it: after the "To Battle!" countdown the player falls back to vehicle selection.
|
||||
// Kept from the baseline; not re-reviewed in the LocalMP rework.
|
||||
{
|
||||
"id": "battle/allow-local-host-player-respawn",
|
||||
"title": "Let the LocalMP host's player spawn in versus modes",
|
||||
"features": [
|
||||
"K-出生点数 / 重生"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 49,
|
||||
"asm": [
|
||||
"jmp 0x37"
|
||||
],
|
||||
"bytes": "eb35",
|
||||
"expect_original": "7235"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Masked signature of ucavLaunch from its prologue to the g_multiplayer->isHost early return, 0x35
|
||||
// bytes; the rip-relative load of g_multiplayer and the branch targets are wildcards.
|
||||
// 2.61.0.37: unique hit at 0x101ccd0, edited instruction (jne to the return) at +51 (0x101cd03).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 81 ec 18 02 00 00 0f 29 bc 24 00 02 00 00 0f 29 b4 24 f0 01 00 00 48 8b 05 ?? ?? ?? ?? 48 85 c0 74 ?? 80 78 60 00 75 ??"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Let the LocalMP host launch a UCAV (the light tank recon drone and the strike UCAV) from its vehicle.
|
||||
// Why the exe: ucavLaunch returns at once when g_multiplayer->isHost is set, because on a dedicated
|
||||
// server the launch is handled by server code that the client build does not contain; a LocalMP host
|
||||
// is that server. Nothing outside the function decides it.
|
||||
// Without it: pressing the drone key on a LocalMP host does nothing.
|
||||
{
|
||||
"id": "battle/allow-local-host-ucav-launch",
|
||||
"title": "Let a LocalMP host launch UCAVs",
|
||||
"features": [
|
||||
"K-侦察"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 51,
|
||||
"asm": [
|
||||
"nop",
|
||||
"nop"
|
||||
],
|
||||
"bytes": "9090",
|
||||
"expect_original": "753a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Masked signature of countActivePlayers (prologue through the player filter mask), 0x1b bytes.
|
||||
// 2.61.0.37: unique hit at 0x11b9b60, edited instruction (or eax, 0x3a) at +24 (0x11b9b78).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "41 57 41 56 41 54 56 57 53 48 83 ec 38 89 cf 80 f2 01 0f b6 c2 c1 e0 0a 83 c8 3a"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Count AI players in countActivePlayers, the player count that domination ticket bleed and the
|
||||
// battle's player-count rules use.
|
||||
// Why the exe: the stock count walks MPlayers with a filter that skips bots (MPlayer+0x1d8 bit 7,
|
||||
// "isBot"), because online battles have human players only; in a LocalMP battle the AI players take
|
||||
// the human players' places, so the filter would count the AI team as empty. The filter is an
|
||||
// immediate in the function; nothing outside it can change it.
|
||||
// Without it: the AI team counts as having no active players.
|
||||
{
|
||||
"id": "battle/count-bots-as-active-players",
|
||||
"title": "Count AI players as active players in LocalMP battles",
|
||||
"features": [
|
||||
"K-击杀、助攻、占点计分"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 24,
|
||||
"asm": [
|
||||
"or eax, 0x32"
|
||||
],
|
||||
"bytes": "83c832",
|
||||
"expect_original": "83c83a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Anti-cheat init, from the already-initialised check to the end of the "Disabled from CMD" branch, 109 bytes;
|
||||
// rip-relative and branch targets are wildcards.
|
||||
// 2.61.0.37: unique hit at 0x30c7112, edited je at +0x4a (0x30c715c).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "48 83 3d ?? ?? ?? ?? 00 74 ?? 48 8d 15 ?? ?? ?? ?? 31 db b9 03 00 00 00 45 31 c0 45 31 c9 e8 ?? ?? ?? ?? e9 ?? ?? ?? ?? 49 89 ce c7 44 24 50 01 00 00 00 48 8d 0d ?? ?? ?? ?? 48 8d 54 24 50 45 31 c0 e8 ?? ?? ?? ?? 48 85 c0 74 ?? 48 8d 15 ?? ?? ?? ?? b9 03 00 00 00 45 31 c0 45 31 c9 e8 ?? ?? ?? ?? bb 01 00 00 00 e9 ?? ?? ?? ??"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Always take the "-nobeac on the command line" branch, so BattlEye is never loaded.
|
||||
// Why the executable: the anti-cheat loader runs before any network request; no service can answer it.
|
||||
// Without it: launching aces.exe directly loads BattlEye and it tries to report to its servers.
|
||||
{
|
||||
"id": "isolation/never-load-battleye",
|
||||
"title": "反作弊 BattlEye 永远不加载,和带上原版启动参数 -nobeac 的效果相同",
|
||||
"features": [
|
||||
"A-与正版隔离",
|
||||
"A-不连 Gaijin"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 74,
|
||||
"asm": [
|
||||
"nop",
|
||||
"nop"
|
||||
],
|
||||
"bytes": "9090",
|
||||
"expect_original": "7421"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Command line switch lookup that sets dl and calls the crashpad setter, 45 bytes; call targets are wildcards.
|
||||
// 2.61.0.37: unique hit at 0x40f5930, edited sete dl at +0x1a (0x40f594a).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "48 8d 0d ?? ?? ?? ?? 48 8d 94 24 f0 00 00 00 45 31 c0 e8 ?? ?? ?? ?? 48 85 c0 0f 94 c2 48 89 d9 e8 ?? ?? ?? ?? 48 89 f9 ba 01 00 00 00"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Always behave as if -crashpad-disable-upload was given: crash dumps stay on the machine.
|
||||
// Why the executable: the upload switch is read from the command line only.
|
||||
// Without it: a crash of a directly launched game uploads its dump to Gaijin.
|
||||
{
|
||||
"id": "isolation/never-upload-crash-reports",
|
||||
"title": "崩溃报告永远不上传,和带上原版启动参数 -crashpad-disable-upload 的效果相同",
|
||||
"features": [
|
||||
"A-不连 Gaijin"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 26,
|
||||
"asm": [
|
||||
"xor dl, dl",
|
||||
"nop"
|
||||
],
|
||||
"bytes": "30d290",
|
||||
"expect_original": "0f94c2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// The wide string L"Software\Gaijin\WarThunder" with its terminating zero, 54 bytes.
|
||||
// 2.61.0.37: unique hit at 0x7a39c4e.
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".rdata",
|
||||
"pattern": "53 00 6f 00 66 00 74 00 77 00 61 00 72 00 65 00 5c 00 47 00 61 00 69 00 6a 00 69 00 6e 00 5c 00 57 00 61 00 72 00 54 00 68 00 75 00 6e 00 64 00 65 00 72 00 00 00"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Use HKCU\Software\WTOffline instead of Software\Gaijin\WarThunder.
|
||||
// Why the executable: the registry path is a constant in the game identity table.
|
||||
// Without it: the offline login reads and overwrites the retail client's saved credentials.
|
||||
{
|
||||
"id": "isolation/registry-key",
|
||||
"title": "把注册表位置从 Software\\Gaijin\\WarThunder 改成 Software\\WTOffline,不碰正版保存的登录信息",
|
||||
"features": [
|
||||
"A-与正版隔离"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 0,
|
||||
"data": {
|
||||
"encoding": "utf-16-le",
|
||||
"text": "Software\\WTOffline"
|
||||
},
|
||||
"bytes": "53006f006600740077006100720065005c00570054004f00660066006c0069006e006500000000000000000000000000000000000000",
|
||||
"expect_original": "53006f006600740077006100720065005c004700610069006a0069006e005c005700610072005400680075006e006400650072000000"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "WarThunder" with the preceding string terminator and the following "War Thunder", 24 bytes,
|
||||
// so the hit is the copy referenced by the game identity table.
|
||||
// 2.61.0.37: unique hit at 0x777eb96, string at 0x777eb97.
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".rdata",
|
||||
"pattern": "00 57 61 72 54 68 75 6e 64 65 72 00 57 61 72 20 54 68 75 6e 64 65 72 00"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Rename the game from WarThunder to WTOffline, which moves every per-user data folder.
|
||||
// Why the executable: the engine derives Documents/AppData folders from this constant name.
|
||||
// Without it: the offline client reads and rewrites the retail client's settings.
|
||||
{
|
||||
"id": "isolation/user-data-folder-name",
|
||||
"title": "把游戏名从 WarThunder 改成 WTOffline,让离线版的用户数据目录和正版分开",
|
||||
"features": [
|
||||
"A-与正版隔离"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 1,
|
||||
"data": {
|
||||
"encoding": "ascii",
|
||||
"text": "WTOffline"
|
||||
},
|
||||
"bytes": "57544f66666c696e6500",
|
||||
"expect_original": "5761725468756e646572"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// libcurl Curl_clone_primary_ssl_config from entry to the cert_blob null check, 176 bytes; branch targets are wildcards.
|
||||
// 2.61.0.37: unique hit at 0x56463c0, edited instruction at +0x52 (0x5646412).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "56 57 53 48 83 ec 20 48 89 d6 48 89 cf 8b 82 98 00 00 00 83 c8 20 89 82 98 00 00 00 0f b6 89 95 00 00 00 88 8a 95 00 00 00 8b 8f 90 00 00 00 89 8a 90 00 00 00 8b 8f 98 00 00 00 83 e1 01 83 e0 fe 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 02 83 e0 fd 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 04 83 e0 fb 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 08 83 e0 f7 09 c8 89 82 98 00 00 00 8b 8f 98 00 00 00 83 e1 10 83 e0 ef 09 c8 89 82 98 00 00 00 0f b6 87 94 00 00 00 88 82 94 00 00 00 48 8b 5f 68 48 85 db 74 ??"
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Clear libcurl's verifypeer and verifyhost bits when a connection copies its SSL settings.
|
||||
// Why the executable: dagor.http and yuplay2 requests ignore network.blk enableSslCertCheck.
|
||||
// Without it: redirected HTTPS requests (GJN purchases, item_info, redeem codes) fail the TLS handshake.
|
||||
{
|
||||
"id": "online/accept-local-tls-certificate",
|
||||
"title": "让客户端的 HTTPS 连接接受本地服务的自签证书",
|
||||
"features": [
|
||||
"A-不连 Gaijin",
|
||||
"G-礼包商店",
|
||||
"G-兑换码"
|
||||
],
|
||||
"requires": [
|
||||
"online/network-hook-library"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 82,
|
||||
"asm": [
|
||||
"and eax, -4",
|
||||
"nop",
|
||||
"nop"
|
||||
],
|
||||
"bytes": "83e0fc9090",
|
||||
"expect_original": "83e0fd09c8"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// PEM header plus the DER prefix shared by every 2048-bit RSA key with exponent 65537;
|
||||
// Gaijin's key bytes are not part of the pattern, so a rotated key is still found and expect_original checks it.
|
||||
// The 1024-bit PEM at 0x7a3543d has a different prefix and does not match.
|
||||
// 2.61.0.37: unique hit at 0x73422b0.
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".rdata",
|
||||
"pattern": "2d 2d 2d 2d 2d 42 45 47 49 4e 20 50 55 42 4c 49 43 20 4b 45 59 2d 2d 2d 2d 2d 0a 4d 49 49 42 49 6a 41 4e 42 67 6b 71 68 6b 69 47 39 77 30 42 41 51 45 46 41 41 4f 43 41 51 38 41 4d 49 49 42 43 67 4b 43 41 51 45 41"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Replace the matching server public key with the local server's key.
|
||||
// Why the executable: the session key is encrypted with this constant; only its private key can open it.
|
||||
// Without it: the client cannot connect to the local matching server and the hangar never finishes loading.
|
||||
{
|
||||
"id": "online/matching-server-public-key",
|
||||
"title": "把程序里匹配服务器的公钥换成本地服务的公钥,让本地服务能解出匹配连接的会话密钥",
|
||||
"features": [
|
||||
"J-对局模式",
|
||||
"B-机库与载具"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 0,
|
||||
"data": {
|
||||
"encoding": "ascii",
|
||||
"text": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsPgD//C1npQhtyOpbO4A\npdBsJJStEDHapfM9SlKfhjuaXxJg7gn9iNkYDX9qCijXEH9iu/BVgI2d2RmHI1fC\nhmEnRtYvHiBgYYhB8lkMr0THDWgW7U6EmSjyPZ1w2uZuUKDuqkl8rksnveT0+Pz5\ngAK1SyczQteu0xoHhs/QuPN9RG/utuCWq/h6qPndPh+VQrMwr1n88eX4WFDMIRR0\n5Xoz0SLP1q5m2PrnK1jQ8asSTvU/dTbHzMX+XYyU9i5GSX2buOPug8QD1UmEJWxo\njSd8R9zs8YXAcni3IbFygDlNvP1C3r1fjtg1oqaYRXx4PDTGa8vtNpm45d7XtTyK\nWQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
},
|
||||
"bytes": "2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d494942496a414e42676b71686b6947397730424151454641414f43415138414d49494243674b4341514541735067442f2f43316e70516874794f70624f34410a706442734a4a53744544486170664d39536c4b66686a756158784a6737676e39694e6b594458397143696a5845483969752f42566749326432526d48493166430a686d456e527459764869426759596842386c6b4d7230544844576757375536456d536a79505a317732755a75554b4475716b6c38726b736e766554302b507a350a67414b315379637a5174657530786f4868732f5175504e3952472f7574754357712f683671506e6450682b5651724d7772316e38386558345746444d495252300a35586f7a30534c503171356d3250726e4b316a51386173535476552f645462487a4d582b585979553969354753583262754f50756738514431556d454a57786f0a6a53643852397a7338595841636e69334962467967446c4e76503143337231666a7467316f7161595258783450445447613876744e706d34356437587454794b0a57514944415141420a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a",
|
||||
"expect_original": "2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d494942496a414e42676b71686b6947397730424151454641414f43415138414d49494243674b434151454135566b754b6e6d5a3131777a66696169646b4c710a6256436f6f6448755a4b716c30547577516b2b4148306151625834773350373976584b57455751504c556156734f7a2b7a6166564455344b64764f374a2b62360a78706a6e49387632666c305653684e4e6a77664762386844364b32794532684f6466564f4e35676e6b3274456764654147443065324d38744e457869344d35770a707145545348336a6438376b6a30707a3941377231584c304d505163475664397236746e5a6f4d74754b6b786276754f326669452b4368306e41716b336461340a63424d756a43634963553849766362374733464841463572426d456c58524c6a485746566859446835336b52524c2f472f6d6e4a4a6e4b684e3638575070414d0a7167506457566f6f495731573646467a6c6f6a627338644241662f4e33616c5a4f46616378422f35373537516c7647364b38734952796d556b71396f4f6839500a62514944415141420a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d0a"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// The import name "WS2_32.dll" with its terminating zero, 11 bytes.
|
||||
// 2.61.0.37: unique hit at 0x7a4b090 (referenced by the import descriptor Name field).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".rdata",
|
||||
"pattern": "57 53 32 5f 33 32 2e 64 6c 6c 00"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Import wto_ws.dll instead of WS2_32.dll; it forwards every export and redirects lookups and connections.
|
||||
// Why the executable: many Gaijin addresses, ports and schemes are constants with no configuration entry.
|
||||
// Without it: hard-coded https endpoints try the real internet and purchases/redeem codes never reach the local server.
|
||||
{
|
||||
"id": "online/network-hook-library",
|
||||
"title": "让游戏加载离线版的网络钩子库 wto_ws.dll(代替直接加载 WS2_32.dll),把所有联网都接到本地服务",
|
||||
"features": [
|
||||
"A-不连 Gaijin",
|
||||
"A-与正版隔离",
|
||||
"G-礼包商店",
|
||||
"G-兑换码"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 0,
|
||||
"data": {
|
||||
"encoding": "ascii",
|
||||
"text": "wto_ws.dll"
|
||||
},
|
||||
"bytes": "77746f5f77732e646c6c00",
|
||||
"expect_original": "5753325f33322e646c6c00"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// First 0x60 bytes of the function, masked; a shorter prologue matches dozens of functions.
|
||||
// Contains the "VRFx" archive magic comparison (56 52 46 78), a stable semantic anchor.
|
||||
// Fallback: the first 0x40 bytes are also unique on 2.61.0.37; try them first if this pattern stops matching.
|
||||
// 2.61.0.37: unique hit at 0x4073d30 (function 0x4073d30-0x407497d).
|
||||
{
|
||||
"method": "signature",
|
||||
"section": ".text",
|
||||
"pattern": "41 57 41 56 41 55 41 54 56 57 55 53 48 81 ec 68 01 00 00 0f 29 b4 24 50 01 00 00 48 8b 7a 40 48 85 ff 74 ?? 8b 5a 48 85 db 74 ?? 8b 42 08 83 f8 10 73 ?? 31 c0 0f 28 b4 24 50 01 00 00 48 81 c4 68 01 00 00 5b 5d 5f 5e 41 5c 41 5d 41 5e 41 5f c3 48 89 ce 4c 8b 32 41 81 3e 56 52 46 78 75 ??"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Make the resource archive signature check return success.
|
||||
// Why the executable: rebuilt archives cannot carry a Gaijin signature and are refused at mount time.
|
||||
// Without it: the rebuilt char.vromfs.bin is not mounted and the client never learns the local addresses.
|
||||
{
|
||||
"id": "startup/skip-resource-archive-signature-check",
|
||||
"title": "让资源包签名校验直接返回通过",
|
||||
"features": [
|
||||
"A-离线启动"
|
||||
],
|
||||
"requires": [],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edit": {
|
||||
"offset": 0,
|
||||
"asm": [
|
||||
"mov al, 1",
|
||||
"ret"
|
||||
],
|
||||
"bytes": "b001c3",
|
||||
"expect_original": "415741"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
let res = crewInfo.filter(@(v) v.country == curCountry)
|
||||
if (res.len() == 1)
|
||||
return res.map(
|
||||
@(countryInfo) countryInfo.__merge({
|
||||
crews = countryInfo.crews.map(@(crew) crew.__merge({idCountry = 0}))
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
// Add the extra vehicles the local server chose for a LocalMP battle (nuclear carrier, strike UCAV,
|
||||
// the RandomSpawnUnits tank / SPAA / naval aircraft) to the in-battle crew list.
|
||||
// Why the client: online the battle server adds them to the player's crews; a LocalMP host has no
|
||||
// battle server, and the in-battle crew list comes from the native get_crew_info.
|
||||
// Without it: the lineup holds only the player's own vehicles.
|
||||
{
|
||||
"id": "battle/append-extra-battle-slots",
|
||||
"title": "Add the LocalMP battle's extra vehicles to the in-battle crew list",
|
||||
"file": "scripts/slotbar/crewslist.nut",
|
||||
"features": [
|
||||
"K-补充载具"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
let appendWtoExtraBattleCrews = function(baseCrews) {
|
||||
let { ndbTryRead } = require("nestdb")
|
||||
let wtoBattle = ndbTryRead(["wto", "activeBattle"])
|
||||
let extraSlots = wtoBattle?.extraBattleSlots
|
||||
if (extraSlots == null || extraSlots.len() == 0)
|
||||
return baseCrews
|
||||
if ((wtoBattle?.country ?? "") != "" && wtoBattle.country != curCountry)
|
||||
return baseCrews
|
||||
let merged = [].extend(baseCrews)
|
||||
foreach (idx, slot in extraSlots) {
|
||||
if (merged.len() >= 32)
|
||||
break
|
||||
let unitName = slot?.unitName ?? ""
|
||||
if (unitName == "")
|
||||
continue
|
||||
merged.append({
|
||||
id = -1 - idx
|
||||
idCountry = 0
|
||||
idInCountry = merged.len()
|
||||
country = curCountry
|
||||
aircraft = unitName
|
||||
isEmpty = 0
|
||||
trainedSpec = { [unitName] = 2 }
|
||||
trained = [unitName]
|
||||
skillPoints = 0
|
||||
lockedTillSec = 0
|
||||
isLocked = 0
|
||||
})
|
||||
}
|
||||
return merged
|
||||
}
|
||||
let res = crewInfo.filter(@(v) v.country == curCountry)
|
||||
if (res.len() == 1)
|
||||
return res.map(
|
||||
@(countryInfo) countryInfo.__merge({
|
||||
crews = appendWtoExtraBattleCrews(
|
||||
countryInfo.crews.map(@(crew) crew.__merge({idCountry = 0}))
|
||||
)
|
||||
})
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
function getForcedUnitWeapon(unit) {
|
||||
let groupName = this.getRandomUnitsGroupName(unit.name)
|
||||
if (groupName == null)
|
||||
return this.missionParams?.editSlotbar[unit.shopCountry][unit.name]["forceWeapon"]
|
||||
|
||||
return getRandomUnitsForceWeapon(getEventEconomicName(getRoomEvent()), unit.name)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Lock the weapon preset the local server set for an extra LocalMP vehicle (the nuclear carrier's
|
||||
// bomb, the RandomSpawnUnits forceWeapon of a naval extra aircraft).
|
||||
// Why the client: online the battle server sends the extra vehicles with their weapon; on a LocalMP
|
||||
// host the local server chooses them, and getForcedUnitWeapon only knows mission and room data.
|
||||
// Without it: the extra vehicles spawn with whatever preset the respawn screen picks.
|
||||
{
|
||||
"id": "battle/force-extra-slot-weapons",
|
||||
"title": "Lock the weapon presets of LocalMP extra vehicles",
|
||||
"file": "scripts/miscustomrules/rulebase.nut",
|
||||
"features": [
|
||||
"K-补充载具"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
function getForcedUnitWeapon(unit) {
|
||||
// WTOffline: the extra vehicles the local server added to a LocalMP lineup carry their forced
|
||||
// weapon (nuclear carrier, RandomSpawnUnits forceWeapon); online the battle server sends it.
|
||||
foreach (wtoSlot in (require("nestdb").ndbTryRead(["wto", "activeBattle"])?.extraBattleSlots ?? []))
|
||||
if (wtoSlot?.unitName == unit.name && (wtoSlot?.forceWeapon ?? "") != "")
|
||||
return wtoSlot.forceWeapon
|
||||
let groupName = this.getRandomUnitsGroupName(unit.name)
|
||||
if (groupName == null)
|
||||
return this.missionParams?.editSlotbar[unit.shopCountry][unit.name]["forceWeapon"]
|
||||
|
||||
return getRandomUnitsForceWeapon(getEventEconomicName(getRoomEvent()), unit.name)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
matchingApiFunc("match.enqueue", cb, params)
|
||||
}
|
||||
|
||||
matchingRpcSubscribe("match.notify_clusters_changed", onClustersChanged)
|
||||
@@ -0,0 +1,24 @@
|
||||
// Start a local battle pushed by the local server: rebuild the mission settings it sends and host
|
||||
// the battle as an in-process LocalMP session (select_training_mission + guiStartFlight).
|
||||
// Why the client: the stock queue only ever joins a remote room (connect_to_host_list, peer mode);
|
||||
// nothing in it enters LocalMP, so no answer from the service can start a hosted battle.
|
||||
// Without it: "To Battle!" queues forever.
|
||||
{
|
||||
"id": "battle/launch-local-battle-from-queue",
|
||||
"title": "Launch local authoritative multiplayer battle on queue notification",
|
||||
"file": "scripts/matching/servicenotifications/match.nut",
|
||||
"features": [
|
||||
"J-陆战 街机 / 历史",
|
||||
"J-空战 街机 / 历史",
|
||||
"J-海战 街机 / 历史"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
matchingApiFunc("match.enqueue", cb, params)
|
||||
}
|
||||
|
||||
// WTOffline: rebuild a DataBlock sent by the local server as { p = [[name, type, value]], b = [[name, node]] }.
|
||||
// The type ("t", "i", "r", "b") travels with each value because the engine reads ints and reals with typed getters.
|
||||
function wtoBlkFromWire(blk, node) {
|
||||
foreach (param in (node?.p ?? [])) {
|
||||
let [name, kind, value] = param
|
||||
blk[name] <- kind == "i" ? value.tointeger()
|
||||
: kind == "r" ? value.tofloat()
|
||||
: kind == "b" ? value == true
|
||||
: value.tostring()
|
||||
}
|
||||
foreach (child in (node?.b ?? []))
|
||||
wtoBlkFromWire(blk.addNewBlock(child[0]), child[1])
|
||||
return blk
|
||||
}
|
||||
|
||||
// WTOffline: start a local battle pushed by the local server (mrpc.generic_notify, from = "wto_battle").
|
||||
// The service sends the complete mission settings; the client hosts the battle as a LocalMP session.
|
||||
function onWtoBattleNotify(ev) {
|
||||
if (ev?.func != "launch" || isInFlight())
|
||||
return
|
||||
let DataBlock = require("DataBlock")
|
||||
let { ndbWrite, ndbExists, ndbDelete } = require("nestdb")
|
||||
let guiMis = require("guiMission")
|
||||
let { set_game_mode } = require("mission")
|
||||
let { GM_DOMINATION } = require("%globalScripts/gameModeNativeConsts.nut")
|
||||
let { reset_cur_mission_mode } = require("%appGlobals/ranks_common_shared.nut")
|
||||
let { notifyQueueLeave } = require("%scripts/queue/queueManager.nut")
|
||||
let destroySessionScripted = require("%scripts/matchingRooms/destroySessionScripted.nut")
|
||||
let { invalidateCrewsList } = require("%scripts/slotbar/crewsList.nut")
|
||||
let { guiStartFlight } = require("%scripts/missions/startMissionsList.nut")
|
||||
let { currentCampaignMission } = require("%scripts/missions/missionsStates.nut")
|
||||
let lobbyStates = require("%scripts/matchingRooms/lobbyStates.nut")
|
||||
let { setSessionLobbySettings, switchSessionLobbyStatus } = require("%scripts/matchingRooms/sessionLobbyManager.nut")
|
||||
|
||||
notifyQueueLeave({})
|
||||
destroySessionScripted("on start wto local battle")
|
||||
ndbWrite(["wto", "activeBattle"], ev.battle)
|
||||
if (ndbExists(["wto", "battleLog"]))
|
||||
ndbDelete(["wto", "battleLog"])
|
||||
invalidateCrewsList(true)
|
||||
|
||||
let misBlk = wtoBlkFromWire(DataBlock(), ev.mission)
|
||||
misBlk._gameMode = GM_DOMINATION
|
||||
let lobby = ev.lobby
|
||||
lobby.mission._gameMode <- GM_DOMINATION
|
||||
|
||||
currentCampaignMission.set(misBlk.name)
|
||||
set_game_mode(GM_DOMINATION)
|
||||
setSessionLobbySettings(lobby, true, false)
|
||||
switchSessionLobbyStatus(lobbyStates.IN_SESSION)
|
||||
reset_cur_mission_mode()
|
||||
guiMis.select_training_mission(misBlk)
|
||||
reset_cur_mission_mode()
|
||||
guiStartFlight()
|
||||
}
|
||||
|
||||
// WTOffline: forget the battle record when the session ends outside a battle (left before loading).
|
||||
require("%sqStdLibs/helpers/subscriptions.nut").addListenersWithoutEnv({
|
||||
SessionDestroyed = function(_p) {
|
||||
if (!isInFlight()) {
|
||||
let { ndbExists, ndbDelete } = require("nestdb")
|
||||
if (ndbExists(["wto", "activeBattle"])) {
|
||||
ndbDelete(["wto", "activeBattle"])
|
||||
require("%scripts/slotbar/crewsList.nut").invalidateCrewsList(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require("%scripts/matching/serviceNotifications/mrpc.nut").mnSubscribe("wto_battle", onWtoBattleNotify)
|
||||
|
||||
matchingRpcSubscribe("match.notify_clusters_changed", onClustersChanged)
|
||||
@@ -0,0 +1,7 @@
|
||||
function getCurRank(event) {
|
||||
if (isInSquad())
|
||||
return getRecentSquadMrank()
|
||||
|
||||
let unit = getPlayerCurUnit()
|
||||
return unit == null ? null : getEffectiveMrank(unit, events.getEDiffByEvent(event))
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Decide the extra game modes (night battles and the like) by the lineup's battle rating, also out of a squad.
|
||||
// Why the client: 2.61.0.37 scripts/events/secondGameModesUtils.nut uses the matching server's
|
||||
// battle rating only in a squad and the selected vehicle otherwise; the live game uses the lineup.
|
||||
// Without it: the extra modes follow whichever vehicle is selected.
|
||||
{
|
||||
"id": "battle/lineup-br-for-submodes",
|
||||
"title": "Decide extra game modes by the matching server's lineup battle rating",
|
||||
"file": "scripts/events/secondgamemodesutils.nut",
|
||||
"features": [
|
||||
"J-附加子模式"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
function getCurRank(event) {
|
||||
// WTOffline: also out of a squad, use the battle rating the matching server computed for the
|
||||
// lineup (wtmm_static.calc_ranks, answered by the local server with the lineup's highest
|
||||
// rank), as the live game decides the extra modes by the whole lineup.
|
||||
if (isInSquad() || getRecentSquadMrank() >= 0)
|
||||
return getRecentSquadMrank()
|
||||
|
||||
let unit = getPlayerCurUnit()
|
||||
return unit == null ? null : getEffectiveMrank(unit, events.getEDiffByEvent(event))
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
registerRespondent("get_spawn_score_type_mul", get_spawn_score_type_mul)
|
||||
registerRespondent("get_unit_spawn_score_weapon_mul", get_unit_spawn_score_weapon_mul)
|
||||
@@ -0,0 +1,22 @@
|
||||
// Supply the missing get_max_spawn_score and get_unit_spawn_score callbacks from the battle launch plan.
|
||||
// Fixed support costs (customSpawnScore/persistent_costs) ignore the current weapon multiplier.
|
||||
// Why the client: on a dedicated server these callbacks are server scripts; a LocalMP host has none.
|
||||
// Without it: LocalMP ground realistic starts with zero points and has no base vehicle costs.
|
||||
// aces.exe 2.61.0.37: initSpawnScoreFunction at 0x2e4559, getSpawnScoreFunction at 0x2e2463.
|
||||
{
|
||||
"id": "battle/local-host-spawn-score",
|
||||
"title": "Register the LocalMP host's spawn score callbacks",
|
||||
"file": "scripts/respawn/respawnstate.nut",
|
||||
"features": [
|
||||
"K-出生点数 / 重生"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
let { ndbTryRead } = require("nestdb")
|
||||
let wtoSpawnScore = @() ndbTryRead(["wto", "activeBattle"])?.spawnScore
|
||||
|
||||
function wtoUnitSpawnScoreWeaponMul(unitname, weapon, bulletArray, presetTbl = {}) {
|
||||
let { get_current_mission_info_cached } = require("blkGetters")
|
||||
let persistentCost = get_current_mission_info_cached()?.customSpawnScore?.persistent_costs?[unitname] ?? 0
|
||||
if (persistentCost > 0)
|
||||
return 1.0
|
||||
return get_unit_spawn_score_weapon_mul(unitname, weapon, bulletArray, presetTbl)
|
||||
}
|
||||
|
||||
registerRespondent("get_max_spawn_score", @(_userId, _maxRank) wtoSpawnScore()?.maxScore ?? 0)
|
||||
registerRespondent("get_unit_spawn_score", @(_userId, unitName, _unitRank) wtoSpawnScore()?.unitCosts?[unitName] ?? 0)
|
||||
registerRespondent("get_spawn_score_type_mul", get_spawn_score_type_mul)
|
||||
registerRespondent("get_unit_spawn_score_weapon_mul", wtoUnitSpawnScoreWeaponMul)
|
||||
@@ -0,0 +1 @@
|
||||
if ((filter?.currentRoomOnly ?? false) && !is_user_log_for_current_room(idx))
|
||||
@@ -0,0 +1 @@
|
||||
function isUserlogVisible(blk, filter, idx) {
|
||||
@@ -0,0 +1,29 @@
|
||||
// Let the debriefing of a settled LocalMP battle find that battle's logs: session result, awards,
|
||||
// research breakdown, boosters and wager.
|
||||
// Why the client: every "this battle's logs" query goes through is_user_log_for_current_room
|
||||
// (aces.exe 2.61.0.37 0x1799d30), which compares with the matching room id or GameSaveData+0x3f370;
|
||||
// a LocalMP host is in no matching room, so nothing matches.
|
||||
// Without it: the debriefing shows no research breakdown, awards, used boosters or wager stage.
|
||||
{
|
||||
"id": "battle/match-settled-battle-room-logs",
|
||||
"title": "Match the logs of a settled LocalMP battle by its room id",
|
||||
"file": "scripts/userlog/userlogutils.nut",
|
||||
"features": [
|
||||
"L-结算页",
|
||||
"G-加成道具",
|
||||
"H-合同 / 赌注"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-room-check.nut",
|
||||
"replace": "replace-room-check.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
if ((filter?.currentRoomOnly ?? false) && !isLogOfCurrentRoom(blk, idx))
|
||||
@@ -0,0 +1,9 @@
|
||||
// WTOffline: while the debriefing of a settled LocalMP battle is gathered, nestdb wto.settled names
|
||||
// the battle's room (written by report-local-battle-settlement). The client is in no matching
|
||||
// room, so is_user_log_for_current_room cannot match that room's logs; match them by room id.
|
||||
function isLogOfCurrentRoom(blk, idx) {
|
||||
let settledRoomId = require("nestdb").ndbTryRead(["wto", "settled"])?.roomId
|
||||
return settledRoomId != null ? blk?.roomId == settledRoomId : is_user_log_for_current_room(idx)
|
||||
}
|
||||
|
||||
function isUserlogVisible(blk, filter, idx) {
|
||||
@@ -0,0 +1,41 @@
|
||||
function requestAircraftAndWeapon(requestData) {
|
||||
if (this.requestInProgress)
|
||||
return
|
||||
|
||||
set_aircraft_accepted_cb(this, this.aircraftAcceptedCb);
|
||||
let _taskId = requestAircraftAndWeaponWithSpare(requestData, requestData.idInCountry,
|
||||
requestData.respBaseId, requestData.spareUid)
|
||||
if (_taskId < 0)
|
||||
set_aircraft_accepted_cb(null, null);
|
||||
else {
|
||||
this.requestInProgress = true
|
||||
this.showTaskProgressBox(loc("charServer/purchase0"), function() { this.requestInProgress = false })
|
||||
|
||||
this.lastRequestData = requestData
|
||||
}
|
||||
}
|
||||
|
||||
function requestChangeUnitSilent() {
|
||||
let unit = this.getCurSlotUnit()
|
||||
if (!unit?.isHuman() || !this.canChangeAircraft || this.isApplyPressed) {
|
||||
this.isSilentRequestPending = false
|
||||
return
|
||||
}
|
||||
this.isSilentRequestPending = this.requestInProgress || !canRequestAircraftNow()
|
||||
if (this.isSilentRequestPending)
|
||||
return
|
||||
|
||||
let requestData = this.getSelectedRequestData(true)
|
||||
if (!requestData)
|
||||
return
|
||||
|
||||
set_aircraft_accepted_cb(this, this.silentAircraftAcceptedCb);
|
||||
let _taskId = requestAircraftAndWeaponWithSpare(requestData, requestData.idInCountry,
|
||||
requestData.respBaseId, requestData.spareUid)
|
||||
if (_taskId < 0)
|
||||
set_aircraft_accepted_cb(null, null);
|
||||
else {
|
||||
this.requestInProgress = true
|
||||
this.lastRequestData = requestData
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Send the vehicle's enabled and disabled modifications with every LocalMP spawn request, and count
|
||||
// backup vehicles used for the settlement.
|
||||
// Why the client: the battle server would read the modifications from the profile; on a LocalMP host
|
||||
// the native spawn receiver (wto_ws.dll local_mp_loadout.c) only gets what this request carries.
|
||||
// Without it: every spawned vehicle is stock (no fire extinguisher, smoke, repair kit, upgrades).
|
||||
{
|
||||
"id": "battle/pass-spawn-modifications-blk",
|
||||
"title": "Pass enabled modifications and extra-slot loadout on LocalMP spawn",
|
||||
"file": "scripts/respawn/respawn.nut",
|
||||
"features": [
|
||||
"K-出生点数 / 重生"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
function sendWtoAircraftAndWeaponRequest(requestData, isSilent = false) {
|
||||
let wtoNdb = require("nestdb")
|
||||
if (!wtoNdb.ndbExists(["wto", "activeBattle"]))
|
||||
return requestAircraftAndWeaponWithSpare(requestData, requestData.idInCountry,
|
||||
requestData.respBaseId, requestData.spareUid)
|
||||
let wtoBattle = wtoNdb.ndbTryRead(["wto", "activeBattle"])
|
||||
let wtoGuiRespawn = require("guiRespawn")
|
||||
let wtoChardRes = require("chardResearch")
|
||||
let wtoUnitName = requestData?.name ?? ""
|
||||
local wtoExtraSlot = null
|
||||
foreach (slot in (wtoBattle?.extraBattleSlots ?? [])) {
|
||||
if (slot?.unitName == wtoUnitName) {
|
||||
wtoExtraSlot = slot
|
||||
break
|
||||
}
|
||||
}
|
||||
if ((wtoExtraSlot?.forceWeapon ?? "") != "")
|
||||
requestData.weapon = wtoExtraSlot.forceWeapon
|
||||
let wtoSlotMods = wtoExtraSlot?.modifications ?? []
|
||||
let wtoUnit = getAircraftByName(wtoUnitName) ?? this.getCurSlotUnit()
|
||||
let wtoEnabledMods = []
|
||||
let wtoDisabledMods = []
|
||||
foreach (wtoMod in (wtoUnit?.getModifications() ?? [])) {
|
||||
let wtoModName = wtoMod?.name ?? ""
|
||||
if (wtoModName == "")
|
||||
continue
|
||||
let wtoIsEnabled = wtoExtraSlot == null
|
||||
? wtoChardRes.shopIsModificationEnabled(wtoUnitName, wtoModName)
|
||||
: (wtoExtraSlot?.allModifications == true || wtoSlotMods.contains(wtoModName))
|
||||
if (wtoIsEnabled)
|
||||
wtoEnabledMods.append(wtoModName)
|
||||
else if (wtoExtraSlot == null && wtoChardRes.shopIsModificationPurchased(wtoUnitName, wtoModName))
|
||||
wtoDisabledMods.append(wtoModName)
|
||||
}
|
||||
let wtoBlk = DataBlock()
|
||||
wtoBlk.enabledMods = ";".join(wtoEnabledMods)
|
||||
wtoBlk.disabledMods = ";".join(wtoDisabledMods)
|
||||
wtoBlk.isSilentPreview = isSilent ? "1" : "0"
|
||||
if (!isSilent && (requestData?.spareUid ?? "") != "" && wtoUnitName != "") {
|
||||
let prevSpares = wtoBattle?.usedSpares ?? {}
|
||||
prevSpares[wtoUnitName] <- (prevSpares?[wtoUnitName] ?? 0) + 1
|
||||
wtoBattle.usedSpares <- prevSpares
|
||||
wtoNdb.ndbWrite(["wto", "activeBattle"], wtoBattle)
|
||||
}
|
||||
return wtoGuiRespawn.requestAircraftAndWeaponWithSlots(requestData, requestData.idInCountry,
|
||||
requestData.respBaseId, requestData.spareUid, wtoBlk, DataBlock())
|
||||
}
|
||||
|
||||
function requestAircraftAndWeapon(requestData) {
|
||||
if (this.requestInProgress)
|
||||
return
|
||||
|
||||
set_aircraft_accepted_cb(this, this.aircraftAcceptedCb);
|
||||
let _taskId = this.sendWtoAircraftAndWeaponRequest(requestData, false)
|
||||
if (_taskId < 0)
|
||||
set_aircraft_accepted_cb(null, null);
|
||||
else {
|
||||
this.requestInProgress = true
|
||||
this.showTaskProgressBox(loc("charServer/purchase0"), function() { this.requestInProgress = false })
|
||||
|
||||
this.lastRequestData = requestData
|
||||
}
|
||||
}
|
||||
|
||||
function requestChangeUnitSilent() {
|
||||
let unit = this.getCurSlotUnit()
|
||||
if (!unit?.isHuman() || !this.canChangeAircraft || this.isApplyPressed) {
|
||||
this.isSilentRequestPending = false
|
||||
return
|
||||
}
|
||||
this.isSilentRequestPending = this.requestInProgress || !canRequestAircraftNow()
|
||||
if (this.isSilentRequestPending)
|
||||
return
|
||||
|
||||
let requestData = this.getSelectedRequestData(true)
|
||||
if (!requestData)
|
||||
return
|
||||
|
||||
set_aircraft_accepted_cb(this, this.silentAircraftAcceptedCb);
|
||||
let _taskId = this.sendWtoAircraftAndWeaponRequest(requestData, true)
|
||||
if (_taskId < 0)
|
||||
set_aircraft_accepted_cb(null, null);
|
||||
else {
|
||||
this.requestInProgress = true
|
||||
this.lastRequestData = requestData
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
if (is_multiplayer())
|
||||
return leave_mp_session()
|
||||
@@ -0,0 +1,22 @@
|
||||
// Leave a LocalMP battle from the respawn or spectator screen to the debriefing (quitMission in starthud.nut).
|
||||
// Why the client: quitMission calls leave_mp_session for every multiplayer session, and the native
|
||||
// leave_mp_session (0x17909a0) returns at once on a host.
|
||||
// Without it: "Return to hangar" on the respawn or spectator screen does nothing.
|
||||
// Kept from the baseline; not re-reviewed in the LocalMP rework.
|
||||
{
|
||||
"id": "battle/quit-local-host-spectator-to-debriefing",
|
||||
"title": "Quit a LocalMP battle from the respawn screen to the debriefing",
|
||||
"file": "scripts/hud/starthud.nut",
|
||||
"features": [
|
||||
"L-结算页"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
if (is_multiplayer() && !require("multiplayer").is_mplayer_host())
|
||||
return leave_mp_session()
|
||||
@@ -0,0 +1,29 @@
|
||||
function sendDisconnectMessage() {
|
||||
broadcastEvent("PlayerQuitMission")
|
||||
if (is_multiplayer()) {
|
||||
leave_mp_session()
|
||||
this.onResumeRaw()
|
||||
}
|
||||
else
|
||||
this.quitToDebriefing()
|
||||
}
|
||||
|
||||
function quitToDebriefing() {
|
||||
disableOrders()
|
||||
quit_to_debriefing()
|
||||
interrupt_multiplayer(true)
|
||||
HudBattleLog.reset()
|
||||
this.onResumeRaw()
|
||||
}
|
||||
|
||||
function onQuitMission(_obj) {
|
||||
if (is_offline_version() && !ludeo?.is_running())
|
||||
return restart_mission()
|
||||
|
||||
if (is_replay_playing()) {
|
||||
this.quitToDebriefing()
|
||||
}
|
||||
else if (get_mission_status() == MISSION_STATUS_RUNNING) {
|
||||
local text = ""
|
||||
if (is_mplayer_host())
|
||||
text = loc("flightmenu/questionQuitMissionHost")
|
||||
@@ -0,0 +1,23 @@
|
||||
// In a LocalMP random battle show the normal quit confirmation (crews left, early leave) instead of the
|
||||
// custom-room host warning, and quit to the debriefing on confirm (flightmenu.nut).
|
||||
// Why the client: the flight menu tests is_mplayer_host before GM_DOMINATION, and the native
|
||||
// leave_mp_session (0x17909a0) returns at once on a host.
|
||||
// Without it: Esc -> Return to hangar shows the host warning and cannot leave the battle.
|
||||
// Kept from the baseline; not re-reviewed in the LocalMP rework.
|
||||
{
|
||||
"id": "battle/quit-local-host-to-debriefing",
|
||||
"title": "Quit a LocalMP battle from the flight menu to the debriefing",
|
||||
"file": "scripts/flightmenu/flightmenu.nut",
|
||||
"features": [
|
||||
"L-结算页"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
function sendDisconnectMessage() {
|
||||
broadcastEvent("PlayerQuitMission")
|
||||
if (is_multiplayer() && !is_mplayer_host()) {
|
||||
leave_mp_session()
|
||||
this.onResumeRaw()
|
||||
}
|
||||
else
|
||||
this.quitToDebriefing()
|
||||
}
|
||||
|
||||
function quitToDebriefing() {
|
||||
disableOrders()
|
||||
quit_to_debriefing()
|
||||
interrupt_multiplayer(true)
|
||||
// The LocalMP debriefing can still show this log after the host has stopped.
|
||||
if (require("nestdb").ndbTryRead(["wto", "activeBattle"]) == null)
|
||||
HudBattleLog.reset()
|
||||
this.onResumeRaw()
|
||||
}
|
||||
|
||||
function onQuitMission(_obj) {
|
||||
if (is_offline_version() && !ludeo?.is_running())
|
||||
return restart_mission()
|
||||
|
||||
if (is_replay_playing()) {
|
||||
this.quitToDebriefing()
|
||||
}
|
||||
else if (get_mission_status() == MISSION_STATUS_RUNNING) {
|
||||
local text = ""
|
||||
if (is_mplayer_host() && get_game_mode() != GM_DOMINATION)
|
||||
text = loc("flightmenu/questionQuitMissionHost")
|
||||
@@ -0,0 +1,24 @@
|
||||
g_mis_loading_state.isReadyToShowRespawn <- function isReadyToShowRespawn() {
|
||||
return (getCurState() & MIS_LOAD.RESPAWN_DATA_LOADED) == MIS_LOAD.RESPAWN_DATA_LOADED
|
||||
}
|
||||
|
||||
g_mis_loading_state.isCrewsListReceived <- function isCrewsListReceived() {
|
||||
return (getCurState() & MIS_LOAD.ECONOMIC_STATE) != 0
|
||||
}
|
||||
|
||||
g_mis_loading_state.onEventUpdateEsFromHost <- function onEventUpdateEsFromHost(_p) {
|
||||
if (getCurState() & MIS_LOAD.ECONOMIC_STATE)
|
||||
return
|
||||
|
||||
log("misLoadState: received initial economicState")
|
||||
setCurState(getCurState() | MIS_LOAD.ECONOMIC_STATE)
|
||||
this.checkRespawnBases()
|
||||
}
|
||||
|
||||
g_mis_loading_state.onEventLoadingStateChange <- function onEventLoadingStateChange(_p) {
|
||||
if (!isInFlight()) {
|
||||
if (getCurState() != 0)
|
||||
log("misLoadState: reset mision loading state")
|
||||
setCurState(0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Mark the economic state ready on a LocalMP host and re-check the spawn bases, so the respawn screen opens.
|
||||
// Why the client: misloadingstate.nut waits for on_update_es_from_host, which only the battle server's sync
|
||||
// packet raises; a LocalMP host sends no such packet to itself.
|
||||
// Without it: the battle stays on "Waiting for the server..." and the crew list never appears.
|
||||
// Kept from the baseline; not re-reviewed in the LocalMP rework.
|
||||
{
|
||||
"id": "battle/ready-local-host-respawn",
|
||||
"title": "Open the respawn screen on a LocalMP host",
|
||||
"file": "scripts/respawn/misloadingstate.nut",
|
||||
"features": [
|
||||
"K-出生点数 / 重生"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
function syncWtoLocalHostLoadingState() {
|
||||
if (!isInFlight() || !require("multiplayer").is_mplayer_host())
|
||||
return
|
||||
if (!(getCurState() & MIS_LOAD.ECONOMIC_STATE))
|
||||
setCurState(getCurState() | MIS_LOAD.ECONOMIC_STATE)
|
||||
if (!(getCurState() & MIS_LOAD.RESPAWN_BASES)) {
|
||||
g_mis_loading_state.checkRespawnBases()
|
||||
if (getCurState() & MIS_LOAD.RESPAWN_BASES)
|
||||
require("dagor.workcycle").defer(@() broadcastEvent("ChangedMissionRespawnBasesStatus"))
|
||||
}
|
||||
}
|
||||
|
||||
g_mis_loading_state.isReadyToShowRespawn <- function isReadyToShowRespawn() {
|
||||
syncWtoLocalHostLoadingState()
|
||||
return (getCurState() & MIS_LOAD.RESPAWN_DATA_LOADED) == MIS_LOAD.RESPAWN_DATA_LOADED
|
||||
}
|
||||
|
||||
g_mis_loading_state.isCrewsListReceived <- function isCrewsListReceived() {
|
||||
syncWtoLocalHostLoadingState()
|
||||
return (getCurState() & MIS_LOAD.ECONOMIC_STATE) != 0
|
||||
}
|
||||
|
||||
g_mis_loading_state.onEventUpdateEsFromHost <- function onEventUpdateEsFromHost(_p) {
|
||||
if (getCurState() & MIS_LOAD.ECONOMIC_STATE)
|
||||
return
|
||||
|
||||
log("misLoadState: received initial economicState")
|
||||
setCurState(getCurState() | MIS_LOAD.ECONOMIC_STATE)
|
||||
this.checkRespawnBases()
|
||||
}
|
||||
|
||||
g_mis_loading_state.onEventLoadingStateChange <- function onEventLoadingStateChange(_p) {
|
||||
if (!isInFlight()) {
|
||||
if (getCurState() != 0)
|
||||
log("misLoadState: reset mision loading state")
|
||||
setCurState(0)
|
||||
}
|
||||
else
|
||||
syncWtoLocalHostLoadingState()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
g_hud_reward_message
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Record the local player's lives, combat events, the battle's kill log and how the battle ended
|
||||
// in a LocalMP battle, show the reward banner, and pass each fact to the local server live to
|
||||
// show the battle awards (streaks) it completes.
|
||||
// Why the client: online the battle server prices each event, judges the awards and sends both
|
||||
// banners (packet 0xb03d, streak messages); a LocalMP host has no battle server, so the native
|
||||
// bridge reports the facts as the HUD event "wtoLocalMpExpEvent" and only the client sees spawns,
|
||||
// deaths and the kill log.
|
||||
// Without it: no reward or award banners in battle and nothing to settle after it.
|
||||
{
|
||||
"id": "battle/record-local-battle-awards",
|
||||
"title": "Record LocalMP battle facts and show their reward and award banners",
|
||||
"file": "scripts/hud/hudrewardmessage.nut",
|
||||
"features": [
|
||||
"K-击杀、助攻、占点计分",
|
||||
"L-战斗奖章"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
// WTOffline: record the local player's lives and combat events in a LocalMP battle and show the
|
||||
// reward banner. A LocalMP host has no battle server to price events: the native bridge raises the
|
||||
// HUD event "wtoLocalMpExpEvent" with the facts, the banner amount comes from the parameters the
|
||||
// local server sent at launch (nestdb wto.activeBattle.awards, battle-economy.ts BannerParams), and
|
||||
// the record (nestdb wto.battleLog) is settled by the local server after the battle.
|
||||
// Each fact is also sent to the local server as it happens (matching request wto_battle.fact);
|
||||
// the battle awards (streaks) it completed come back and are shown with the stock award banner,
|
||||
// as the battle server's award messages are online.
|
||||
function wtoShowLiveStreaks(resp) {
|
||||
let streaks = resp?.streaks ?? []
|
||||
if (streaks.len() == 0)
|
||||
return
|
||||
let { add_streak_message, getLocForStreak } = require("%scripts/streaks.nut")
|
||||
let { SNT_MY_STREAK_HEADER } = require("%globalScripts/battleMetaConsts.nut")
|
||||
let { HUD_MSG_STREAK } = require("hudMessages")
|
||||
let { g_hud_event_manager } = require("%scripts/hud/hudEventManager.nut")
|
||||
let localId = require("mission").get_local_mplayer()?.id ?? -1
|
||||
foreach (streak in streaks) {
|
||||
let stageParam = streak?.stageParam ?? 0
|
||||
add_streak_message({
|
||||
header = getLocForStreak(SNT_MY_STREAK_HEADER, streak.id, stageParam)
|
||||
wp = streak?.wp ?? 0
|
||||
exp = streak?.exp ?? 0
|
||||
id = streak.id
|
||||
})
|
||||
g_hud_event_manager.onHudEvent("HudMessage", { type = HUD_MSG_STREAK, unlockId = streak.id, stage = stageParam, playerId = localId })
|
||||
}
|
||||
}
|
||||
|
||||
function wtoSendLiveFact(kind, fact) {
|
||||
let battle = require("nestdb").ndbTryRead(["wto", "activeBattle"])
|
||||
if (battle == null)
|
||||
return
|
||||
let { matchingApiFunc } = require("%scripts/matching/api.nut")
|
||||
matchingApiFunc("wto_battle.fact", wtoShowLiveStreaks, fact.__merge({
|
||||
sessionId = battle.sessionId
|
||||
kind
|
||||
localPlayerId = require("mission").get_local_mplayer()?.id ?? -1
|
||||
localTeam = require("mission").get_mp_local_team()
|
||||
}))
|
||||
}
|
||||
|
||||
function wtoAppendBattleLog(key, entry) {
|
||||
let { ndbTryRead, ndbWrite } = require("nestdb")
|
||||
let list = (ndbTryRead(["wto", "battleLog", key]) ?? []).map(@(v) v)
|
||||
list.append(entry)
|
||||
ndbWrite(["wto", "battleLog", key], list)
|
||||
}
|
||||
|
||||
function wtoBannerReward(awards, unit, ev) {
|
||||
let code = ev?.messageCode ?? -1
|
||||
let isCapture = code == EXP_EVENT_CAPTURE_ZONE
|
||||
let expClass = ev?.expClass ?? ""
|
||||
let group = isCapture ? "own" : (awards?.groups?[expClass] ?? "ground")
|
||||
let baseReward = awards?.vehicles?[unit]?[$"{code}:{group}"]
|
||||
if (baseReward == null)
|
||||
return null
|
||||
let ai = (isCapture || (ev?.victimIsPlayer ?? 0) != 0) ? 1.0 : awards.aiKillK
|
||||
let slClass = isCapture ? 1.0 : (awards?.slClass?[expClass] ?? 1.0)
|
||||
let rpClass = isCapture ? 1.0 : (awards?.rpClass?[expClass] ?? 1.0)
|
||||
if ((ev?.friendly ?? 0) != 0)
|
||||
return { wp = -(baseReward[0] * slClass * ai * awards.friendlyKillPenaltyMul + 0.5).tointeger(), exp = 0 }
|
||||
let count = code == EXP_EVENT_UNIT_DAMAGE ? (ev?.damage ?? 0) : 1
|
||||
return {
|
||||
wp = (baseReward[0] * slClass * ai * count + 0.5).tointeger()
|
||||
exp = (baseReward[1] * rpClass * ai * count + 0.5).tointeger()
|
||||
}
|
||||
}
|
||||
|
||||
function wtoOnLocalMpExpEvent(ev) {
|
||||
let { ndbTryRead } = require("nestdb")
|
||||
let battle = ndbTryRead(["wto", "activeBattle"])
|
||||
if (battle == null)
|
||||
return
|
||||
let wtoMission = require("mission")
|
||||
let unit = ndbTryRead(["wto", "battleLog", "openLife"])?.unit ?? require("unit").get_player_unit_name()
|
||||
let entry = {
|
||||
time = wtoMission.get_mission_time()
|
||||
unit
|
||||
code = ev?.messageCode ?? -1
|
||||
expClass = ev?.expClass ?? ""
|
||||
victim = ev?.victim ?? ""
|
||||
victimIsPlayer = (ev?.victimIsPlayer ?? 0) != 0
|
||||
friendly = (ev?.friendly ?? 0) != 0
|
||||
modifier = ev?.messageModifier ?? ""
|
||||
damage = ev?.damage ?? 0
|
||||
}
|
||||
wtoAppendBattleLog("events", entry)
|
||||
wtoSendLiveFact("event", entry)
|
||||
let reward = wtoBannerReward(battle?.awards, unit, ev)
|
||||
if (reward == null)
|
||||
return
|
||||
let { g_hud_event_manager } = require("%scripts/hud/hudEventManager.nut")
|
||||
g_hud_event_manager.onHudEvent("InBattleReward", {
|
||||
messageCode = ev?.messageCode ?? -1
|
||||
warpoints = reward.wp
|
||||
experience = reward.exp
|
||||
counter = 1
|
||||
expClass = ev?.expClass ?? ""
|
||||
messageModifier = ev?.messageModifier ?? ""
|
||||
})
|
||||
}
|
||||
|
||||
function wtoCloseBattleLife(died) {
|
||||
let { ndbTryRead, ndbDelete } = require("nestdb")
|
||||
let life = ndbTryRead(["wto", "battleLog", "openLife"])
|
||||
if (life == null)
|
||||
return
|
||||
ndbDelete(["wto", "battleLog", "openLife"])
|
||||
let closed = life.__merge({ end = require("mission").get_mission_time(), died })
|
||||
wtoAppendBattleLog("lives", closed)
|
||||
wtoSendLiveFact("life", closed)
|
||||
}
|
||||
|
||||
function wtoOnLocalPlayerAlive(_ev) {
|
||||
let { ndbExists, ndbWrite } = require("nestdb")
|
||||
if (!ndbExists(["wto", "activeBattle"]))
|
||||
return
|
||||
wtoCloseBattleLife(false)
|
||||
let unit = require("unit").get_player_unit_name()
|
||||
if ((unit ?? "") != "")
|
||||
ndbWrite(["wto", "battleLog", "openLife"], { unit, start = require("mission").get_mission_time() })
|
||||
}
|
||||
|
||||
function wtoOnLocalPlayerDead(_ev) {
|
||||
if (require("nestdb").ndbExists(["wto", "activeBattle"]))
|
||||
wtoCloseBattleLife(true)
|
||||
}
|
||||
|
||||
// Every kill of the HUD kill log, for the awards that depend on who killed whom (first kill,
|
||||
// avenging). A message without player ids is about the local player (scripts/hud/hudBattleLog.nut).
|
||||
function wtoOnHudMessage(msg) {
|
||||
let { HUD_MSG_MULTIPLAYER_DMG } = require("hudMessages")
|
||||
if (msg?.type != HUD_MSG_MULTIPLAYER_DMG || !(msg?.isKill ?? true))
|
||||
return
|
||||
if (!require("nestdb").ndbExists(["wto", "activeBattle"]))
|
||||
return
|
||||
let wtoMission = require("mission")
|
||||
let localId = wtoMission.get_local_mplayer()?.id ?? -1
|
||||
let localTeam = wtoMission.get_mp_local_team()
|
||||
let killer = msg?.playerId ?? localId
|
||||
let victim = msg?.victimPlayerId ?? localId
|
||||
let kill = {
|
||||
time = wtoMission.get_mission_time()
|
||||
killer
|
||||
killerTeam = msg?.team ?? (killer == localId ? localTeam : 0)
|
||||
victim
|
||||
victimTeam = msg?.victimTeam ?? (victim == localId ? localTeam : 0)
|
||||
}
|
||||
wtoAppendBattleLog("feed", kill)
|
||||
wtoSendLiveFact("kill", kill)
|
||||
}
|
||||
|
||||
// The local player's nuclear bomb exploded (raised by the native bridge, local_mp_nuke.c).
|
||||
function wtoOnLocalMpNuclearStrike(_ev) {
|
||||
if (!require("nestdb").ndbExists(["wto", "activeBattle"]))
|
||||
return
|
||||
let strike = { time = require("mission").get_mission_time() }
|
||||
wtoAppendBattleLog("strikes", strike)
|
||||
wtoSendLiveFact("strike", strike)
|
||||
}
|
||||
|
||||
function wtoSubscribeBattleAwards() {
|
||||
let { g_hud_event_manager } = require("%scripts/hud/hudEventManager.nut")
|
||||
g_hud_event_manager.subscribe("wtoLocalMpExpEvent", wtoOnLocalMpExpEvent)
|
||||
g_hud_event_manager.subscribe("LocalPlayerAlive", wtoOnLocalPlayerAlive)
|
||||
g_hud_event_manager.subscribe("LocalPlayerDead", wtoOnLocalPlayerDead)
|
||||
g_hud_event_manager.subscribe("HudMessage", wtoOnHudMessage)
|
||||
g_hud_event_manager.subscribe("wtoLocalMpNuclearStrike", wtoOnLocalMpNuclearStrike)
|
||||
}
|
||||
|
||||
// The local player leaves the battle, after its end (the fade to the debriefing) or from the menu
|
||||
// before it. The mission still exists here and is unloaded before the debriefing opens, so this is
|
||||
// where the settlement report gets the end time and the outcome, as the stock debriefing gathers
|
||||
// its result on this event (debriefingFull.nut). Leaving a running battle records no outcome.
|
||||
function wtoOnQuitToDebriefing(_p) {
|
||||
let { ndbExists, ndbWrite } = require("nestdb")
|
||||
if (!ndbExists(["wto", "activeBattle"]) || ndbExists(["wto", "battleLog", "sessionEnd"]))
|
||||
return
|
||||
wtoCloseBattleLife(false)
|
||||
ndbWrite(["wto", "battleLog", "sessionEnd"], require("mission").get_mission_time())
|
||||
let guiMis = require("guiMission")
|
||||
let status = guiMis.get_mission_status()
|
||||
if (status == guiMis.MISSION_STATUS_SUCCESS || status == guiMis.MISSION_STATUS_FAIL)
|
||||
ndbWrite(["wto", "battleLog", "outcome"], status == guiMis.MISSION_STATUS_SUCCESS ? "win" : "lose")
|
||||
}
|
||||
|
||||
wtoSubscribeBattleAwards()
|
||||
require("%sqStdLibs/helpers/subscriptions.nut").add_event_listener("HudEventManagerReset", @(_p) wtoSubscribeBattleAwards())
|
||||
require("eventbus").eventbus_subscribe("onQuitToDebriefing", wtoOnQuitToDebriefing)
|
||||
|
||||
return {
|
||||
g_hud_reward_message
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
let isSingleRow = visible < 3
|
||||
@@ -0,0 +1,3 @@
|
||||
function guiStartDebriefingFull(params = {}) {
|
||||
loadHandler(get_gui_handler("DebriefingModal"), params)
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Report a finished LocalMP battle to the local server (cln_wto_finish_battle) and open the
|
||||
// debriefing with the statistics it settled.
|
||||
// Why the client: online the battle server reports the battle to the char server by itself; on a
|
||||
// LocalMP host only the client knows the battle has ended, and there is no stock char action for it.
|
||||
// Without it: battles pay nothing and the debriefing stays empty.
|
||||
{
|
||||
"id": "battle/report-local-battle-settlement",
|
||||
"title": "Report LocalMP battle facts to local server and show the settled debriefing",
|
||||
"file": "scripts/debriefing/debriefingmodal.nut",
|
||||
"features": [
|
||||
"L-结算页",
|
||||
"L-战斗奖章"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-summary-layout.nut",
|
||||
"replace": "replace-summary-layout.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
let isSingleRow = this.debriefingResult?.wtoSettled == true || visible < 3
|
||||
@@ -0,0 +1,125 @@
|
||||
// WTOffline: report a finished LocalMP battle to the local server as facts (lives and combat events
|
||||
// recorded by record-local-battle-awards, the outcome and the team scores), then build the debriefing
|
||||
// from the statistics the service settled (see use-settled-debriefing-stats). The client computes
|
||||
// no rewards itself.
|
||||
function buildWtoBattleReport(wtoBattle, res) {
|
||||
let { ndbTryRead } = require("nestdb")
|
||||
let battleLog = ndbTryRead(["wto", "battleLog"]) ?? {}
|
||||
let blk = DataBlock()
|
||||
blk.sessionId = wtoBattle.sessionId
|
||||
// Recorded when the battle ended (record-local-battle-awards); none when it was left before.
|
||||
blk.outcome = battleLog?.outcome ?? "running"
|
||||
blk.localTeam = (res?.localTeam ?? 1).tointeger()
|
||||
blk.teamAScore = (res?.mpTblTeams?[0]?.score ?? 0).tointeger()
|
||||
blk.teamBScore = (res?.mpTblTeams?[1]?.score ?? 0).tointeger()
|
||||
let lives = battleLog?.lives ?? []
|
||||
let sessionEnd = battleLog?.sessionEnd ?? lives.reduce(@(acc, life) life.end > acc ? life.end : acc, 0.0)
|
||||
blk.sessionStart = 0.0
|
||||
blk.sessionEnd = sessionEnd.tofloat()
|
||||
blk.localPlayerId = (require("mission").get_local_mplayer()?.id ?? -1).tointeger()
|
||||
let livesBlk = blk.addNewBlock("lives")
|
||||
foreach (life in lives) {
|
||||
let lifeBlk = livesBlk.addNewBlock("life")
|
||||
lifeBlk.unit = life.unit
|
||||
lifeBlk.start = life.start.tofloat()
|
||||
lifeBlk.end = life.end.tofloat()
|
||||
lifeBlk.died = life?.died ?? false
|
||||
}
|
||||
let feedBlk = blk.addNewBlock("feed")
|
||||
foreach (kill in (battleLog?.feed ?? [])) {
|
||||
let killBlk = feedBlk.addNewBlock("k")
|
||||
killBlk.time = kill.time.tofloat()
|
||||
foreach (key in ["killer", "killerTeam", "victim", "victimTeam"])
|
||||
killBlk[key] = kill[key].tointeger()
|
||||
}
|
||||
// The final scoreboard, for the awards given to the best player of the battle.
|
||||
let playersBlk = blk.addNewBlock("players")
|
||||
foreach (player in (res?.mplayers_list ?? [])) {
|
||||
let playerBlk = playersBlk.addNewBlock("p")
|
||||
playerBlk.id = (player?.id ?? -1).tointeger()
|
||||
playerBlk.team = (player?.team ?? 0).tointeger()
|
||||
foreach (key in ["score", "kills", "groundKills", "humanKills", "navalKills", "aiKills", "aiGroundKills",
|
||||
"aiNavalKills", "assists", "deaths"])
|
||||
playerBlk[key] = (player?[key] ?? 0).tointeger()
|
||||
}
|
||||
let eventsBlk = blk.addNewBlock("events")
|
||||
foreach (ev in (battleLog?.events ?? [])) {
|
||||
let evBlk = eventsBlk.addNewBlock("e")
|
||||
evBlk.time = ev.time.tofloat()
|
||||
evBlk.unit = ev.unit
|
||||
evBlk.code = ev.code.tointeger()
|
||||
evBlk.expClass = ev.expClass
|
||||
evBlk.victim = ev.victim
|
||||
evBlk.victimIsPlayer = ev.victimIsPlayer
|
||||
evBlk.friendly = ev.friendly
|
||||
evBlk.modifier = ev.modifier
|
||||
evBlk.damage = ev.damage.tointeger()
|
||||
}
|
||||
let strikesBlk = blk.addNewBlock("strikes")
|
||||
foreach (strike in (battleLog?.strikes ?? [])) {
|
||||
let strikeBlk = strikesBlk.addNewBlock("s")
|
||||
strikeBlk.time = strike.time.tofloat()
|
||||
}
|
||||
let sparesBlk = blk.addNewBlock("spares")
|
||||
foreach (spUnit, spCnt in (wtoBattle?.usedSpares ?? {}))
|
||||
if (spUnit != "" && spCnt > 0)
|
||||
sparesBlk[spUnit] = spCnt.tointeger()
|
||||
return blk
|
||||
}
|
||||
|
||||
function applyWtoSettledDebriefing(wtoBattle) {
|
||||
let { ndbWrite, ndbDelete } = require("nestdb")
|
||||
let sessionLog = getUserLogsList({ show = [EULT_SESSION_RESULT], disableVisible = true })
|
||||
.findvalue(@(l) l?.wtoSessionId == wtoBattle.sessionId)
|
||||
if (sessionLog?.wtoDebriefing == null)
|
||||
return
|
||||
let evObj = events.getEvent(wtoBattle?.modeName ?? "")
|
||||
let roomEvent = evObj == null ? null : {
|
||||
name = evObj?.name
|
||||
economicName = evObj?.economicName
|
||||
difficulty = evObj?.difficulty
|
||||
chapter = evObj?.chapter
|
||||
gameModeId = evObj?.gameModeId
|
||||
}
|
||||
ndbWrite(["wto", "settled"], {
|
||||
exp = sessionLog.wtoDebriefing
|
||||
roomId = sessionLog.roomId
|
||||
win = sessionLog?.win ?? false
|
||||
roomEvent
|
||||
})
|
||||
gatherDebriefingResult()
|
||||
ndbDelete(["wto", "settled"])
|
||||
}
|
||||
|
||||
function settleWtoBattleAndOpen(wtoBattle, params) {
|
||||
let { charSendBlk } = require("chard")
|
||||
let { addTask } = require("%scripts/tasker.nut")
|
||||
let openModal = function() {
|
||||
updateGamercards()
|
||||
loadHandler(get_gui_handler("DebriefingModal"), params)
|
||||
}
|
||||
let onSuccess = function() {
|
||||
applyWtoSettledDebriefing(wtoBattle)
|
||||
openModal()
|
||||
}
|
||||
let taskId = charSendBlk("cln_wto_finish_battle", buildWtoBattleReport(wtoBattle, getDebriefingResult()))
|
||||
if (taskId < 0 || !addTask(taskId, { showProgressBox = true, showErrorMsgBox = true }, onSuccess, @(_) openModal()))
|
||||
openModal()
|
||||
}
|
||||
|
||||
function guiStartDebriefingFull(params = {}) {
|
||||
let { ndbTryRead, ndbDelete } = require("nestdb")
|
||||
let wtoBattle = ndbTryRead(["wto", "activeBattle"])
|
||||
if (wtoBattle != null) {
|
||||
ndbDelete(["wto", "activeBattle"])
|
||||
if (getDebriefingResult() == null)
|
||||
gatherDebriefingResult()
|
||||
let curMis = getDebriefingResult()?.missionName ?? ""
|
||||
let expectedMis = wtoBattle?.missionName ?? ""
|
||||
if (get_game_mode() == GM_DOMINATION && (expectedMis == "" || curMis == expectedMis)) {
|
||||
settleWtoBattleAndOpen(wtoBattle, params)
|
||||
return
|
||||
}
|
||||
}
|
||||
loadHandler(get_gui_handler("DebriefingModal"), params)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
let country = useOperatorFlagsInBattle ? unit.getOperatorCountry() : getCountryOverride(getUnitCountry(unit))
|
||||
u.appendOnce(getCountryFlagSubstitute(country), countries, true)
|
||||
}
|
||||
return countries
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Show the battle's configured countries as a team's flags on the scoreboard while none of its players has a vehicle.
|
||||
// Why the client: scripts/statistics/mpStatistics.nut getCountriesByTeam derives flags only from the
|
||||
// players' living vehicles, which nobody has before the first spawn (offline design: the live
|
||||
// game's look during the countdown cannot be checked).
|
||||
// Without it: no team flags during the start countdown.
|
||||
{
|
||||
"id": "battle/scoreboard-team-country-flags",
|
||||
"title": "Fall back to the battle's countries for scoreboard flags before anyone spawns",
|
||||
"file": "scripts/statistics/mpstatistics.nut",
|
||||
"features": [
|
||||
"K-计分板"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
let country = useOperatorFlagsInBattle ? unit.getOperatorCountry() : getCountryOverride(getUnitCountry(unit))
|
||||
u.appendOnce(getCountryFlagSubstitute(country), countries, true)
|
||||
}
|
||||
if (countries.len() == 0) {
|
||||
let roomKey = team == Team.B ? "country_axis" : "country_allies"
|
||||
foreach (country in getSessionLobbyPublicParam(roomKey, []))
|
||||
u.appendOnce(getCountryFlagSubstitute(getCountryOverride(country)), countries, true)
|
||||
}
|
||||
return countries
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
foreach (btnId in this.mainButtonsId) {
|
||||
let buttonSelectObj = setColoredDoubleTextToButton(this.scene.findObject("nav-help"), btnId, this.applyText)
|
||||
@@ -0,0 +1,22 @@
|
||||
// Keep the respawn countdown in the "Cancel" button text whenever the button text is rebuilt.
|
||||
// Why the client: on a LocalMP host updateApplyText (scripts/respawn/respawn.nut) runs again during
|
||||
// the countdown and resets the text to "Cancel", which updateCountdown turns back into "Cancel (N s)"
|
||||
// on the next frame; the trigger on the host is not yet known.
|
||||
// Without it: the button flickers between "Cancel" and "Cancel (N s)" while waiting to spawn.
|
||||
{
|
||||
"id": "battle/stabilize-respawn-countdown-button",
|
||||
"title": "Keep the respawn countdown in the rebuilt Cancel button text",
|
||||
"file": "scripts/respawn/respawn.nut",
|
||||
"features": [
|
||||
"K-出生点数 / 重生"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
local mainBtnText = this.applyText
|
||||
if (!this.stayOnRespScreen && this.readyForRespawn && this.isApplyPressed) {
|
||||
let countdown = get_mp_respawn_countdown()
|
||||
if (countdown > 0)
|
||||
mainBtnText = "".concat(mainBtnText, loc("ui/parentheses/space", { text = "".concat(countdown, loc("mainmenu/seconds")) }))
|
||||
}
|
||||
|
||||
foreach (btnId in this.mainButtonsId) {
|
||||
let buttonSelectObj = setColoredDoubleTextToButton(this.scene.findObject("nav-help"), btnId, mainBtnText)
|
||||
@@ -0,0 +1,9 @@
|
||||
debriefingResult.country <- get_local_player_country()
|
||||
debriefingResult.localTeam <- get_mp_local_team()
|
||||
debriefingResult.friendlyTeam <- get_player_army_for_hud()
|
||||
debriefingResult.haveTeamkills <- debriefingResultHaveTeamkills()
|
||||
debriefingResult.activeBoosters <- getDebriefingActiveBoosters()
|
||||
debriefingResult.activeWager <- getDebriefingActiveWager()
|
||||
debriefingResult.eventId <- getDebriefingEventId()
|
||||
debriefingResult.chatLog <- getGameChatLogText()
|
||||
debriefingResult.logForBanhammer <- getLogForBanhammer()
|
||||
@@ -0,0 +1,12 @@
|
||||
function gatherDebriefingResult() {
|
||||
let gm = get_game_mode()
|
||||
let gameType = get_game_type()
|
||||
if (gm == GM_DYNAMIC)
|
||||
dynamicResult = dynamicApplyStatus()
|
||||
|
||||
debriefingResult = {
|
||||
roomUserlogs = getUserLogsList({
|
||||
currentRoomOnly = true
|
||||
needStackItems = false
|
||||
disableVisible = true
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
let exp = stat_get_exp() ?? {}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Build the debriefing of a settled LocalMP battle from the statistics table the local server
|
||||
// settled, using the multiplayer state captured while leaving the battle.
|
||||
// Why the client: the debriefing reads stat_get_exp() (aces.exe 0x1053b70, the battle's
|
||||
// SessionStatsNet), which online the battle server fills; a LocalMP host has no battle server.
|
||||
// Without it: the debriefing shows no rewards or activity.
|
||||
{
|
||||
"id": "battle/use-settled-debriefing-stats",
|
||||
"title": "Use the local server's settled battle in the LocalMP debriefing",
|
||||
"file": "scripts/debriefing/debriefingfull.nut",
|
||||
"features": [
|
||||
"L-结算页"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find-gather.nut",
|
||||
"replace": "replace-gather.nut"
|
||||
},
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-after-exp.nut",
|
||||
"replace": "replace-after-exp.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
debriefingResult.haveTeamkills <- debriefingResultHaveTeamkills()
|
||||
debriefingResult.activeBoosters <- getDebriefingActiveBoosters()
|
||||
debriefingResult.activeWager <- getDebriefingActiveWager()
|
||||
debriefingResult.eventId <- getDebriefingEventId()
|
||||
@@ -0,0 +1,12 @@
|
||||
function getDebriefingRoomLogs() {
|
||||
return getUserLogsList({ currentRoomOnly = true, needStackItems = false, disableVisible = true })
|
||||
}
|
||||
|
||||
function gatherDebriefingFlightState() {
|
||||
let gm = get_game_mode()
|
||||
let gameType = get_game_type()
|
||||
if (gm == GM_DYNAMIC)
|
||||
dynamicResult = dynamicApplyStatus()
|
||||
|
||||
debriefingResult = {
|
||||
roomUserlogs = getDebriefingRoomLogs()
|
||||
@@ -0,0 +1,20 @@
|
||||
debriefingResult.country <- get_local_player_country()
|
||||
debriefingResult.localTeam <- get_mp_local_team()
|
||||
debriefingResult.friendlyTeam <- get_player_army_for_hud()
|
||||
debriefingResult.chatLog <- getGameChatLogText()
|
||||
debriefingResult.logForBanhammer <- getLogForBanhammer()
|
||||
}
|
||||
|
||||
function gatherDebriefingResult() {
|
||||
let wtoSettled = require("nestdb").ndbTryRead(["wto", "settled"])
|
||||
if (wtoSettled == null || debriefingResult == null)
|
||||
gatherDebriefingFlightState()
|
||||
if (wtoSettled != null) {
|
||||
// The LocalMP host and its player table are gone by the time the service replies.
|
||||
debriefingResult.roomUserlogs = getDebriefingRoomLogs()
|
||||
debriefingResult.roomEvent = debriefingResult.roomEvent ?? wtoSettled.roomEvent
|
||||
debriefingResult.isSucceed = wtoSettled.win
|
||||
debriefingResult.wtoSettled <- true
|
||||
}
|
||||
let gameType = debriefingResult.gameType
|
||||
let exp = wtoSettled != null ? u.copy(wtoSettled.exp) : (stat_get_exp() ?? {})
|
||||
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBKDANBgkqhkiG9w0BAQEFAAOCARUAMIIBEAKCAQcAy9WagPn8/uLbbPHebobA
|
||||
ftDiwrGpi23Ed0fQsSCZfGYupBkYl3mZD3fgOMgmLSYsTqFHDe0CMTQKpHYGFfT3
|
||||
EuvTHKwwyo2ckpaLNI/flZysDXRuoWXvwd6FzGBx3l2/I1Yw+cAle/aWB9YZnQtX
|
||||
fy3j3k/fJfiv7+72Sm95h3Dg715XuBILC4vSYVqvCn+UlQyrJkAZrIahWR9Gzsm6
|
||||
ovxSaduvosn83Hx1ZixD+U5wcn1hoTT0niwnrqiPuEUV3wC887JIR4KzMXYpyzvF
|
||||
nEhlqTKoGN7oGS7vqN4tCH6/l3hAomxfVGT+5UHGugQEauNqccYq44Hfu3t3tY1r
|
||||
j+eTYc35NQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -0,0 +1,23 @@
|
||||
// Replace the inventory content-signing public key with the local server's key; native verification stays on.
|
||||
// Why the client: the key is hard-coded in the script and the service cannot sign with Gaijin's private key.
|
||||
// Without it: GetItemDefsClient fails CONTENT_SIGN_VALIDATION_FAILED and every external item definition is dropped.
|
||||
{
|
||||
"id": "inventory/local-content-public-key",
|
||||
"title": "外部库存内容验签公钥替换为本地服务的固定公钥",
|
||||
"file": "scripts/inventory/inventorycontentsign.nut",
|
||||
"features": [
|
||||
"G-市场",
|
||||
"H-补给箱",
|
||||
"H-物品回收与合成",
|
||||
"H-兑换券"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5U86nI/1f8us73a5Tn8K
|
||||
NjcrWyT6oZzz18uC4eH4LM+VaIJlGvzA0UWMMv8/otX+u8M3wBl/uONv39wc382d
|
||||
eKxTPmo0gWb1cwZ8SeqNUvQJl5HxD0zSPlA2LbQFwoA3aI4nSYcaFV7at7XGph/N
|
||||
HdYbtSCJei0N7hiqWeeIHcSYjZpmBk5KUs/E+OODquII5liol5LiC9AnvFCVHcT4
|
||||
1mliTgdHt/LKiLbc0AoVCDHdVMBPEPuZAn9MQJpfIPJdexU8Hzn4xBQ9K2NyISYS
|
||||
7eRwxratNPdNUHixaw6tyuUCDEV2ELAYw5rwoaFsqP7M76SubBRZObZ8DUgsZZaE
|
||||
lQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -0,0 +1,18 @@
|
||||
let taskCallback = function() {
|
||||
let item = findItemByUid(uid)
|
||||
|
||||
|
||||
if (item && item.amountByUids[uid] == itemAmountByUid) {
|
||||
item.amountByUids[uid] -= consumeAmount
|
||||
item.amount -= consumeAmount
|
||||
if (item.amountByUids[uid] <= 0) {
|
||||
inventoryClient.removeItem(uid)
|
||||
if (item.uids?[0] == uid)
|
||||
item.uids.remove(0)
|
||||
}
|
||||
}
|
||||
if (cb)
|
||||
cb({ success = true })
|
||||
}
|
||||
let itemId = this.id
|
||||
let taskId = char_send_blk("cln_consume_inventory_item", blk)
|
||||
@@ -0,0 +1,21 @@
|
||||
// Open the existing native reward window after a manual coupon redemption succeeds.
|
||||
// Why the client: the stock success handler never opens a reward window, whatever the service answers.
|
||||
// Without it: a redeemed coupon updates the inventory without any receipt.
|
||||
{
|
||||
"id": "inventory/show-coupon-redemption-reward",
|
||||
"title": "Show the granted reward after manual coupon redemption",
|
||||
"file": "scripts/items/itemsclasses/itemexternal.nut",
|
||||
"features": [
|
||||
"G-Marketplace",
|
||||
"H-External inventory"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
let couponReward = this.shouldAutoConsume || this.metaBlk == null
|
||||
? null
|
||||
: require("%sqstd/datablock.nut").convertBlk(this.metaBlk)
|
||||
if (couponReward != null)
|
||||
couponReward.itemDefId <- this.id
|
||||
|
||||
let taskCallback = function() {
|
||||
let item = findItemByUid(uid)
|
||||
|
||||
|
||||
if (item && item.amountByUids[uid] == itemAmountByUid) {
|
||||
item.amountByUids[uid] -= consumeAmount
|
||||
item.amount -= consumeAmount
|
||||
if (item.amountByUids[uid] <= 0) {
|
||||
inventoryClient.removeItem(uid)
|
||||
if (item.uids?[0] == uid)
|
||||
item.uids.remove(0)
|
||||
}
|
||||
}
|
||||
if (cb)
|
||||
cb({ success = true })
|
||||
|
||||
if (couponReward != null) {
|
||||
let { eventbus_send } = require("eventbus")
|
||||
eventbus_send("guiStartOpenTrophy", {
|
||||
[couponReward.itemDefId.tostring()] = [couponReward]
|
||||
rewardTitle = loc("mainmenu/you_received")
|
||||
isHidePrizeActionBtn = true
|
||||
})
|
||||
}
|
||||
}
|
||||
let itemId = this.id
|
||||
let taskId = char_send_blk("cln_consume_inventory_item", blk)
|
||||
@@ -0,0 +1 @@
|
||||
let shouldLogin = isInArray(URL_TAG_AUTO_LOGIN, urlTags)
|
||||
@@ -0,0 +1,22 @@
|
||||
// Skip the yuplay2 single sign-on wrapper for URLs that point at the local server.
|
||||
// Why the client: SsoLoggedUrlAction always wraps the URL in https://login.gaijin.net and the embedded browser does not load wto_ws.dll.
|
||||
// Without it: opening the local store or marketplace sends the browser to the real Gaijin login server.
|
||||
{
|
||||
"id": "online-shop/bypass-external-sso-for-local-urls",
|
||||
"title": "本地服务地址打开网页时跳过 Gaijin 外网单点登录跳转",
|
||||
"file": "scripts/onlineshop/url.nut",
|
||||
"features": [
|
||||
"A-不连 Gaijin",
|
||||
"G-礼包商店",
|
||||
"G-市场"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
let shouldLogin = isInArray(URL_TAG_AUTO_LOGIN, urlTags) && url.indexof("://{{LOCAL_ENDPOINT}}") == null
|
||||
@@ -0,0 +1,2 @@
|
||||
let entitlementRewards = {}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Collect entitlement purchases per user log entry so every purchase opens its own receipt.
|
||||
// Why the client: the stock scan merges purchases of the same entitlement that arrive in one refresh.
|
||||
// Without it: repeated purchases in one profile update are under-reported.
|
||||
{
|
||||
"id": "online-shop/collect-entitlement-purchase-rewards",
|
||||
"title": "Track entitlement purchases by user log",
|
||||
"file": "scripts/userlog/userlogdata.nut",
|
||||
"features": [
|
||||
"G-Store",
|
||||
"G-Premium Account"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
let entitlementRewards = {}
|
||||
let purchaseReceipts = []
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
function browserCloseAndUpdateEntitlements() {
|
||||
addTask(updateEntitlementsLimited(),
|
||||
@@ -0,0 +1,21 @@
|
||||
// For local commerce pages, close the browser and leave the refresh to the close handler.
|
||||
// Why the client: the stock control already starts an update before the close handler starts another.
|
||||
// Without it: the close-and-update control can queue a redundant profile refresh.
|
||||
{
|
||||
"id": "online-shop/defer-explicit-browser-update-to-close",
|
||||
"title": "Refresh local commerce once from the browser close handler",
|
||||
"file": "scripts/onlineshop/browserwnd.nut",
|
||||
"features": [
|
||||
"G-Store",
|
||||
"G-Marketplace"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
function browserCloseAndUpdateEntitlements() {
|
||||
if (this.isLocalCommercePage())
|
||||
return this.goBack()
|
||||
|
||||
addTask(updateEntitlementsLimited(),
|
||||
@@ -0,0 +1,2 @@
|
||||
let name = "yuNetwork/payMethod/other"
|
||||
items.append({
|
||||
@@ -0,0 +1,22 @@
|
||||
// Add a text-only payment option that purchases with YU2_PAY_NONE (no GJN charge).
|
||||
// Why the client: payMethodsCfg only lists four icon-only methods; a login bitmask cannot add a named option.
|
||||
// Without it: the in-game payment window offers no free offline purchase.
|
||||
{
|
||||
"id": "online-shop/free-offline-payment-method",
|
||||
"title": "游戏内支付方式窗口增加「老福爷付过了」免 GJN 直接购买选项",
|
||||
"file": "scripts/onlineshop/onlinepurchase.nut",
|
||||
"features": [
|
||||
"G-货币",
|
||||
"G-高级账户",
|
||||
"G-礼包商店"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
let freePayName = "老福爷付过了"
|
||||
items.append({
|
||||
name = freePayName
|
||||
icon = ""
|
||||
callback = @() onYuplayPurchase(product, YU2_PAY_NONE, freePayName)
|
||||
})
|
||||
|
||||
let name = "yuNetwork/payMethod/other"
|
||||
items.append({
|
||||
@@ -0,0 +1,2 @@
|
||||
function getEntitlementShortName(ent) {
|
||||
local name = ""
|
||||
@@ -0,0 +1,20 @@
|
||||
// Use the catalogue title for offline vehicle packs in the current game language.
|
||||
// Why the client: the localization tables have no entries for locally generated pack ids.
|
||||
// Without it: vehicle pack receipts show raw localization keys.
|
||||
{
|
||||
"id": "online-shop/localize-vehicle-pack-titles",
|
||||
"title": "Display localized titles for offline vehicle packs",
|
||||
"file": "scripts/onlineshop/entitlements.nut",
|
||||
"features": [
|
||||
"G-Store"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
function getEntitlementShortName(ent) {
|
||||
let catalogueTitle = ent?.wtoTitleEn
|
||||
if (catalogueTitle != null) {
|
||||
let { isChineseVersion, isChineseHarmonized } = require("%scripts/langUtils/language.nut")
|
||||
let isChinese = isChineseVersion() || isChineseHarmonized()
|
||||
return isChinese ? (ent?.wtoTitleZh ?? catalogueTitle) : catalogueTitle
|
||||
}
|
||||
|
||||
local name = ""
|
||||
@@ -0,0 +1,2 @@
|
||||
entitlementRewards.each(
|
||||
@(_, entId) handler.doWhenActive(@() showEntitlement(entId, { ignoreAvailability = true })))
|
||||
@@ -0,0 +1,21 @@
|
||||
// Queue each saved purchase once per handler and acknowledge it after its receipt opens.
|
||||
// Why the client: one refresh can return several purchases before the price table is available.
|
||||
// Without it: repeated purchases or products missing from the catalogue lose their unread notification.
|
||||
{
|
||||
"id": "online-shop/open-entitlement-purchase-receipts",
|
||||
"title": "Acknowledge each purchase after its receipt opens",
|
||||
"file": "scripts/userlog/userlogdata.nut",
|
||||
"features": [
|
||||
"G-Store",
|
||||
"G-Premium Account"
|
||||
],
|
||||
"verified_on": [
|
||||
"2.61.0.37"
|
||||
],
|
||||
"edits": [
|
||||
{
|
||||
"find": "find.nut",
|
||||
"replace": "replace.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loaded 100 of 476 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user