From a0beedd8985ce5bcd406395c013cf5bea8529484 Mon Sep 17 00:00:00 2001 From: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Mon, 30 Nov 2026 10:44:42 +0800 Subject: [PATCH] feat(agreement): show and record the WTOffline terms Require explicit acceptance in the existing game dialog and retain the accepted version in the local account profile. Verified full Quirrel compilation for .37 and .43, a temporary .43 build, and the launcher checks. --- .../src/renderer/src/i18n/locales/en.json | 2 +- .../src/renderer/src/i18n/locales/zh-CN.json | 2 +- .../find-acceptance-import.nut | 1 + .../find-agreement-import.nut | 1 + .../find-login.nut | 15 +++++++ .../find-platform.nut | 2 + .../find-telemetry.nut | 2 + .../require-explicit-acceptance/patch.jsonc | 36 +++++++++++++++ .../replace-acceptance-import.nut | 1 + .../replace-agreement-import.nut | 1 + .../replace-login.nut | 7 +++ .../replace-platform.nut | 1 + .../replace-telemetry.nut | 1 + .../show-offline-terms/find-display.nut | 5 +++ .../show-offline-terms/find-imports.nut | 5 +++ .../show-offline-terms/find-language.nut | 1 + .../show-offline-terms/find-loader.nut | 10 +++++ .../show-offline-terms/find-read.nut | 2 + .../show-offline-terms/find-terms.nut | 16 +++++++ .../show-offline-terms/find-title.nut | 3 ++ .../agreement/show-offline-terms/patch.jsonc | 44 +++++++++++++++++++ .../show-offline-terms/replace-display.nut | 3 ++ .../show-offline-terms/replace-imports.nut | 3 ++ .../show-offline-terms/replace-language.nut | 1 + .../show-offline-terms/replace-loader.nut | 1 + .../show-offline-terms/replace-read.nut | 1 + .../show-offline-terms/replace-terms.nut | 5 +++ .../show-offline-terms/replace-title.nut | 1 + 28 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 patches/gui/agreement/require-explicit-acceptance/find-acceptance-import.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/find-agreement-import.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/find-login.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/find-platform.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/find-telemetry.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/patch.jsonc create mode 100644 patches/gui/agreement/require-explicit-acceptance/replace-acceptance-import.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/replace-agreement-import.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/replace-login.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/replace-platform.nut create mode 100644 patches/gui/agreement/require-explicit-acceptance/replace-telemetry.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-display.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-imports.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-language.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-loader.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-read.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-terms.nut create mode 100644 patches/gui/agreement/show-offline-terms/find-title.nut create mode 100644 patches/gui/agreement/show-offline-terms/patch.jsonc create mode 100644 patches/gui/agreement/show-offline-terms/replace-display.nut create mode 100644 patches/gui/agreement/show-offline-terms/replace-imports.nut create mode 100644 patches/gui/agreement/show-offline-terms/replace-language.nut create mode 100644 patches/gui/agreement/show-offline-terms/replace-loader.nut create mode 100644 patches/gui/agreement/show-offline-terms/replace-read.nut create mode 100644 patches/gui/agreement/show-offline-terms/replace-terms.nut create mode 100644 patches/gui/agreement/show-offline-terms/replace-title.nut diff --git a/apps/launcher/src/renderer/src/i18n/locales/en.json b/apps/launcher/src/renderer/src/i18n/locales/en.json index 310da35..6482e9a 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/en.json +++ b/apps/launcher/src/renderer/src/i18n/locales/en.json @@ -552,7 +552,7 @@ } }, "statement": "Project information", - "statementBody": "WTOffline is an independent, unofficial project with no affiliation to Gaijin Entertainment. An installed copy of the official War Thunder client is required." + "statementBody": "WTOffline is a noncommercial hobby project independent of Gaijin. Running it requires your own War Thunder base game files." }, "features": { "A-Offline startup": "Offline startup", diff --git a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json index 0e77ef7..da488e2 100644 --- a/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json +++ b/apps/launcher/src/renderer/src/i18n/locales/zh-CN.json @@ -552,7 +552,7 @@ } }, "statement": "项目信息", - "statementBody": "WTOffline 是独立开发的非官方项目,与 Gaijin Entertainment 无关。运行需要已安装的战争雷霆正版客户端。" + "statementBody": "WTOffline 是一个独立于 Gaijin 的非商业兴趣项目。运行需要自备战争雷霆游戏本体文件。" }, "features": { "A-Offline startup": "离线启动", diff --git a/patches/gui/agreement/require-explicit-acceptance/find-acceptance-import.nut b/patches/gui/agreement/require-explicit-acceptance/find-acceptance-import.nut new file mode 100644 index 0000000..719641e --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/find-acceptance-import.nut @@ -0,0 +1 @@ +from "sqEulaUtils" import getAgreedEulaVersion, setAgreedEulaVersion diff --git a/patches/gui/agreement/require-explicit-acceptance/find-agreement-import.nut b/patches/gui/agreement/require-explicit-acceptance/find-agreement-import.nut new file mode 100644 index 0000000..dfddc39 --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/find-agreement-import.nut @@ -0,0 +1 @@ +from "%scripts/eulaWnd.nut" import LOCAL_AGREED_EULA_VERSION_SAVE_ID, getEulaVersion, openEulaWnd, localAgreedEulaVersion diff --git a/patches/gui/agreement/require-explicit-acceptance/find-login.nut b/patches/gui/agreement/require-explicit-acceptance/find-login.nut new file mode 100644 index 0000000..5b73778 --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/find-login.nut @@ -0,0 +1,15 @@ + } else { + if ((isSony || isXbox || steam_is_running()) + && (agreedEulaVersion == 0 || localAgreedEulaVersion.get() >= currentEulaVersion)) { + setAgreedEulaVersion(currentEulaVersion) + if (agreedEulaVersion == 0) + sendBqEvent("CLIENT_NEW_USER_1", "acceptEula", { details = "acceptEula" }) + sendBqEvent("CLIENT_GAMEPLAY_1", "eula_screen", "accept") + } else { + openEulaWnd({ + isForView = false + isNewEulaVersion = agreedEulaVersion > 0 + doOnlyLocalSave = false + }) + } + } diff --git a/patches/gui/agreement/require-explicit-acceptance/find-platform.nut b/patches/gui/agreement/require-explicit-acceptance/find-platform.nut new file mode 100644 index 0000000..1180238 --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/find-platform.nut @@ -0,0 +1,2 @@ +from "%sqstd/platform.nut" import isSony, isXbox +from "%scripts/user/profileStates.nut" import userIdStr, havePlayerTag diff --git a/patches/gui/agreement/require-explicit-acceptance/find-telemetry.nut b/patches/gui/agreement/require-explicit-acceptance/find-telemetry.nut new file mode 100644 index 0000000..bcbf9f0 --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/find-telemetry.nut @@ -0,0 +1,2 @@ +from "%scripts/bqQueue/bqQueue.nut" import sendBqEvent +from "%scripts/options/fxOptions.nut" import needShowHdrSettingsOnStart, openHdrSettings diff --git a/patches/gui/agreement/require-explicit-acceptance/patch.jsonc b/patches/gui/agreement/require-explicit-acceptance/patch.jsonc new file mode 100644 index 0000000..4e5f7bc --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/patch.jsonc @@ -0,0 +1,36 @@ +// Show the agreement whenever the account has yet to accept its current version. +{ + "id": "agreement/require-explicit-acceptance", + "title": "Require explicit agreement acceptance", + "features": [ + "A-Local accounts" + ], + "variants": [ + { + "written_for": "2.61.0.37", + "file": "scripts/login/loginpseudothreadsconfig.nut", + "edits": [ + { + "find": "find-platform.nut", + "replace": "replace-platform.nut" + }, + { + "find": "find-agreement-import.nut", + "replace": "replace-agreement-import.nut" + }, + { + "find": "find-telemetry.nut", + "replace": "replace-telemetry.nut" + }, + { + "find": "find-acceptance-import.nut", + "replace": "replace-acceptance-import.nut" + }, + { + "find": "find-login.nut", + "replace": "replace-login.nut" + } + ] + } + ] +} diff --git a/patches/gui/agreement/require-explicit-acceptance/replace-acceptance-import.nut b/patches/gui/agreement/require-explicit-acceptance/replace-acceptance-import.nut new file mode 100644 index 0000000..ccdda3f --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/replace-acceptance-import.nut @@ -0,0 +1 @@ +from "sqEulaUtils" import getAgreedEulaVersion diff --git a/patches/gui/agreement/require-explicit-acceptance/replace-agreement-import.nut b/patches/gui/agreement/require-explicit-acceptance/replace-agreement-import.nut new file mode 100644 index 0000000..03816e3 --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/replace-agreement-import.nut @@ -0,0 +1 @@ +from "%scripts/eulaWnd.nut" import LOCAL_AGREED_EULA_VERSION_SAVE_ID, getEulaVersion, openEulaWnd diff --git a/patches/gui/agreement/require-explicit-acceptance/replace-login.nut b/patches/gui/agreement/require-explicit-acceptance/replace-login.nut new file mode 100644 index 0000000..6a6209a --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/replace-login.nut @@ -0,0 +1,7 @@ + } else { + openEulaWnd({ + isForView = false + isNewEulaVersion = agreedEulaVersion > 0 + doOnlyLocalSave = false + }) + } diff --git a/patches/gui/agreement/require-explicit-acceptance/replace-platform.nut b/patches/gui/agreement/require-explicit-acceptance/replace-platform.nut new file mode 100644 index 0000000..46042fa --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/replace-platform.nut @@ -0,0 +1 @@ +from "%scripts/user/profileStates.nut" import userIdStr, havePlayerTag diff --git a/patches/gui/agreement/require-explicit-acceptance/replace-telemetry.nut b/patches/gui/agreement/require-explicit-acceptance/replace-telemetry.nut new file mode 100644 index 0000000..93520b6 --- /dev/null +++ b/patches/gui/agreement/require-explicit-acceptance/replace-telemetry.nut @@ -0,0 +1 @@ +from "%scripts/options/fxOptions.nut" import needShowHdrSettingsOnStart, openHdrSettings diff --git a/patches/gui/agreement/show-offline-terms/find-display.nut b/patches/gui/agreement/show-offline-terms/find-display.nut new file mode 100644 index 0000000..4174991 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-display.nut @@ -0,0 +1,5 @@ + let eulaText = loadAndProcessText() + if (eulaText == null) + showObjById("eula_online_link", hasFeature("AllowExternalLink"), this.scene).link = getCurCircuitOverride("eulaURL", loc("url/eula")) + textObj.setValue(eulaText ?? loc("eula/textMissing")) + let hasOneOkBtn = this.isForView || this.isNewEulaVersion diff --git a/patches/gui/agreement/show-offline-terms/find-imports.nut b/patches/gui/agreement/show-offline-terms/find-imports.nut new file mode 100644 index 0000000..5b10e2d --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-imports.nut @@ -0,0 +1,5 @@ +from "%appGlobals/curCircuitOverride.nut" import getCurCircuitOverride +from "sqEulaUtils" import setAgreedEulaVersion +from "dagor.workcycle" import defer +from "%sqstd/globalState.nut" import hardPersistWatched +from "%sqstd/packedText.nut" import readPackedText diff --git a/patches/gui/agreement/show-offline-terms/find-language.nut b/patches/gui/agreement/show-offline-terms/find-language.nut new file mode 100644 index 0000000..7881777 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-language.nut @@ -0,0 +1 @@ +from "%scripts/langUtils/language.nut" import getCurLangShortName diff --git a/patches/gui/agreement/show-offline-terms/find-loader.nut b/patches/gui/agreement/show-offline-terms/find-loader.nut new file mode 100644 index 0000000..c67d6fe --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-loader.nut @@ -0,0 +1,10 @@ +function loadAndProcessText(){ + let shortLang = getCurLangShortName() + local langPostfix = shortLangToEulaLang?[shortLang] ?? shortLang + langPostfix = langPostfix == "" ? "" : $"_{langPostfix}" + let eulaPrefixForCircuit = getCurCircuitOverride("eulaPrefix", "") + let text = readEula(eulaPrefixForCircuit, langPostfix) ?? readEula("", langPostfix) + if (text == null) + logerr($"EulaWnd: %langTxt/{eulaPrefixForCircuit}eula{langPostfix}.txt is missing") + return text == null ? null : wordHyphenation(text) +} diff --git a/patches/gui/agreement/show-offline-terms/find-read.nut b/patches/gui/agreement/show-offline-terms/find-read.nut new file mode 100644 index 0000000..fbb150c --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-read.nut @@ -0,0 +1,2 @@ +let readEula = @(prefix, postfix) readPackedText($"%langTxt/{prefix}eula{postfix}.txt") + ?? readPackedText($"%langTxt/{prefix}eula.txt") diff --git a/patches/gui/agreement/show-offline-terms/find-terms.nut b/patches/gui/agreement/show-offline-terms/find-terms.nut new file mode 100644 index 0000000..728cb75 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-terms.nut @@ -0,0 +1,16 @@ +local eulaVersion = -1 + +let localAgreedEulaVersion = hardPersistWatched("localAgreedEulaVersion", 0) + +let shortLangToEulaLang = { + en = "" + cs = "cz" + ja = "jp" + zhhx = "zh" +} + +function getEulaVersion() { + if (eulaVersion == -1) + eulaVersion = to_integer_safe(getCurCircuitOverride("eulaVersion") ?? loc("eula_version", "12")) + return eulaVersion +} diff --git a/patches/gui/agreement/show-offline-terms/find-title.nut b/patches/gui/agreement/show-offline-terms/find-title.nut new file mode 100644 index 0000000..189ff5f --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/find-title.nut @@ -0,0 +1,3 @@ + let eulaTitle = getCurCircuitOverride("eulaPrefix", "") != "" ? "" + : this.isNewEulaVersion ? loc("eula/eulaUpdateTitle") + : loc("eula/eulaTitle") diff --git a/patches/gui/agreement/show-offline-terms/patch.jsonc b/patches/gui/agreement/show-offline-terms/patch.jsonc new file mode 100644 index 0000000..9cedbb9 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/patch.jsonc @@ -0,0 +1,44 @@ +// Keep the stock agreement window and account acceptance, with WTOffline's own text and version. +{ + "id": "agreement/show-offline-terms", + "title": "Show the WTOffline statement and agreement", + "features": [ + "A-Local accounts" + ], + "variants": [ + { + "written_for": "2.61.0.37", + "file": "scripts/eulawnd.nut", + "edits": [ + { + "find": "find-language.nut", + "replace": "replace-language.nut" + }, + { + "find": "find-imports.nut", + "replace": "replace-imports.nut" + }, + { + "find": "find-terms.nut", + "replace": "replace-terms.nut" + }, + { + "find": "find-read.nut", + "replace": "replace-read.nut" + }, + { + "find": "find-loader.nut", + "replace": "replace-loader.nut" + }, + { + "find": "find-display.nut", + "replace": "replace-display.nut" + }, + { + "find": "find-title.nut", + "replace": "replace-title.nut" + } + ] + } + ] +} diff --git a/patches/gui/agreement/show-offline-terms/replace-display.nut b/patches/gui/agreement/show-offline-terms/replace-display.nut new file mode 100644 index 0000000..b089312 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-display.nut @@ -0,0 +1,3 @@ + let agreementIsChinese = isChineseVersion() || isChineseHarmonized() + textObj.setValue(agreementIsChinese ? offlineAgreementChinese : wordHyphenation(offlineAgreementEnglish)) + let hasOneOkBtn = this.isForView diff --git a/patches/gui/agreement/show-offline-terms/replace-imports.nut b/patches/gui/agreement/show-offline-terms/replace-imports.nut new file mode 100644 index 0000000..dcf6185 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-imports.nut @@ -0,0 +1,3 @@ +from "sqEulaUtils" import setAgreedEulaVersion +from "dagor.workcycle" import defer +from "%sqstd/globalState.nut" import hardPersistWatched diff --git a/patches/gui/agreement/show-offline-terms/replace-language.nut b/patches/gui/agreement/show-offline-terms/replace-language.nut new file mode 100644 index 0000000..2c53080 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-language.nut @@ -0,0 +1 @@ +from "%scripts/langUtils/language.nut" import isChineseVersion, isChineseHarmonized diff --git a/patches/gui/agreement/show-offline-terms/replace-loader.nut b/patches/gui/agreement/show-offline-terms/replace-loader.nut new file mode 100644 index 0000000..1dbf5ef --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-loader.nut @@ -0,0 +1 @@ +let offlineAgreementEnglish = "WTOffline is a noncommercial hobby project independent of Gaijin.\n\nThe game uses a local account. Saves, caches, and logs are stored in the copy's data folder. Adaptation pack checks and official background images can be disabled in the launcher settings.\n\nI have read and agree to this statement and agreement. I confirm that this offline copy is already running with the base game files I provided and am authorized to use." diff --git a/patches/gui/agreement/show-offline-terms/replace-read.nut b/patches/gui/agreement/show-offline-terms/replace-read.nut new file mode 100644 index 0000000..fba85b7 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-read.nut @@ -0,0 +1 @@ +let offlineAgreementChinese = "WTOffline 是一个独立于 Gaijin 的非商业兴趣项目。\n\n游戏使用本地账号。存档、缓存和日志保存在副本的数据目录。启动器的适配包检查和官网背景图可在设置中关闭。\n\n我已阅读并同意以上声明与协议。我确认,当前运行的离线副本已经在使用我自行提供且有权使用的游戏本体文件。" diff --git a/patches/gui/agreement/show-offline-terms/replace-terms.nut b/patches/gui/agreement/show-offline-terms/replace-terms.nut new file mode 100644 index 0000000..3e2441c --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-terms.nut @@ -0,0 +1,5 @@ +// Start the project agreement above the stock version stored in existing accounts. +const WTO_AGREEMENT_VERSION = 10001 + +let localAgreedEulaVersion = hardPersistWatched("localAgreedEulaVersion", 0) +let getEulaVersion = @() WTO_AGREEMENT_VERSION diff --git a/patches/gui/agreement/show-offline-terms/replace-title.nut b/patches/gui/agreement/show-offline-terms/replace-title.nut new file mode 100644 index 0000000..c2e6798 --- /dev/null +++ b/patches/gui/agreement/show-offline-terms/replace-title.nut @@ -0,0 +1 @@ + let eulaTitle = agreementIsChinese ? "WTOffline 离线版声明与协议" : "WTOffline Statement and Agreement"