feat(store): add store and marketplace item views and image sources

Add catalogue filters, item detail views, and purchase and resale
actions. Resolve images from the player's asset pack, public image
URLs, or local game data. Add a utility for creating the optional
local asset pack.

Type checking and JavaScript syntax checks passed. Embedded browser
appearance and in-game behavior still need acceptance.
This commit is contained in:
N0VAN0M4LY committed 2026-11-26 07:12:38 +08:00
1 parent a73635407d
commit 98812fa9c2
39 files changed
+1309 -400

No files matched your search

@@ -8,7 +8,7 @@
},
"derivation": {
"requirement": "handover 6.1 方案 B(用户原话 82、115)与功能清单 G「礼包商店」「兑换码」。被 wto_ws.dll 改道到本地服务的 https 请求(api.gaijinent.com 的 GJN 付款、商品信息、兑换码等)必须能完成 TLS 握手并把请求送达本地服务。",
"requirement": "HTTPS requests routed to the local service must complete their TLS handshake for purchases, product information, and code redemption.",
"cause": "network.blk 的 enableSslCertCheck 只被 0x155c950 的 4 个调用点读取;dagor.http(httpRequest)等请求不读它,保留了 libcurl 默认的证书链和主机名校验。实测日志:newsfeed.gap.gaijin.net 握手后报 SSL peer certificate or SSH remote key was not OK。",
"lighter_options_ruled_out": [
"network.blk 的 enableSslCertCheck:已设为 false,但 dagor.http 等路径根本不读取这个配置。",
@@ -11,7 +11,7 @@
"lighter_options_ruled_out": [
"原生自带:没有找到换公钥或关闭加密的配置项、启动参数。",
"本地服务:拿不到会话密钥就无法回复(第五轮实测:本地服务回明文,客户端 15 秒后超时)。",
"改代码让客户端不加密:要改客户端逻辑,不加密的分支用途未查清;用户选了换公钥(原话 83)。"
"Changing the matching encryption path would alter client protocol behavior. The use of the unencrypted branch has not been established."
],
"conclusion": "改 exe 的数据(一段 PEM 文本),不改代码。新公钥与原公钥都是 2048 位、指数 65537,PEM 文本长度相同(451 字节),原地替换。",
"if_not_applied": "匹配服务器连不上,机库一直显示\"正在连接服务器\",槽位栏不出现。"
@@ -8,11 +8,11 @@
},
"derivation": {
"requirement": "handover 6.1 方案 B(用户原话 82、115):写死的地址全部接到本机,由机制保证连不出去;本地服务接住要用的请求(GJN 付款、兑换码等,implementation notes 第 5 节);不用 443 等固定端口。开发纪律第 18 条(与正版隔离)。",
"requirement": "Route hard-coded endpoints to the isolated local service at its configured port, including the endpoints for purchases and code redemption.",
"cause": "这些地址是程序和 yuplay2 里的常量,network.blk 的 storeApiHost 等只能换主机名,协议和端口(https/443)改不了,很多地址根本没有配置项。",
"lighter_options_ruled_out": [
"原生自带:没有统一改所有地址和端口的配置项。",
"逐个改地址字符串:会漏,有长度限制,管不到进程里其他 DLL(用户在 6.1 排除)。",
"Replacing individual address strings has length constraints and misses calls made by other libraries in the process.",
"改 Windows hosts 文件:影响整台电脑和正版(6.1 排除),而且改不了端口。",
"代码洞里的钩子:只能拦 exe 自己的调用,fmod64、controller、gameHook、libcef 等 DLL 直接调 ws2_32,拦不到(implementation notes)。"
],
@@ -9,7 +9,7 @@
},
"derivation": {
"requirement": "用户反馈(反馈20261125.md,原话 129 方案 A):新手教程询问窗设置「不再询问」后应稳定持久化,不应在重启游戏后反复重弹。",
"requirement": "Persist the tutorial opt-out immediately so it remains set when the client restarts.",
"cause": "原版 saveLocalByAccount 默认回调 saveProfile()(scripts/clientState/saveProfile.nut SAVE_TIMEOUT = 60000)仅启动 60 秒延迟定时器,期间既不写本地磁盘也不向本地服务发送请求;若 60 秒内进程异常退出或被外部终止,跳过标记即丢失。",
"lighter_options_ruled_out": [
"仅靠本地服务:勾选后的 60 秒窗口内客户端不发出任何网络请求,本地服务无从获知勾选状态。"
@@ -9,8 +9,7 @@
* every branch's base tutorial offer. `scripts/tutorials/tutorialsData.nut` gates air and naval
* base tutorials on `AllowedToSkipBaseTutorials` and ground base tutorials (`lightTank`,
* `lightTank_action`) on `AllowedToSkipBaseTankTutorials`; without both, `NextTutorialHandler`
* hides its "do not ask me again" checkbox and close button until the tutorial is started once
* (local verification).
* hides its "do not ask me again" checkbox and close button until the tutorial is started once.
*
* PaymentMethods: lets scripts/onlineShop/onlinePurchase.nut offer GJN payment directly
* inside the Golden Eagles and Premium Account windows (stock game_settings.blk restricts it
@@ -1,5 +1,5 @@
/**
* Local accounts behind the login service (implementation notes, "本地账号").
* Local accounts behind the login service.
*
* Signing in with a login name that does not exist yet registers it with the password given;
* later sign-ins must use the same password. Accounts are kept in <data>/accounts.json.
@@ -0,0 +1,59 @@
/**
* Build an optional asset pack by downloading the public images that the local
* pages use into <data folder>/asset-pack/, so the pages show official pictures without a network
* connection. Run it on a machine that can reach the official sites; nothing is shipped with
* the project, every player makes their own copy.
*
* node packages/local-service/src/asset-pack-cli.ts --data <data folder> [--concurrency 6]
*
* Sources: web-ui/web/official-images.json (official market images per vehicle / decor / item,
* from the official market snapshot) and the encyclopedia render of each of those vehicles.
* Files keep their host/path layout (static-ggc.gaijin.net/units/x.png); index.json lists them.
* The pages read the pack first (web-ui/web/common.js `sourcesFor`).
*/
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { parseArgs } from 'node:util';
const TABLE = new URL('./web-ui/web/official-images.json', import.meta.url);
async function main(): Promise<number> {
const { values } = parseArgs({ options: { data: { type: 'string' }, concurrency: { type: 'string', default: '6' } } });
if (!values.data) {
console.error('usage: asset-pack-cli.ts --data <data folder> [--concurrency 6]');
return 2;
}
const packDir = join(values.data, 'asset-pack');
const table = JSON.parse(readFileSync(TABLE, 'utf8')) as { base: string; byKey: Record<string, string> };
const urls = new Set<string>();
for (const [key, path] of Object.entries(table.byKey)) {
urls.add(table.base + path);
if (path.startsWith('units/')) urls.add(`https://static.encyclopedia.warthunder.com/images/${key.toLowerCase()}.png`);
}
const indexFile = join(packDir, 'index.json');
const done = new Set<string>(existsSync(indexFile) ? JSON.parse(readFileSync(indexFile, 'utf8')) as string[] : []);
const queue = [...urls].filter((url) => !done.has(url.replace(/^https?:\/\//, '')));
let failed = 0;
const worker = async (): Promise<void> => {
for (let url = queue.shift(); url; url = queue.shift()) {
const relative = url.replace(/^https?:\/\//, '');
try {
const response = await fetch(url);
if (!response.ok) { failed += 1; continue; }
const target = join(packDir, relative);
mkdirSync(dirname(target), { recursive: true });
writeFileSync(target, Buffer.from(await response.arrayBuffer()));
done.add(relative);
} catch {
failed += 1;
}
}
};
await Promise.all(Array.from({ length: Math.max(1, Number(values.concurrency)) }, worker));
mkdirSync(packDir, { recursive: true });
writeFileSync(indexFile, JSON.stringify([...done].sort(), null, 0));
console.log(`asset pack: ${done.size} file(s) in ${packDir}; ${failed} not available`);
return 0;
}
process.exitCode = await main();
@@ -19,8 +19,8 @@
* has a chosen vehicle type but no chosen country (scripts/tutorials.nut checkTutorialOnStart:
* needAutoStartTutorial = !hasRunTutorialDialog(), which is false while
* scripts/user/newbieTutorialDisplay.nut reqFirstCountryChoice() holds). With the country
* chosen, they offer the tutorial instead, which the player may skip (local verification; the
* skip itself is the feature AllowedToSkipBaseTutorials, set by the build).
* chosen, they offer the tutorial. The build enables AllowedToSkipBaseTutorials so the
* player can skip it.
*/
import { findParam } from '@wto/blk';
import type { AccountStore } from '../../accounts/account-store.ts';
@@ -1,7 +1,7 @@
/**
* Dataset: the game's own SVG icons that the local web pages (store and marketplace, shown in
* the in-game browser; implementation notes) display, taken from the player's
* ui/atlases.vromfs.bin so nothing of Gaijin's is shipped with the service (local verification):
* ui/atlases.vromfs.bin at runtime. The dataset uses these entries.
* gameuiskin/<vehicle>_ico.svg the tech-tree silhouette of a vehicle
* gameuiskin/<country>.svg a country flag (country_usa, ...)
*
@@ -3,8 +3,8 @@
* char.vromfs.bin config/mislist.blk ("skirmish"); the vehicle-type requirement keeps only
* missions that say the class is allowed.
*
* Missions made for the newbie modes (names containing "newbie") stay out: the offline
* version has no newbie restriction (local verification, docs/implementation notes).
* Exclude missions whose names contain "newbie" from the standard offline mission pools.
* See docs/implementation notes.
*/
import type { MissionSelection } from './game-mode-declaration.ts';
@@ -258,7 +258,7 @@ export function buyMarketplaceCoupon(
return { ok: true, item: grantExternalItem(profile, itemdefId, quantity) };
}
/** Direct free marketplace coupon claim ("老福爷付过了") without deducting GJN. */
/** Claim a marketplace coupon with the free offline payment method. */
export function buyFreeMarketplaceCoupon(
profile: BlkBlock,
catalogue: InventoryCatalogue,
@@ -1,7 +1,6 @@
/**
* Selling marketplace coupons back to the system (offline design, local verification): the player
* gets the listing price minus `sellFeeRate` (tuning/marketplace.jsonc, default 15 % like the
* official market's `market_fee`) credited as GJN; the coupons leave `extInventory`.
* Selling a coupon back to the system removes it from `extInventory` and credits the listing
* price less the configured `sellFeeRate` as GJN. See tuning/marketplace.jsonc.
*/
import type { BlkBlock } from '@wto/blk';
import { addGjnCents } from '../profile/profile-currency.ts';
+146 -99
View File
@@ -1,41 +1,55 @@
// Local marketplace page, shown in the game's built-in browser.
// The game opens it as <marketplaceURL>?a=<app id>[&viewitem&n=<market_hash_name>] (inventoryClient.nut).
// Local marketplace page (implementation notes; layout after the official Gaijin Market,
// implementation notes), shown in the game's built-in browser.
// The game opens it as <marketplaceURL>?a=<app id>[&viewitem&n=<market_hash_name>] (inventoryClient.nut);
// with `n` the page opens that item's card directly.
'use strict';
const T = {
zh: {
title: 'WTOffline 本地交易所', hint: '买到的兑换券直接进游戏库存(机库 → 道具 → 库存)', toStore: '前往商店',
eagles: '金鹰', lions: '银狮',
catAll: '全部', catVehicle: '载具券', catSkin: '涂装券', catAttachable: '挂件券', catDecal: '贴花券', catUnlock: '头像与解锁券',
search: '搜索名称或编号', allCountries: '全部国家', allClasses: '全部兵种', rank: '{rank} 级',
held: '库存 ×{n}', activated: '已拥有', buy: '购买', freeBuy: '老福爷付过了', pickAccount: '请先选择账号', empty: '没有符合条件的兑换券',
toStore: '前往商城', eagles: '金鹰', filters: '筛选', itemType: '物品类型', country: '国家', vehicleClass: '适用于',
heldOnly: '只看我的库存', search: '搜索', sortPopular: '人气', sortName: '名称(从 A 到 Z)', sortPriceAsc: '价格(从低到高)', sortPriceDesc: '价格(从高到低)',
catVehicle: '载具', catSkin: '涂装', catAttachable: '装饰挂件', catDecal: '贴花', catUnlock: '头像',
allCountries: '全部国家', allClasses: '全部', rank: '{rank} 级', from: '从', held: '库存 ×{n}', owned: '已拥有',
buy: '购买', freeBuy: '老福爷付过了', sell: '出售', pickAccount: '请先在右上角选择账号', empty: '没有符合条件的物品',
buyPrice: '系统售价:<b>{price}</b> GJN', sellPrice: '卖给系统:<b>{price}</b> GJN(扣 {fee}% 手续费)', youHave: '你拥有:<b>{n}</b>',
tagType: '物品类型', tagRarity: '稀有度', tagCountry: '国家', ticker: '离线交易所:按固定价格与系统交易,价格取自官方交易所快照。',
},
en: {
title: 'WTOffline Marketplace', hint: 'Coupons go straight to your inventory (Items → Inventory in the hangar)', toStore: 'Go to Store',
eagles: 'Golden Eagles', lions: 'Silver Lions',
catAll: 'All', catVehicle: 'Vehicles', catSkin: 'Camouflages', catAttachable: 'Decorations', catDecal: 'Decals', catUnlock: 'Icons and unlocks',
search: 'Search name or id', allCountries: 'All nations', allClasses: 'All types', rank: 'Rank {rank}',
held: 'In inventory ×{n}', activated: 'Owned', buy: 'Buy', freeBuy: '老福爷付过了', pickAccount: 'Pick an account first', empty: 'Nothing matches the filters',
toStore: 'Store', eagles: 'Golden Eagles', filters: 'Filters', itemType: 'Item type', country: 'Country', vehicleClass: 'Vehicle type',
heldOnly: 'Only my inventory', search: 'Search', sortPopular: 'Popular', sortName: 'Name (A to Z)', sortPriceAsc: 'Price (low to high)', sortPriceDesc: 'Price (high to low)',
catVehicle: 'Vehicles', catSkin: 'Camouflages', catAttachable: 'Decorations', catDecal: 'Decals', catUnlock: 'Avatars',
allCountries: 'All countries', allClasses: 'All', rank: 'Rank {rank}', from: 'from', held: 'Owned ×{n}', owned: 'Owned',
buy: 'Buy', freeBuy: '老福爷付过了', sell: 'Sell', pickAccount: 'Pick an account at the top right', empty: 'Nothing matches the filters',
buyPrice: 'System price: <b>{price}</b> GJN', sellPrice: 'Sell to system: <b>{price}</b> GJN ({fee}% fee)', youHave: 'You own: <b>{n}</b>',
tagType: 'Item type', tagRarity: 'Rarity', tagCountry: 'Country', ticker: 'Offline market: fixed-price trades with the system, prices from an official market snapshot.',
},
};
// Vehicle class of a listing -> the game's own type name (lang/menu.csv).
const CLASS_LABELS = {
aircraft: 'mainmenu/type_aircraft', helicopter: 'mainmenu/type_helicopter', tank: 'mainmenu/type_tank',
ship: 'mainmenu/type_ship_only', boat: 'mainmenu/type_boat_only',
};
const CATEGORIES = [['vehicle', 'catVehicle', '#fd5f2c'], ['skin', 'catSkin', '#8f7ee7'], ['attachable', 'catAttachable', '#8f7ee7'], ['decal', 'catDecal', '#8f7ee7'], ['unlock', 'catUnlock', '#00ced1']];
const CLASS_LABELS = { aircraft: 'mainmenu/type_aircraft', helicopter: 'mainmenu/type_helicopter', tank: 'mainmenu/type_tank', ship: 'mainmenu/type_ship_only', boat: 'mainmenu/type_boat_only' };
const RARITY = { afafa1: ['常见', 'Common'], '14bd3a': ['罕见', 'Uncommon'], '2965ff': ['稀有', 'Rare'], c816c1: ['超稀有', 'Ultra rare'] };
const ROMAN = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
const t = (key, params) => WtoUi.tr(T, key, params);
const $ = (id) => document.getElementById(id);
const wantedItem = WtoUi.query.get('n') || '';
let state = { accounts: [], currentUserId: '', balance: { gjnCents: 0, goldenEagles: 0, silverLions: 0 }, listings: [] };
let activeCat = 'all';
let state = { accounts: [], currentUserId: '', balance: { gjnCents: 0, goldenEagles: 0 }, sellFeeRate: 0.15, listings: [] };
const activeCats = new Set();
let openedWanted = false;
function applyStaticTexts() {
for (const el of document.querySelectorAll('[data-t]')) el.textContent = t(el.dataset.t);
$('searchInput').placeholder = t('search');
$('searchInput').value = wantedItem;
$('storeLink').href = WtoUi.pageLink('/store');
const types = $('typeFilters');
for (const [cat, key, color] of CATEGORIES) {
const row = document.createElement('label');
row.className = 'check';
row.innerHTML = '<input type="checkbox" /> <span></span>';
row.querySelector('span').textContent = t(key);
row.querySelector('span').style.color = color;
row.querySelector('input').onchange = (e) => { if (e.target.checked) activeCats.add(cat); else activeCats.delete(cat); renderGrid(); };
types.appendChild(row);
}
const classSelect = $('classFilter');
classSelect.appendChild(new Option(t('allClasses'), ''));
for (const [unitClass, key] of Object.entries(CLASS_LABELS)) classSelect.appendChild(new Option(WtoUi.label(key), unitClass));
@@ -43,16 +57,17 @@ function applyStaticTexts() {
async function loadState(userId) {
state = await WtoUi.getJson('/trade.gaijin.net/api/state' + (userId ? '?userId=' + encodeURIComponent(userId) : ''));
if (userId && !state.currentUserId) {
WtoUi.clearSavedAccount();
return loadState('');
}
if (userId && !state.currentUserId) { WtoUi.clearSavedAccount(); return loadState(''); }
WtoUi.fillAccountSelect($('accountSelect'), state.accounts, state.currentUserId);
$('gjnVal').textContent = WtoUi.gjn(state.balance.gjnCents);
$('goldVal').textContent = WtoUi.num(state.balance.goldenEagles);
$('silverVal').textContent = WtoUi.num(state.balance.silverLions);
renderCountries();
renderGrid();
if (wantedItem && !openedWanted) {
openedWanted = true;
const wanted = state.listings.find((l) => l.marketHashName === wantedItem);
if (wanted) openDetail(wanted);
}
}
function renderCountries() {
@@ -60,98 +75,130 @@ function renderCountries() {
const previous = select.value;
select.innerHTML = '';
select.appendChild(new Option(t('allCountries'), ''));
for (const country of [...new Set(state.listings.map((l) => l.country).filter(Boolean))]) {
select.appendChild(new Option(WtoUi.label(country), country, false, country === previous));
}
for (const country of [...new Set(state.listings.map((l) => l.country).filter(Boolean))]) select.appendChild(new Option(WtoUi.label(country), country, false, country === previous));
}
function matches(listing) {
const country = $('countryFilter').value;
const unitClass = $('classFilter').value;
const query = $('searchInput').value.trim().toLowerCase();
if (activeCat !== 'all' && listing.category !== activeCat) return false;
if (country && listing.country !== country) return false;
if (unitClass && listing.unitClass !== unitClass) return false;
return !query || [listing.title.zh, listing.title.en, listing.marketHashName, String(listing.itemdefId)].some((s) => s.toLowerCase().includes(query));
if (activeCats.size && !activeCats.has(listing.category)) return false;
if ($('countryFilter').value && listing.country !== $('countryFilter').value) return false;
if ($('classFilter').value && listing.unitClass !== $('classFilter').value) return false;
if ($('heldOnly').checked && !listing.couponCount) return false;
return !query || [listing.title.zh, listing.title.en, listing.marketHashName, String(listing.itemdefId)].some((s) => (s || '').toLowerCase().includes(query));
}
function sorted(listings) {
const mode = $('sortSelect').value;
const copy = [...listings];
if (mode === 'name') copy.sort((a, b) => WtoUi.text(a.title).localeCompare(WtoUi.text(b.title)));
if (mode === 'priceAsc') copy.sort((a, b) => a.gjnCostCents - b.gjnCostCents);
if (mode === 'priceDesc') copy.sort((a, b) => b.gjnCostCents - a.gjnCostCents);
return copy;
}
function listingImage(listing, className) {
return listing.category === 'vehicle' ? WtoUi.vehicleImg(listing.targetKey, className) : WtoUi.itemImg(listing.targetKey, '', className);
}
function renderGrid() {
const grid = $('grid');
grid.innerHTML = '';
const listings = state.listings.filter(matches);
if (listings.length === 0) grid.innerHTML = '<div class="empty">' + WtoUi.escapeHtml(t('empty')) + '</div>';
for (const listing of listings) grid.appendChild(listingCard(listing));
const listings = sorted(state.listings.filter(matches));
if (!listings.length) grid.innerHTML = '<div class="empty">' + WtoUi.escapeHtml(t('empty')) + '</div>';
for (const listing of listings) grid.appendChild(lotCard(listing));
}
function listingCard(listing) {
const card = document.createElement('div');
card.className = 'card' + (wantedItem && listing.marketHashName === wantedItem ? ' highlight' : '');
const head = document.createElement('div');
head.className = 'card-head';
if (listing.category === 'vehicle') head.appendChild(WtoUi.iconImg('vehicle', listing.targetKey, 'vehicle-icon'));
const titles = document.createElement('div');
titles.innerHTML = '<h3 class="card-title quality"></h3><div class="card-sub"></div>';
const title = titles.querySelector('.card-title');
title.textContent = WtoUi.text(listing.title);
if (listing.nameColor) title.style.setProperty('--quality', '#' + listing.nameColor);
const sub = titles.querySelector('.card-sub');
if (listing.country) sub.appendChild(WtoUi.iconImg('flag', listing.country, 'flag'));
const parts = [];
if (listing.country) parts.push(WtoUi.label(listing.country));
if (listing.rank) parts.push(t('rank', { rank: ROMAN[listing.rank] || listing.rank }));
if (!parts.length) parts.push(WtoUi.text(listing.subtitle));
sub.appendChild(document.createTextNode(parts.join(' · ')));
head.appendChild(titles);
card.appendChild(head);
const badges = document.createElement('div');
badges.className = 'badges';
const badge = (text, owned) => badges.appendChild(Object.assign(document.createElement('span'), { className: 'badge' + (owned ? ' owned' : ''), textContent: text }));
badge('#' + listing.itemdefId, false);
if (listing.couponCount > 0) badge(t('held', { n: listing.couponCount }), true);
if (listing.alreadyActivated) badge(t('activated'), true);
card.appendChild(badges);
const foot = document.createElement('div');
foot.className = 'card-foot';
foot.innerHTML = '<span class="price"></span><div class="buy-actions"></div>';
foot.querySelector('.price').textContent = WtoUi.gjn(listing.gjnCostCents) + ' GJN';
const actions = foot.querySelector('.buy-actions');
if (!state.currentUserId) {
actions.appendChild(Object.assign(document.createElement('button'), { className: 'buy', textContent: t('pickAccount'), disabled: true }));
} else {
const gjnBtn = Object.assign(document.createElement('button'), { className: 'buy', textContent: t('buy') });
gjnBtn.onclick = () => buy(listing.itemdefId, 'gjn');
const freeBtn = Object.assign(document.createElement('button'), { className: 'buy free', textContent: t('freeBuy') });
freeBtn.onclick = () => buy(listing.itemdefId, 'free');
actions.append(gjnBtn, freeBtn);
}
card.appendChild(foot);
function lotCard(listing) {
const card = document.createElement('a');
card.className = 'lot' + (listing.marketHashName === wantedItem ? ' highlight' : '');
const color = '#' + (listing.nameColor || 'afafa1');
card.innerHTML = '<div class="rarity"></div><div class="lot-image"></div><div class="lot-meta"><div class="project"></div><div class="lot-name"></div></div><div class="lot-stats"></div>';
card.querySelector('.rarity').style.background = 'linear-gradient(180deg, ' + color + ', transparent)';
card.querySelector('.lot-image').appendChild(listingImage(listing, ''));
const project = card.querySelector('.project');
if (listing.country) project.appendChild(WtoUi.iconImg('flag', listing.country, ''));
project.appendChild(document.createTextNode(listing.rank ? 'War Thunder · ' + t('rank', { rank: ROMAN[listing.rank] || listing.rank }) : 'War Thunder'));
card.querySelector('.lot-name').textContent = WtoUi.text(listing.title);
const stats = card.querySelector('.lot-stats');
if (listing.couponCount) stats.appendChild(Object.assign(document.createElement('div'), { className: 'lot-held', textContent: t('held', { n: listing.couponCount }) }));
else if (listing.alreadyActivated) stats.appendChild(Object.assign(document.createElement('div'), { className: 'lot-held', textContent: t('owned') }));
const price = document.createElement('div');
price.className = 'lot-price';
price.innerHTML = '<small></small><span></span> GJN';
price.querySelector('small').textContent = t('from');
price.querySelector('span').textContent = WtoUi.gjn(listing.gjnCostCents);
stats.appendChild(price);
card.onclick = () => openDetail(listing);
return card;
}
async function buy(itemdefId, payMethod) {
const result = await WtoUi.postJson('/trade.gaijin.net/api/buy', { userId: state.currentUserId, itemdefId, quantity: 1, payMethod });
WtoUi.showNotice($('notice'), WtoUi.text(result.message), result.ok);
if (result.ok) await loadState(state.currentUserId);
function tag(text, color, extraClass) {
const el = Object.assign(document.createElement('span'), { className: 'tag' + (extraClass ? ' ' + extraClass : ''), textContent: text });
if (color) el.style.background = color;
return el;
}
$('tabs').onclick = (event) => {
const tab = event.target.closest('.tab');
if (!tab) return;
for (const other of document.querySelectorAll('.tab')) other.classList.toggle('active', other === tab);
activeCat = tab.dataset.cat;
renderGrid();
};
$('accountSelect').onchange = (event) => {
WtoUi.saveAccount(event.target.value);
loadState(event.target.value);
};
$('countryFilter').onchange = renderGrid;
$('classFilter').onchange = renderGrid;
function openDetail(listing) {
const color = '#' + (listing.nameColor || 'afafa1');
const detail = $('detail');
detail.style.setProperty('--glow', color);
detail.innerHTML = '<div class="detail-glow"></div><button class="detail-close">×</button><h2 class="detail-title"></h2>'
+ '<div class="detail-info"><div class="detail-image"></div><div class="detail-side"><div class="tags"></div><div class="detail-desc"></div></div></div>'
+ '<div class="orders"><div class="sell-col"></div><div class="buy-col"></div></div><div class="ticker"></div>';
detail.querySelector('.detail-title').textContent = WtoUi.text(listing.title);
detail.querySelector('.detail-image').appendChild(listingImage(listing, ''));
const tags = detail.querySelector('.tags');
tags.appendChild(tag('War Thunder', '', 'game'));
const cat = CATEGORIES.find((c) => c[0] === listing.category);
if (cat) tags.appendChild(tag(t('tagType') + ': ' + t(cat[1]), cat[2]));
const rarity = RARITY[(listing.nameColor || '').toLowerCase()];
if (rarity) tags.appendChild(tag(t('tagRarity') + ': ' + (WtoUi.lang === 'zh' ? rarity[0] : rarity[1]), color));
if (listing.country) tags.appendChild(tag(t('tagCountry') + ': ' + WtoUi.label(listing.country), '#68838c'));
detail.querySelector('.detail-desc').textContent = WtoUi.text(listing.subtitle);
fillOrderColumns(detail, listing);
detail.querySelector('.ticker').textContent = t('ticker');
detail.querySelector('.detail-close').onclick = closeDetail;
$('modal').hidden = false;
}
function fillOrderColumns(detail, listing) {
const fee = Math.round((state.sellFeeRate || 0) * 100);
const sellCol = detail.querySelector('.sell-col');
const buyCol = detail.querySelector('.buy-col');
const noAccount = !state.currentUserId;
const sellBtn = Object.assign(document.createElement('button'), { className: 'big sell', textContent: t('sell'), disabled: noAccount || !listing.couponCount });
sellBtn.onclick = () => trade('/trade.gaijin.net/api/sell', { itemdefId: listing.itemdefId, quantity: 1 }, listing);
sellCol.append(sellBtn, html('totals', t('sellPrice', { price: WtoUi.gjn(listing.sellCents), fee })), html('totals', t('youHave', { n: listing.couponCount || 0 })));
const buyBtn = Object.assign(document.createElement('button'), { className: 'big buy', textContent: noAccount ? t('pickAccount') : t('buy'), disabled: noAccount });
buyBtn.onclick = () => trade('/trade.gaijin.net/api/buy', { itemdefId: listing.itemdefId, quantity: 1, payMethod: 'gjn' }, listing);
const freeBtn = Object.assign(document.createElement('button'), { className: 'big free', textContent: t('freeBuy'), disabled: noAccount });
freeBtn.onclick = () => trade('/trade.gaijin.net/api/buy', { itemdefId: listing.itemdefId, quantity: 1, payMethod: 'free' }, listing);
buyCol.append(buyBtn, freeBtn, html('totals', t('buyPrice', { price: WtoUi.gjn(listing.gjnCostCents) })));
}
function html(className, markup) {
const el = document.createElement('div');
el.className = className;
el.innerHTML = markup;
return el;
}
function closeDetail() { $('modal').hidden = true; }
async function trade(url, body, listing) {
const result = await WtoUi.postJson(url, { userId: state.currentUserId, ...body });
WtoUi.showNotice($('notice'), WtoUi.text(result.message), result.ok);
await loadState(state.currentUserId);
const fresh = state.listings.find((l) => l.itemdefId === listing.itemdefId);
if (fresh && !$('modal').hidden) openDetail(fresh);
}
$('modal').onclick = (event) => { if (event.target === $('modal')) closeDetail(); };
$('accountSelect').onchange = (event) => { WtoUi.saveAccount(event.target.value); loadState(event.target.value); };
for (const id of ['countryFilter', 'classFilter', 'sortSelect', 'heldOnly']) $(id).onchange = renderGrid;
$('searchInput').oninput = renderGrid;
WtoUi.loadLabels().then(() => {
Promise.all([WtoUi.loadLabels(), WtoUi.loadImageSources()]).then(() => {
applyStaticTexts();
return loadState(WtoUi.savedAccount());
});
@@ -3,41 +3,55 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>WTOffline</title>
<link rel="stylesheet" href="/_wto/ui/common.css" />
<title>Gaijin Market · WTOffline</title>
<link rel="stylesheet" href="/trade.gaijin.net/styles.css" />
</head>
<body>
<header class="topbar">
<div class="brand">
<div class="brand-title" data-t="title"></div>
<div class="brand-hint" data-t="hint"></div>
</div>
<div class="wallet">
<a class="link" id="storeLink" data-t="toStore"></a>
<select id="accountSelect"></select>
<span class="pill">GJN<b id="gjnVal">0</b></span>
<span class="pill"><span data-t="eagles"></span><b id="goldVal">0</b></span>
<span class="pill"><span data-t="lions"></span><b id="silverVal">0</b></span>
</div>
<header class="head">
<div class="logo"><span class="logo-top">Gaijin.Net</span><span class="logo-main">MARKET</span></div>
<nav class="nav">
<a class="nav-item" id="storeLink" data-t="toStore"></a>
<span class="nav-item wallet"><span class="coin"></span><b id="gjnVal">0</b></span>
<span class="nav-item muted"><span data-t="eagles"></span> <b id="goldVal">0</b></span>
<select id="accountSelect" class="nav-select"></select>
</nav>
</header>
<main>
<div id="notice" class="notice"></div>
<div class="tabs" id="tabs">
<button class="tab active" data-cat="all" data-t="catAll"></button>
<button class="tab" data-cat="vehicle" data-t="catVehicle"></button>
<button class="tab" data-cat="skin" data-t="catSkin"></button>
<button class="tab" data-cat="attachable" data-t="catAttachable"></button>
<button class="tab" data-cat="decal" data-t="catDecal"></button>
<button class="tab" data-cat="unlock" data-t="catUnlock"></button>
</div>
<div class="filters">
<input id="searchInput" type="search" />
<select id="countryFilter"></select>
<select id="classFilter"></select>
</div>
<div class="grid" id="grid"></div>
</main>
<div class="layout">
<aside class="filters">
<div class="filters-caption" data-t="filters"></div>
<div class="filter-group">
<h3 data-t="itemType"></h3>
<div id="typeFilters"></div>
</div>
<div class="filter-group">
<h3 data-t="country"></h3>
<select id="countryFilter"></select>
</div>
<div class="filter-group">
<h3 data-t="vehicleClass"></h3>
<select id="classFilter"></select>
</div>
<div class="filter-group">
<label class="check"><input type="checkbox" id="heldOnly" /> <span data-t="heldOnly"></span></label>
</div>
</aside>
<main class="screen">
<div id="notice" class="notice"></div>
<div class="controls">
<div class="search"><input id="searchInput" type="search" /></div>
<select id="sortSelect" class="control">
<option value="popular" data-t="sortPopular"></option>
<option value="name" data-t="sortName"></option>
<option value="priceAsc" data-t="sortPriceAsc"></option>
<option value="priceDesc" data-t="sortPriceDesc"></option>
</select>
</div>
<div class="grid" id="grid"></div>
</main>
</div>
<div class="modal" id="modal" hidden>
<div class="card-detail" id="detail"></div>
</div>
<script src="/_wto/ui/common.js"></script>
<script src="/trade.gaijin.net/app.js"></script>
</body>
@@ -1,2 +1,84 @@
/* Marketplace page only; the shared layout is /_wto/ui/common.css. */
.card-title.quality { color: var(--quality, var(--text)); }
/* Local marketplace page, laid out like the official Gaijin Market (implementation notes
section 4; Chromium 100: no :has(), container queries or CSS nesting). Fonts fall back to system fonts. */
:root {
--bg: #1c1f23; --surface: #272a2e; --lift: #2e3238; --cyan: #31e3ee; --red: #bf2d36; --green: #2a826d;
--text: #cbd7dc; --muted: #ffffff80; --hair: #ffffff0d; --disabled: #ffffff24;
--font: Inter, "Source Sans Pro", "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/18px var(--font); min-width: 1024px; }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-thumb { background: var(--disabled); border-radius: 4px; }
.head { position: sticky; top: 0; z-index: 100; height: 72px; display: flex; align-items: center; padding: 8px 16px 4px; background: var(--surface); }
.logo { display: flex; flex-direction: column; color: #fff; }
.logo-top { font-size: 16px; font-weight: 500; opacity: 0.8; line-height: 18px; }
.logo-main { font-size: 22px; font-weight: 700; line-height: 24px; letter-spacing: 0.02em; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.nav-item { display: flex; align-items: center; gap: 6px; height: 40px; padding: 10px 8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav-item:hover { background: var(--hair); }
.nav-item.muted { color: var(--muted); }
.wallet b { color: #ffda7c; font-size: 16px; }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe9a8, #d9a43a 70%); }
.nav-select { height: 40px; padding: 0 10px; border: none; border-radius: 8px; background: var(--lift); color: #fff; font: inherit; }
.layout { display: flex; gap: 24px; padding: 24px; align-items: flex-start; }
.filters { flex: none; width: 250px; padding: 16px; border-radius: 5px; background: var(--surface); font-family: "Golos UI", var(--font); position: sticky; top: 96px; }
.filters-caption { color: #fff; font-size: 16px; font-weight: 700; text-transform: uppercase; margin-bottom: 12px; }
.filter-group { padding: 10px 0; border-top: 1px solid var(--hair); }
.filter-group h3 { margin: 0 0 8px; color: #fff; font-size: 14px; font-weight: 600; }
.filter-group select { width: 100%; height: 34px; border: none; border-radius: 5px; background: var(--lift); color: #fff; font: inherit; padding: 0 8px; }
.check { display: flex; align-items: center; gap: 8px; height: 24px; font-size: 15px; cursor: pointer; }
.check input { accent-color: var(--cyan); }
.screen { flex: 1; min-width: 0; }
.controls { display: flex; gap: 16px; align-items: center; height: 48px; }
.search { flex: 1; max-width: 420px; }
.search input { width: 100%; height: 48px; padding: 8px 16px; border: none; border-radius: 8px; background: #06090d4f; color: #fff; font: 16px var(--font); box-shadow: inset 0 -1px #ffffff1a; outline: none; }
.search input:focus { background: #06090d9e; box-shadow: inset 0 -1px #ffffff4d; }
.control { margin-left: auto; min-width: 180px; height: 40px; border: none; border-radius: 5px; background: var(--surface); color: #fff; font: inherit; padding: 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin: 24px 0; }
.lot { position: relative; display: flex; flex-direction: column; height: 352px; max-width: 260px; border-radius: 5px; background: var(--surface); overflow: hidden; cursor: pointer; transition: transform 0.15s; }
.lot:hover { transform: translateY(-2px); }
.lot.highlight { outline: 2px solid var(--cyan); }
.rarity { position: absolute; left: 0; right: 0; top: 0; height: 45%; opacity: 0.35; }
.rarity::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: inherit; opacity: 1; }
.lot-image { position: relative; height: 180px; display: flex; align-items: center; justify-content: center; padding: 12px; }
.lot-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lot-meta { position: relative; padding: 0 14px; }
.project { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.project img { width: 16px; height: 11px; }
.lot-name { height: 53px; margin: 8px 0; color: #fff; font-size: 16px; line-height: 20px; overflow: hidden; word-break: break-word; }
.lot-stats { margin-top: auto; padding: 0 14px 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lot-held { color: var(--cyan); font-size: 13px; }
.lot-price { color: #fff; font-size: 17px; font-weight: 600; }
.lot-price small { color: #2dd4aa; font-size: 12px; font-weight: 400; margin-right: 4px; }
.empty { color: var(--muted); padding: 40px 0; }
.notice { display: none; margin-bottom: 12px; padding: 10px 14px; border-radius: 8px; background: var(--surface); }
.notice.ok { display: block; color: #2dd4aa; } .notice.err { display: block; color: #ff6b73; }
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; background: #0b0f16db; }
.card-detail { position: relative; width: 960px; margin: 45px auto; border-radius: 5px; background: var(--surface); box-shadow: 0 24px 32px #00000061; overflow: hidden; }
.detail-glow { height: 2px; box-shadow: 0 6px 16px var(--glow); background: var(--glow); }
.detail-title { margin: 29px 64px 16px 24px; color: #fff; font-size: 24px; font-weight: 400; }
.detail-close { position: absolute; top: 2px; right: 0; width: 40px; height: 40px; border: none; background: #0000002b; color: #fff; font-size: 22px; cursor: pointer; }
.detail-info { display: flex; gap: 24px; padding: 0 24px; }
.detail-image { flex: none; width: 440px; height: 260px; display: flex; align-items: center; justify-content: center; border-radius: 5px; background: radial-gradient(50% 50% at 50% 50%, #272a2e99 0%, #272a2ef0 85%, #272a2e 100%), var(--glow); }
.detail-image img { max-width: 92%; max-height: 92%; object-fit: contain; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 10px; border-radius: 2px; color: #000; font-size: 12px; font-weight: 600; }
.tag.game { background: #12151a9e; color: #fff; }
.detail-desc { margin-top: 12px; color: var(--text); }
.orders { display: flex; padding: 32px 24px; gap: 24px; }
.orders > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.big { width: 280px; height: 56px; border: none; border-radius: 5px; color: #fff; font: 700 16px var(--font); cursor: pointer; }
.big.sell { background: var(--green); box-shadow: 0 4px 8px #00392c80; }
.big.buy { background: var(--red); box-shadow: 0 4px 8px #7b000080; }
.big.free { background: transparent; border: 1px solid #ffda7c; color: #ffda7c; box-shadow: none; height: 44px; }
.big:disabled { background: var(--disabled); color: #ffffff66; border-color: transparent; box-shadow: none; cursor: default; }
.totals { color: var(--muted); font-size: 15px; text-align: center; }
.totals b { color: #fff; }
.ticker { padding: 16px 64px; background: #0000001a; color: var(--text); font-weight: 600; }
@@ -1,4 +1,4 @@
/** Typed content of tuning/new-profile.jsonc: a new save's starting money (local verification). */
/** Typed starting balances loaded from tuning/new-profile.jsonc. */
import type { TuningReader } from '../tuning/tuning-reader.ts';
import type { Balance } from './profile-currency.ts';
@@ -1,7 +1,7 @@
/**
* A new account's profile: Gaijin's own new-account template from the player's game files
* (config/default_user.blk), plus the offline starting content (starting-content.ts) and the
* starting money (tuning/new-profile.jsonc; local verification), which the template does not have.
* starting balances defined separately in tuning/new-profile.jsonc.
*/
import type { BlkBlock } from '@wto/blk';
import { setGjnCents, setGoldenEagles, setSilverLions } from './profile-currency.ts';
@@ -4,7 +4,7 @@
* weaponPresets{
* fa_18d_late{
* custom0{
* name:t="编组方案 #1"
* name:t="Custom preset #1"
* Weapon{ preset:t="aim_120_default_slot4" slot:i=4 }
* ...
* }
@@ -7,10 +7,10 @@
* only offer reserve vehicles the player owns (scripts/slotbar/slotbarStateData.nut
* checkReserveUnit: isBought), so without them a new player only has aircraft.
* - Rank I open for research in every country's branches (profile-eras.ts), as online;
* without it the whole tech tree is locked (local verification). Higher ranks open through
* this allows research to start immediately. Higher ranks open through
* research.
* - The base tutorials that gate a difficulty count as completed on every difficulty, so no
* game mode asks for a tutorial first (user quotes 87, 92; the tutorials stay playable).
* game mode requires a tutorial first. The tutorials remain playable.
* The stock rule (gui.vromfs.bin scripts/tutorials/tutorialsState.nut isDiffUnlocked)
* locks historical and simulator battles for a vehicle type until the player has either
* played 60 s in one of them or completed the type's required tutorial on that difficulty;
@@ -1,7 +1,6 @@
/**
* Redeem codes and offline cheat codes (implementation notes section G; implementation notes section
* 5.3; local verification). Which codes exist and what they grant is tuning
* (tuning/redeem-codes.jsonc); the texts shown to the player are built from those values.
* Load redemption codes and their rewards from tuning/redeem-codes.jsonc. Player-facing
* descriptions use the same values.
*/
import type { BlkBlock } from '@wto/blk';
import type { LocalizedText } from '../game-data/datasets/unit-names.ts';
@@ -1,4 +1,4 @@
/** Typed content of tuning/redeem-codes.jsonc (implementation notes; local verification). */
/** Typed redemption code settings from tuning/redeem-codes.jsonc. */
import type { TuningReader } from '../tuning/tuning-reader.ts';
export interface PatternCodeTuning {
@@ -55,7 +55,7 @@ export function buyGjnProduct(profile: BlkBlock, product: StoreProduct, nowFilet
return { ok: true };
}
/** Direct free purchase ("老福爷付过了") for players who prefer not to farm GJN. */
/** Grant a store product using the free offline payment method. */
export function buyFreeStoreProduct(profile: BlkBlock, product: StoreProduct, nowFiletime: bigint): GjnPurchaseOutcome {
if (product.gjnCostCents === undefined) return { ok: false, reason: 'NOT_FOUND' };
if (!canBuyGjnProduct(profile, product, nowFiletime)) return { ok: false, reason: 'ALREADY_BOUGHT' };
+123 -104
View File
@@ -1,30 +1,37 @@
// Local store page, shown in the game's built-in browser.
// Local store page (implementation notes; layout after the official Gaijin.Net store,
// implementation notes), shown in the game's built-in browser.
// The game opens /store?item=<bundle GUID> for a gift vehicle's own pack (item_info.php `url`,
// implementation notes); the page then shows that pack's detail view.
'use strict';
const T = {
zh: {
title: 'WTOffline 本地商店', hint: '买完关闭本窗口,机库会自动刷新', toMarket: '前往交易所',
eagles: '金鹰', lions: '银狮', premium: '高级账户', premiumOff: '未开通', premiumLeft: '剩余 {days} 天',
tabPacks: '礼包载具', tabPremium: '高级账户', tabEagles: '金鹰', tabRedeem: '兑换码',
search: '搜索礼包或载具名称', allCountries: '全部国家', allRanks: '全部等级', rank: '{rank} 级',
includesUnit: '包含载具:{name}', containsEagles: '附赠 {n} 金鹰', containsSilver: '附赠 {n} 银狮', containsPremium: '附赠 {days} 天高级账户', premiumDays: '{days} 天高级账户',
buy: '购买', freeBuy: '老福爷付过了', owned: '已拥有', pickAccount: '请先选择账号', redeem: '兑换', codePlaceholder: '输入兑换码', empty: '没有符合条件的商品',
store: '商店', toMarket: '交易所', eagles: '金鹰', lions: '银狮', premium: '高级账户', premiumOff: '未开通', premiumLeft: '剩余 {days} 天',
tabPacks: '高级载具', tabEagles: '金鹰', tabPremium: '高级帐户', tabRedeem: '优惠码',
search: '搜索礼包或载具', allCountries: '所有国家', allRanks: '所有等级', rank: '{rank} 级', sortBest: '最畅销', sortPriceAsc: '价格从低到高', sortPriceDesc: '价格从高到低',
vehicle: '{name}', containsEagles: '{n} 金鹰', containsSilver: '{n} 银狮', containsPremium: '{days} 天高级账户',
buy: '购买', freeBuy: '老福爷付过了', owned: '已拥有', pickAccount: '请先在右上角选择账号', redeem: '兑换', codePlaceholder: '输入兑换码',
empty: '没有符合条件的商品', includes: '本特惠包包含', back: '‹ 返回目录', bonusTitle: 'Premium bonuses', bonusText: '高级载具获得的银狮与研发点有加成,并可直接使用。',
footer: 'WTOffline 本地商店 · 买完关闭本窗口,机库会自动刷新', badgeOwned: '已拥有', badgeHot: '人气商品',
},
en: {
title: 'WTOffline Store', hint: 'Close this window after buying to refresh the hangar', toMarket: 'Go to Marketplace',
eagles: 'Golden Eagles', lions: 'Silver Lions', premium: 'Premium', premiumOff: 'inactive', premiumLeft: '{days} days left',
tabPacks: 'Vehicle packs', tabPremium: 'Premium Account', tabEagles: 'Golden Eagles', tabRedeem: 'Redeem code',
search: 'Search packs or vehicles', allCountries: 'All nations', allRanks: 'All ranks', rank: 'Rank {rank}',
includesUnit: 'Vehicle: {name}', containsEagles: '+{n} Golden Eagles', containsSilver: '+{n} Silver Lions', containsPremium: '+{days} days of Premium Account', premiumDays: '{days} days of Premium Account',
buy: 'Buy', freeBuy: '老福爷付过了', owned: 'Owned', pickAccount: 'Pick an account first', redeem: 'Redeem', codePlaceholder: 'Enter a code', empty: 'Nothing matches the filters',
store: 'Store', toMarket: 'Market', eagles: 'Golden Eagles', lions: 'Silver Lions', premium: 'Premium', premiumOff: 'inactive', premiumLeft: '{days} days left',
tabPacks: 'Premium vehicles', tabEagles: 'Golden Eagles', tabPremium: 'Premium account', tabRedeem: 'Promo code',
search: 'Search packs or vehicles', allCountries: 'All nations', allRanks: 'All ranks', rank: 'Rank {rank}', sortBest: 'Best-selling', sortPriceAsc: 'Price: low to high', sortPriceDesc: 'Price: high to low',
vehicle: '{name}', containsEagles: '{n} Golden Eagles', containsSilver: '{n} Silver Lions', containsPremium: '{days} days of Premium Account',
buy: 'Buy', freeBuy: '老福爷付过了', owned: 'Owned', pickAccount: 'Pick an account at the top right', redeem: 'Redeem', codePlaceholder: 'Enter a code',
empty: 'Nothing matches the filters', includes: 'This pack includes', back: '‹ Back to catalog', bonusTitle: 'Premium bonuses', bonusText: 'Premium vehicles earn more Silver Lions and research points and are ready to use.',
footer: 'WTOffline local store · close this window after buying to refresh the hangar', badgeOwned: 'Owned', badgeHot: 'Best seller',
},
};
const ROMAN = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
const t = (key, params) => WtoUi.tr(T, key, params);
const $ = (id) => document.getElementById(id);
const wantedGuid = (WtoUi.query.get('item') || '').toUpperCase();
let state = { accounts: [], activeUserId: '', balance: { gjnCents: 0, goldenEagles: 0, silverLions: 0 }, premiumDays: 0, products: [], redeemHelp: [] };
let currentTab = 'vehicle-pack';
let detailId = '';
function applyStaticTexts() {
for (const el of document.querySelectorAll('[data-t]')) el.textContent = t(el.dataset.t);
@@ -35,21 +42,18 @@ function applyStaticTexts() {
async function loadState(userId) {
state = await WtoUi.getJson('/store/api/state' + (userId ? '?userId=' + encodeURIComponent(userId) : ''));
if (userId && !state.activeUserId) {
WtoUi.clearSavedAccount();
return loadState('');
}
renderHeader();
renderFilters();
renderContent();
}
function renderHeader() {
if (userId && !state.activeUserId) { WtoUi.clearSavedAccount(); return loadState(''); }
WtoUi.fillAccountSelect($('accountSelect'), state.accounts, state.activeUserId);
$('gjnVal').textContent = WtoUi.gjn(state.balance.gjnCents);
$('goldVal').textContent = WtoUi.num(state.balance.goldenEagles);
$('silverVal').textContent = WtoUi.num(state.balance.silverLions);
$('premVal').textContent = state.premiumDays > 0 ? t('premiumLeft', { days: state.premiumDays }) : t('premiumOff');
if (wantedGuid && !detailId) {
const wanted = state.products.find((p) => (p.guid || '').toUpperCase() === wantedGuid);
if (wanted) { detailId = wanted.id; currentTab = wanted.kind; }
}
renderFilters();
render();
}
function fillSelect(select, firstText, values, textOf) {
@@ -62,97 +66,116 @@ function fillSelect(select, firstText, values, textOf) {
function renderFilters() {
const packs = state.products.filter((p) => p.kind === 'vehicle-pack');
fillSelect($('countryFilter'), t('allCountries'), [...new Set(packs.map((p) => p.country).filter(Boolean))], WtoUi.label);
const allRanks = packs.flatMap((p) => p.ranks || (p.rank ? [p.rank] : []));
fillSelect($('rankFilter'), t('allRanks'), [...new Set(allRanks)].sort((a, b) => a - b), (r) => t('rank', { rank: ROMAN[r] || r }));
fillSelect($('rankFilter'), t('allRanks'), [...new Set(packs.flatMap((p) => p.ranks || []))].sort((a, b) => a - b), (r) => t('rank', { rank: ROMAN[r] || r }));
}
function matchesFilters(product) {
function matches(product) {
if (product.kind !== currentTab) return false;
if (currentTab !== 'vehicle-pack') return true;
const country = $('countryFilter').value;
const rank = $('rankFilter').value;
const query = $('searchInput').value.trim().toLowerCase();
if (country && product.country !== country) return false;
if (rank && !(product.ranks || [product.rank]).map(String).includes(rank)) return false;
if ($('countryFilter').value && product.country !== $('countryFilter').value) return false;
if ($('rankFilter').value && !(product.ranks || []).map(String).includes($('rankFilter').value)) return false;
if (!query) return true;
const searchTerms = [product.title.zh, product.title.en, product.unitName];
for (const v of product.vehicles || []) searchTerms.push(v.unitName, v.title && v.title.zh, v.title && v.title.en);
return searchTerms.some((s) => (s || '').toLowerCase().includes(query));
const terms = [product.title.zh, product.title.en];
for (const v of product.vehicles || []) terms.push(v.unitName, v.title && v.title.zh, v.title && v.title.en);
return terms.some((s) => (s || '').toLowerCase().includes(query));
}
function renderContent() {
const isRedeem = currentTab === 'redeem';
$('redeemPanel').hidden = !isRedeem;
$('grid').hidden = isRedeem;
function render() {
for (const tab of document.querySelectorAll('.snav-item')) tab.classList.toggle('active', tab.dataset.tab === currentTab);
const product = detailId && state.products.find((p) => p.id === detailId);
$('redeemPanel').hidden = currentTab !== 'redeem';
$('catalog').hidden = currentTab === 'redeem' || !!product;
$('detail').hidden = !product;
$('packFilters').hidden = currentTab !== 'vehicle-pack';
if (isRedeem) return renderRedeemHelp();
if (currentTab === 'redeem') return renderRedeemHelp();
if (product) return renderDetail(product);
const items = state.products.filter(matches);
const mode = $('sortSelect').value;
if (mode === 'priceAsc') items.sort((a, b) => a.gjnCostCents - b.gjnCostCents);
if (mode === 'priceDesc') items.sort((a, b) => b.gjnCostCents - a.gjnCostCents);
const grid = $('grid');
grid.innerHTML = '';
const items = state.products.filter(matchesFilters);
if (items.length === 0) grid.innerHTML = '<div class="empty">' + WtoUi.escapeHtml(t('empty')) + '</div>';
for (const product of items) grid.appendChild(productCard(product));
if (!items.length) grid.innerHTML = '<div class="empty">' + WtoUi.escapeHtml(t('empty')) + '</div>';
for (const item of items) grid.appendChild(productCard(item));
}
function productImage(product, className) {
if (product.unitName) return WtoUi.vehicleImg(product.unitName, className);
return WtoUi.storeImg(product.guid, '', className ? className + ' cover' : 'cover');
}
function contentsOf(product) {
const lines = [];
for (const v of product.vehicles || []) lines.push({ text: WtoUi.text(v.title), vehicle: v });
if (product.premiumDays) lines.push({ text: t('containsPremium', { days: product.premiumDays }) });
if (product.goldIncome) lines.push({ text: t('containsEagles', { n: WtoUi.num(product.goldIncome) }) });
if (product.silverIncome) lines.push({ text: t('containsSilver', { n: WtoUi.num(product.silverIncome) }) });
return lines;
}
function buyButtons(product, mainClass, freeClass) {
const disabled = product.owned || !state.activeUserId;
const main = Object.assign(document.createElement('button'), { className: mainClass, disabled, textContent: product.owned ? t('owned') : (state.activeUserId ? t('buy') : t('pickAccount')) });
main.onclick = (e) => { e.stopPropagation(); buy(product.id, 'gjn'); };
const free = Object.assign(document.createElement('button'), { className: freeClass, disabled, textContent: t('freeBuy') });
free.onclick = (e) => { e.stopPropagation(); buy(product.id, 'free'); };
return [main, free];
}
function productCard(product) {
const card = document.createElement('div');
card.className = 'card';
card.appendChild(productCardHead(product));
const contents = productContents(product);
if (contents.length) {
const list = document.createElement('ul');
list.className = 'contents';
for (const line of contents) list.appendChild(Object.assign(document.createElement('li'), { textContent: line }));
card.appendChild(list);
card.className = 'pw';
card.innerHTML = '<div class="pw-poster"></div><div class="pw-desc"><div class="pw-game">War Thunder</div><div class="pw-title"></div><div class="pw-comment"></div><ul class="pw-contents"></ul></div><div class="pw-price"></div><div class="pw-buy"></div>';
card.querySelector('.pw-poster').appendChild(productImage(product, ''));
if (product.owned) card.querySelector('.pw-poster').appendChild(Object.assign(document.createElement('div'), { className: 'badge owned', textContent: t('badgeOwned') }));
card.querySelector('.pw-title').textContent = WtoUi.text(product.title);
if (product.country) {
const comment = card.querySelector('.pw-comment');
comment.appendChild(WtoUi.iconImg('flag', product.country, ''));
comment.appendChild(document.createTextNode(WtoUi.label(product.country) + ', ' + t('rank', { rank: ROMAN[product.rank] || product.rank })));
}
const foot = document.createElement('div');
foot.className = 'card-foot';
foot.innerHTML = '<span class="price"></span><div class="buy-actions"></div>';
foot.querySelector('.price').textContent = WtoUi.gjn(product.gjnCostCents) + ' GJN';
const actions = foot.querySelector('.buy-actions');
if (product.owned || !state.activeUserId) {
actions.appendChild(Object.assign(document.createElement('button'), {
className: 'buy', textContent: product.owned ? t('owned') : t('pickAccount'), disabled: true,
}));
} else {
const gjnBtn = Object.assign(document.createElement('button'), { className: 'buy', textContent: t('buy') });
gjnBtn.onclick = () => buy(product.id, 'gjn');
const freeBtn = Object.assign(document.createElement('button'), { className: 'buy free', textContent: t('freeBuy') });
freeBtn.onclick = () => buy(product.id, 'free');
actions.append(gjnBtn, freeBtn);
}
card.appendChild(foot);
const list = card.querySelector('.pw-contents');
for (const line of contentsOf(product).slice(1)) list.appendChild(Object.assign(document.createElement('li'), { textContent: line.text }));
card.querySelector('.pw-price').textContent = '$' + WtoUi.gjn(product.gjnCostCents);
card.querySelector('.pw-buy').append(...buyButtons(product, '', ''));
card.onclick = () => { detailId = product.id; render(); window.scrollTo(0, 0); };
return card;
}
function productCardHead(product) {
const head = document.createElement('div');
head.className = 'card-head';
if (product.unitName) head.appendChild(WtoUi.iconImg('vehicle', product.unitName, 'vehicle-icon'));
const titles = document.createElement('div');
titles.innerHTML = '<h3 class="card-title"></h3><div class="card-sub"></div>';
titles.querySelector('.card-title').textContent = WtoUi.text(product.title);
if (product.country) {
const sub = titles.querySelector('.card-sub');
sub.appendChild(WtoUi.iconImg('flag', product.country, 'flag'));
sub.appendChild(document.createTextNode(WtoUi.label(product.country) + ' · ' + t('rank', { rank: ROMAN[product.rank] || product.rank })));
function renderDetail(product) {
const detail = $('detail');
detail.innerHTML = '<span class="back"></span><h1></h1><div class="detail-cols"><div class="detail-left"><div class="media"></div><div class="thumbs"></div>'
+ '<h2></h2><div class="bonus"><h3></h3><div></div></div></div><div class="detail-right"><div class="buy-panel"><div class="price"></div><div class="btns"></div>'
+ '<div class="includes"><h4></h4><ul></ul></div></div></div></div>';
detail.querySelector('.back').textContent = t('back');
detail.querySelector('.back').onclick = () => { detailId = ''; render(); };
detail.querySelector('h1').textContent = WtoUi.text(product.title);
const media = detail.querySelector('.media');
media.appendChild(productImage(product, ''));
const thumbs = detail.querySelector('.thumbs');
for (const v of product.vehicles || []) {
const thumb = WtoUi.vehicleImg(v.unitName, v.unitName === product.unitName ? 'active' : '');
thumb.onclick = () => { media.innerHTML = ''; media.appendChild(WtoUi.vehicleImg(v.unitName, '')); };
thumbs.appendChild(thumb);
}
head.appendChild(titles);
return head;
}
function productContents(product) {
const contents = [];
if (product.vehicles && product.vehicles.length > 1) {
for (const v of product.vehicles) contents.push(t('includesUnit', { name: WtoUi.text(v.title) }));
detail.querySelector('.detail-left h2').textContent = product.vehicles ? product.vehicles.map((v) => WtoUi.text(v.title)).join(' / ') : WtoUi.text(product.title);
detail.querySelector('.bonus h3').textContent = t('bonusTitle');
detail.querySelector('.bonus div').textContent = t('bonusText');
detail.querySelector('.bonus').hidden = product.kind !== 'vehicle-pack';
detail.querySelector('.price').textContent = '$' + WtoUi.gjn(product.gjnCostCents) + ' (GJN)';
detail.querySelector('.btns').append(...buyButtons(product, 'btn-main', 'btn-free'));
detail.querySelector('.includes h4').textContent = t('includes');
const list = detail.querySelector('.includes ul');
for (const line of contentsOf(product)) {
const li = document.createElement('li');
if (line.vehicle && product.country) {
li.appendChild(WtoUi.iconImg('flag', product.country, ''));
li.appendChild(Object.assign(document.createElement('span'), { className: 'rank-chip', textContent: ROMAN[line.vehicle.rank] || line.vehicle.rank }));
}
li.appendChild(document.createTextNode(line.text));
list.appendChild(li);
}
if (product.kind === 'premium-gjn') contents.push(t('premiumDays', { days: product.premiumDays }));
else if (product.premiumDays) contents.push(t('containsPremium', { days: product.premiumDays }));
if (product.kind === 'vehicle-pack' && product.goldIncome) contents.push(t('containsEagles', { n: WtoUi.num(product.goldIncome) }));
if (product.kind === 'vehicle-pack' && product.silverIncome) contents.push(t('containsSilver', { n: WtoUi.num(product.silverIncome) }));
return contents;
}
function renderRedeemHelp() {
@@ -174,21 +197,17 @@ async function redeem() {
await loadState(state.activeUserId);
}
$('accountSelect').onchange = (event) => {
WtoUi.saveAccount(event.target.value);
loadState(event.target.value);
};
$('searchInput').oninput = renderContent;
$('countryFilter').onchange = renderContent;
$('rankFilter').onchange = renderContent;
$('accountSelect').onchange = (event) => { WtoUi.saveAccount(event.target.value); loadState(event.target.value); };
$('searchInput').oninput = render;
for (const id of ['countryFilter', 'rankFilter', 'sortSelect']) $(id).onchange = render;
$('redeemBtn').onclick = redeem;
$('tabs').onclick = (event) => {
const tab = event.target.closest('.tab');
const tab = event.target.closest('.snav-item');
if (!tab) return;
for (const other of document.querySelectorAll('.tab')) other.classList.toggle('active', other === tab);
currentTab = tab.dataset.tab;
renderContent();
detailId = '';
render();
};
applyStaticTexts();
WtoUi.loadLabels().then(() => loadState(WtoUi.savedAccount()));
Promise.all([WtoUi.loadLabels(), WtoUi.loadImageSources()]).then(() => loadState(WtoUi.savedAccount()));
+37 -30
View File
@@ -3,47 +3,54 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>WTOffline</title>
<link rel="stylesheet" href="/_wto/ui/common.css" />
<title>Gaijin.Net Store · WTOffline</title>
<link rel="stylesheet" href="/store/styles.css" />
</head>
<body>
<header class="topbar">
<div class="brand">
<div class="brand-title" data-t="title"></div>
<div class="brand-hint" data-t="hint"></div>
<div class="page">
<div class="gbar">
<span class="gbar-logo">G</span>
<span class="gbar-item active" data-t="store"></span>
<a class="gbar-item" id="marketLink" data-t="toMarket"></a>
<span class="gbar-right">
<span class="gbar-money">GJN <b id="gjnVal">0</b></span>
<span class="gbar-money"><span data-t="eagles"></span> <b id="goldVal">0</b></span>
<span class="gbar-money"><span data-t="lions"></span> <b id="silverVal">0</b></span>
<span class="gbar-money"><span data-t="premium"></span> <b id="premVal"></b></span>
<select id="accountSelect"></select>
</span>
</div>
<div class="wallet">
<a class="link" id="marketLink" data-t="toMarket"></a>
<select id="accountSelect"></select>
<span class="pill">GJN<b id="gjnVal">0</b></span>
<span class="pill"><span data-t="eagles"></span><b id="goldVal">0</b></span>
<span class="pill"><span data-t="lions"></span><b id="silverVal">0</b></span>
<span class="pill"><span data-t="premium"></span><b id="premVal"></b></span>
</div>
</header>
<main>
<nav class="snav" id="tabs">
<span class="wt-logo"><span class="wt-mark"></span>WAR THUNDER</span>
<a class="snav-item active" data-tab="vehicle-pack" data-t="tabPacks"></a>
<a class="snav-item" data-tab="eagles" data-t="tabEagles"></a>
<a class="snav-item" data-tab="premium-gjn" data-t="tabPremium"></a>
<a class="snav-item" data-tab="redeem" data-t="tabRedeem"></a>
</nav>
<div id="notice" class="notice"></div>
<div class="tabs" id="tabs">
<button class="tab active" data-tab="vehicle-pack" data-t="tabPacks"></button>
<button class="tab" data-tab="premium-gjn" data-t="tabPremium"></button>
<button class="tab" data-tab="eagles" data-t="tabEagles"></button>
<button class="tab" data-tab="redeem" data-t="tabRedeem"></button>
</div>
<div class="filters" id="packFilters">
<input id="searchInput" type="search" />
<select id="countryFilter"></select>
<select id="rankFilter"></select>
</div>
<div class="grid" id="grid"></div>
<section id="catalog">
<div class="frow" id="packFilters">
<select id="countryFilter"></select>
<select id="rankFilter"></select>
<input id="searchInput" type="search" />
<select id="sortSelect" class="sort">
<option value="best" data-t="sortBest"></option>
<option value="priceAsc" data-t="sortPriceAsc"></option>
<option value="priceDesc" data-t="sortPriceDesc"></option>
</select>
</div>
<div class="grid" id="grid"></div>
</section>
<section class="detail" id="detail" hidden></section>
<section class="redeem" id="redeemPanel" hidden>
<div class="redeem-row">
<input id="codeInput" type="text" />
<button class="buy" id="redeemBtn" data-t="redeem"></button>
<button class="btn-main" id="redeemBtn" data-t="redeem"></button>
</div>
<ul class="redeem-help" id="redeemHelp"></ul>
</section>
</main>
<footer class="foot" data-t="footer"></footer>
</div>
<script src="/_wto/ui/common.js"></script>
<script src="/store/app.js"></script>
</body>
@@ -1,7 +1,90 @@
/* Store page only; the shared layout is /_wto/ui/common.css. */
.contents { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.redeem { display: flex; flex-direction: column; gap: 12px; max-width: 760px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.redeem-row { display: flex; flex-wrap: wrap; gap: 8px; }
.redeem-row input { flex: 1 1 280px; }
.redeem-help { margin: 0; padding-left: 18px; color: var(--muted); }
.redeem-help li { margin: 2px 0; }
/* Local store page, laid out like the official Gaijin.Net store (implementation notes
section 3; Chromium 100: no :has(), container queries or CSS nesting). Fonts fall back to system fonts. */
:root {
--navy-5: #030c15; --navy-40: #27323f; --navy-60: #2d3a48; --navy-75: #424e5b;
--text: #c0c4c8; --gray-50: #969ca4; --teal: #29b2bc; --teal-hi: #31eeda; --gold: #ffe8aa;
--line: rgba(166, 221, 255, 0.1);
--font: "Fira Sans", "Segoe UI", "Microsoft YaHei", sans-serif; --font-ui: "PT Root UI", var(--font);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--navy-40) linear-gradient(180deg, #1b2530 0%, #27323f 420px); color: var(--text); font: 16px/1.5 var(--font); min-width: 1024px; }
.page { width: 1218px; max-width: calc(100% - 32px); margin: 0 auto; }
.gbar { display: flex; align-items: center; gap: 18px; height: 42px; padding: 0 12px; background: var(--navy-5); font-size: 13px; }
.gbar-logo { width: 22px; height: 22px; border-radius: 4px; background: #d32f2f; color: #fff; font-weight: 700; text-align: center; line-height: 22px; }
.gbar-item { color: var(--text); text-decoration: none; cursor: pointer; }
.gbar-item.active { color: #fff; border-bottom: 2px solid #fff; padding-bottom: 2px; }
.gbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.gbar-money b { color: var(--gold); font-weight: 500; }
.gbar select { height: 28px; border: 1px solid var(--line); border-radius: 3px; background: #0d1823; color: #fff; font: inherit; }
.snav { display: flex; align-items: center; gap: 28px; height: 76px; border-bottom: 1px solid var(--line); font: 18px/27px var(--font-ui); }
.wt-logo { display: flex; align-items: center; gap: 8px; color: #b8bcc1; letter-spacing: 0.12em; font-size: 15px; margin-right: 12px; }
.wt-mark { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, #ff4b3a 30%, #b3170c 70%); }
.snav-item { color: var(--text); text-decoration: none; cursor: pointer; transition: color 0.3s; }
.snav-item:hover, .snav-item.active { color: var(--teal-hi); }
.frow { display: flex; align-items: center; gap: 14px; height: 56px; border-bottom: 1px solid var(--line); }
.frow select, .frow input { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--text); font: 14px var(--font); }
.frow select option { background: var(--navy-60); }
.frow input { width: 260px; }
.frow .sort { margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 24px 0 40px; }
.pw { position: relative; display: flex; flex-direction: column; height: 344px; background: var(--navy-60); overflow: hidden; cursor: pointer; transition: transform 0.3s; }
.pw:hover { transform: translateY(-3px); }
.pw-poster { position: relative; height: 162px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #33475a, var(--navy-60)); }
.pw-poster img { max-width: 92%; max-height: 92%; object-fit: contain; }
.pw-poster img.cover { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.badge { position: absolute; left: 0; right: 0; top: 0; height: 30px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 14px; text-transform: uppercase; background: linear-gradient(90deg, #0050e0, #1a8cff); }
.badge.owned { background: linear-gradient(90deg, #3a8a2a, #6cc04a); }
.pw-desc { flex: 1; padding: 10px 14px 0; min-height: 0; overflow: hidden; }
.pw-game { color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.pw-title { margin: 2px 0 4px; color: #fff; font-size: 18px; line-height: 1.3; max-height: 70px; overflow: hidden; }
.pw-comment { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.pw-comment img { width: 26px; height: 17px; object-fit: contain; }
.pw-contents { margin: 6px 0 0; padding-left: 16px; font-size: 13px; color: var(--gray-50); }
.pw-price { padding: 0 14px 12px; text-align: right; color: var(--gold); font-size: 20px; }
.pw-buy { display: flex; height: 40px; border-top: 1px solid var(--line); }
.pw-buy button { flex: 1; border: none; border-right: 1px solid var(--line); background: transparent; color: var(--gold); font: 16px var(--font-ui); text-transform: uppercase; cursor: pointer; transition: background 0.3s; }
.pw-buy button:last-child { border-right: none; }
.pw-buy button:hover { background: #ffffff0f; }
.pw-buy button:disabled { color: var(--gray-50); cursor: default; background: transparent; }
.empty { grid-column: 1 / -1; color: var(--gray-50); padding: 40px 0; }
.detail { padding: 24px 0 40px; }
.detail h1 { margin: 0 0 20px; color: #fff; font-size: 40px; font-weight: 700; }
.back { color: var(--teal); cursor: pointer; font-size: 15px; display: inline-block; margin-bottom: 12px; }
.detail-cols { display: flex; gap: 24px; align-items: flex-start; }
.detail-left { flex: 1; min-width: 0; }
.media { height: 452px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #3a4d60, #1b2633 75%); }
.media img { max-width: 90%; max-height: 90%; object-fit: contain; }
.media img.cover { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
.thumbs { display: flex; gap: 8px; padding: 8px 0; }
.thumbs img { width: 132px; height: 85px; object-fit: contain; background: #1b2633; border: 2px solid transparent; cursor: pointer; }
.thumbs img.active { border-color: #f9ae3d; }
.detail-left h2 { color: #fff; font-size: 32px; font-weight: 300; margin: 24px 0 8px; }
.bonus { margin-top: 24px; padding: 28px 32px; background: linear-gradient(90deg, #5c5030, #e8d08a); color: #3a2a10; }
.bonus h3 { margin: 0 0 8px; font-size: 32px; text-transform: uppercase; }
.detail-right { flex: none; width: 390px; }
.buy-panel { padding: 24px 40px 28px; background: #1f2a36; text-align: center; }
.buy-panel .price { color: #fff; font-size: 26px; margin: 8px 0 16px; }
.btn-main { width: 310px; max-width: 100%; height: 56px; border: none; border-radius: 3px; background: linear-gradient(180deg, #ff7a2f, #d9381e); color: #fff; font: 26px var(--font-ui); text-transform: uppercase; box-shadow: 0 5px 13px rgba(89, 16, 0, 0.65); cursor: pointer; }
.btn-free { width: 310px; max-width: 100%; height: 44px; margin-top: 12px; border: 1px solid var(--gold); border-radius: 3px; background: transparent; color: var(--gold); font: 18px var(--font-ui); cursor: pointer; }
.btn-main:disabled, .btn-free:disabled { filter: grayscale(1); opacity: 0.7; cursor: default; }
.includes { margin-top: 20px; text-align: left; }
.includes h4 { margin: 0 0 8px; color: var(--text); font-size: 17px; font-weight: 400; }
.includes li { list-style: none; display: flex; align-items: center; gap: 8px; color: #fff; padding: 3px 0; }
.includes img { width: 26px; height: 17px; object-fit: contain; }
.rank-chip { padding: 0 6px; border-radius: 2px; background: #f9ae3d; color: #1b1408; font-size: 13px; font-weight: 700; }
.notice { display: none; margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--line); }
.notice.ok { display: block; color: #98ff87; } .notice.err { display: block; color: #ff9270; }
.redeem { padding: 32px 0 48px; max-width: 760px; }
.redeem-row { display: flex; gap: 12px; }
.redeem-row input { flex: 1; height: 44px; padding: 0 12px; border: 1px solid var(--line); background: #1b2633; color: #fff; font: 16px var(--font); }
.redeem-row .btn-main { width: 180px; height: 44px; font-size: 18px; }
.redeem-help { color: var(--gray-50); padding-left: 18px; }
.foot { padding: 32px 0; border-top: 1px solid var(--line); color: var(--gray-50); font-size: 13px; text-align: center; }
@@ -77,7 +77,7 @@ export class YuplayStoreApi {
const account = this.#account(form);
if (!account) return yuplayAnswer('LOGINERROR', {}, 'item_purchase: unknown token');
const rawPay = form.get('pay');
// YU2_PAY_NONE ("老福爷付过了", gui-patches/online-shop/free-offline-payment-method) omits `pay` in PurchaseAction::run.
// The free offline payment method passes YU2_PAY_NONE, so PurchaseAction::run omits `pay`.
const payMethod = rawPay === null ? 'free' : rawPay.toLowerCase();
if (payMethod !== 'gjn' && payMethod !== 'free') {
return yuplayAnswer('BADPAYMENT', {}, `item_purchase: unsupported pay=${rawPay}`);
@@ -1,28 +1,40 @@
/**
* Files shared by the local web pages, under /_wto/ui/:
* common.css, common.js layout and helpers both pages load
* official-images.json official image paths (static-ggc.gaijin.net) per vehicle /
* decor / item key, from the official market snapshot
*
* labels.json the game's country and vehicle type names (ui-labels dataset)
* vehicle/<vehicle>.svg the game's silhouette icon of a vehicle (web-icons dataset)
* flag/<country>.svg the game's country flag (web-icons dataset)
* asset-pack/<path> the player's own optional copy of official images, made by
* asset-pack-cli.ts into <data folder>/asset-pack/
* Icons and names come from the player's game files at start-up; nothing of Gaijin's is shipped.
* Image order on the pages: asset pack → official site (when reachable) → game files.
*/
import { existsSync, readFileSync } from 'node:fs';
import { join, normalize, sep } from 'node:path';
import type { WebIcons } from '../game-data/datasets/web-icons.ts';
import type { UiLabels } from '../game-data/datasets/ui-labels.ts';
import type { Service, ServiceRequest, ServiceResponse } from '../server/exchange.ts';
import { contentResponse, createStaticWebSite, notFound } from './web-helpers.ts';
const PREFIX = '/_wto/ui/';
const SHARED_FILES = createStaticWebSite(new URL('./web/', import.meta.url), ['common.css', 'common.js']);
const SHARED_FILES = createStaticWebSite(new URL('./web/', import.meta.url), ['common.css', 'common.js', 'official-images.json']);
const ICON_PATH = /^(vehicle|flag)\/([^/]+)\.svg$/;
const PACK_PREFIX = 'asset-pack/';
const PACK_TYPES: Readonly<Record<string, string>> = { '.png': 'image/png', '.jpg': 'image/jpeg', '.webp': 'image/webp', '.json': 'application/json; charset=utf-8' };
export class WebUiService implements Service {
readonly name = 'web-ui';
readonly #icons: WebIcons;
readonly #labels: string;
readonly #packDir: string;
constructor(icons: WebIcons, labels: UiLabels) {
constructor(icons: WebIcons, labels: UiLabels, dataFolder: string) {
this.#icons = icons;
this.#labels = JSON.stringify(labels);
this.#packDir = join(dataFolder, 'asset-pack');
}
accepts(request: ServiceRequest): boolean {
@@ -32,6 +44,7 @@ export class WebUiService implements Service {
handle(request: ServiceRequest): ServiceResponse {
const subPath = request.path.slice(PREFIX.length);
if (subPath === 'labels.json') return contentResponse(subPath, this.#labels, 'web ui: labels');
if (subPath.startsWith(PACK_PREFIX)) return this.#packFile(subPath.slice(PACK_PREFIX.length));
const icon = ICON_PATH.exec(subPath);
if (icon) {
const [, kind, name] = icon;
@@ -41,4 +54,13 @@ export class WebUiService implements Service {
}
return SHARED_FILES.serve(subPath, 'web ui') ?? notFound(`web ui 404: ${subPath}`);
}
/** A file of the player's asset pack; only image/json files inside the pack folder. */
#packFile(relative: string): ServiceResponse {
const decoded = decodeURIComponent(relative);
const full = normalize(join(this.#packDir, decoded));
const type = PACK_TYPES[decoded.slice(decoded.lastIndexOf('.')).toLowerCase()];
if (!type || !full.startsWith(this.#packDir + sep) || !existsSync(full)) return notFound(`asset pack: no ${decoded}`);
return { status: 200, headers: { 'content-type': type, 'cache-control': 'max-age=86400' }, body: readFileSync(full), logNotes: { summary: `asset pack: ${decoded}` } };
}
}
@@ -102,5 +102,74 @@ const WtoUi = (() => {
element.className = 'notice ' + (ok ? 'ok' : 'err');
}
return { lang, query, text, tr, num, gjn, escapeHtml, label, getJson, postJson, loadLabels, iconImg, savedAccount, saveAccount, clearSavedAccount, fillAccountSelect, pageLink, showNotice };
// Resolve images from the player's asset pack, reachable public URLs, or local game data.
const ONLINE_PROBE = 'https://static-ggc.gaijin.net/units/ussr_object_292.png';
let officialImages = { base: 'https://static-ggc.gaijin.net/', byKey: {} };
let packIndex = new Set();
let online = false;
/** Load the official image table, the asset pack index and probe the official site (2.5 s at most). */
async function loadImageSources() {
const table = fetch('/_wto/ui/official-images.json').then((r) => r.json()).then((j) => { officialImages = j; }).catch(() => {});
const pack = fetch('/_wto/ui/asset-pack/index.json').then((r) => (r.ok ? r.json() : [])).then((list) => { packIndex = new Set(list); }).catch(() => {});
const probe = new Promise((resolve) => {
const img = new Image();
const timer = setTimeout(() => resolve(false), 2500);
img.onload = () => { clearTimeout(timer); resolve(true); };
img.onerror = () => { clearTimeout(timer); resolve(false); };
img.src = ONLINE_PROBE + '?t=' + Date.now();
}).then((ok) => { online = ok; });
await Promise.all([table, pack, probe]);
}
/** Candidate image sources for official URLs: asset-pack copies first, then (if online) the URLs. */
function sourcesFor(urls) {
const out = [];
for (const url of urls) {
const key = url.replace(/^https?:\/\//, '');
if (packIndex.has(key)) out.push('/_wto/ui/asset-pack/' + key);
}
if (online) out.push(...urls);
return out;
}
/** An <img> that walks through `sources` and ends at `fallback` (a local URL) or hides itself. */
function tieredImg(sources, fallback, className) {
const img = document.createElement('img');
img.className = className;
img.alt = '';
const queue = [...sources, ...(fallback ? [fallback] : [])];
const next = () => {
const src = queue.shift();
if (src) img.src = src; else img.style.visibility = 'hidden';
};
img.onerror = next;
next();
return img;
}
const officialUrl = (key) => (officialImages.byKey[key] ? officialImages.base + officialImages.byKey[key] : '');
/** A vehicle picture: market render, encyclopedia render, then the game's silhouette. */
function vehicleImg(unitName, className) {
const urls = [officialUrl(unitName), 'https://static.encyclopedia.warthunder.com/images/' + unitName.toLowerCase() + '.png'].filter(Boolean);
return tieredImg(sourcesFor(urls), '/_wto/ui/vehicle/' + encodeURIComponent(unitName) + '.svg', className);
}
/** An item picture by its resource key (decal, attachable, avatar), with an optional local fallback. */
function itemImg(key, fallback, className) {
const url = officialUrl(key);
return tieredImg(sourcesFor(url ? [url] : []), fallback, className);
}
/** A store product picture by its official store GUID, then a fallback. */
function storeImg(guid, fallback, className) {
const urls = guid ? ['https://static-store.gaijin.net/img/items/' + guid + '.jpg'] : [];
return tieredImg(sourcesFor(urls), fallback, className);
}
return {
lang, query, text, tr, num, gjn, escapeHtml, label, getJson, postJson, loadLabels, iconImg, savedAccount, saveAccount,
clearSavedAccount, fillAccountSelect, pageLink, showNotice, loadImageSources, vehicleImg, itemImg, storeImg, tieredImg,
};
})();
@@ -0,0 +1,510 @@
{
"base": "https://static-ggc.gaijin.net/",
"byKey": {
"1items_hat_box": "events/1items_hat_box.png",
"a6m6c": "units/a6m6c_improved.png",
"a_7k": "units/a_7k_improved.png",
"akms_ag": "attachables/akms_ag.png",
"aks_74u": "attachables/aks_74u.png",
"arachis_bull_decal": "decals/arachis_bull_decal.png",
"atrl_light_west_launcher": "attachables/atrl_light_west_launcher.png",
"b7a2_homare_23": "units/b7a2_homare_23_improved.png",
"bear_head": "decals/bear_head.png",
"beaufighter_mk1_40mm": "units/beaufighter_mk1_40mm_improved.png",
"bengal_light_decor": "attachables/bengal_light_decor.png",
"bf-109e-7": "units/bf-109e-7_improved.png",
"bf-109f-4_hungary": "units/bf-109f-4_hungary_improved.png",
"bf-110c-6": "units/bf-110c-6_improved.png",
"bi": "units/bi_improved.png",
"boar_head": "decals/boar_head.png",
"boston_mk_1": "units/boston_mk_1_improved.png",
"box_key_2_07": "items_camouflage_trophy/box_key_2_07.png",
"box_key_2_33": "items_camouflage_trophy/box_key_2_33.png",
"box_key_2_35": "items_camouflage_trophy/box_key_2_35.png",
"box_key_2_37": "items_camouflage_trophy/box_key_2_37.png",
"box_key_2_39": "items_camouflage_trophy/box_key_2_39.png",
"box_key_2_41": "items_camouflage_trophy/box_key_2_41.png",
"box_key_2_43": "items_camouflage_trophy/box_key_2_43.png",
"box_key_2_45": "items_camouflage_trophy/box_key_2_45.png",
"box_key_2_47": "items_camouflage_trophy/box_key_2_47.png",
"box_key_2_49": "items_camouflage_trophy/box_key_2_49.png",
"box_key_2_51": "items_camouflage_trophy/box_key_2_51.png",
"box_key_2_53": "items_camouflage_trophy/box_key_2_53.png",
"box_key_2_55": "items_camouflage_trophy/box_key_2_55.png",
"box_key_2_57": "items_camouflage_trophy/box_key_2_57.png",
"box_key_2_59": "items_camouflage_trophy/box_key_2_59.png",
"box_key_2_61": "items_camouflage_trophy/box_key_2_61.png",
"box_key_apex_predators": "items_camouflage_trophy/box_key_apex_predators.png",
"box_key_danger_zone": "items_camouflage_trophy/box_key_danger_zone.png",
"box_key_direct_hit": "items_camouflage_trophy/box_key_direct_hit.png",
"box_key_drone_age": "items_camouflage_trophy/box_key_drone_age.png",
"box_key_esport": "items_camouflage_trophy/box_key_esport.png",
"box_key_esport_II": "items_camouflage_trophy/box_key_esport_II.png",
"box_key_esport_III": "items_camouflage_trophy/box_key_esport_III.png",
"box_key_fire_and_ice": "items_camouflage_trophy/box_key_fire_and_ice.png",
"box_key_ground_breaking": "items_camouflage_trophy/box_key_ground_breaking.png",
"box_key_kings_of_battle": "items_camouflage_trophy/box_key_kings_of_battle.png",
"box_key_la_royale": "items_camouflage_trophy/box_key_la_royale.png",
"box_key_sky_guardians": "items_camouflage_trophy/box_key_sky_guardians.png",
"box_key_sons_of_attila": "items_camouflage_trophy/box_key_sons_of_attila.png",
"box_key_wind_of_change": "items_camouflage_trophy/box_key_wind_of_change.png",
"box_key_winged_lions": "items_camouflage_trophy/box_key_winged_lions.png",
"box_key_wtcs": "items_camouflage_trophy/box_key_wtcs.png",
"box_key_wtcs_2": "items_camouflage_trophy/box_key_wtcs_2.png",
"box_key_wtcs_3": "items_camouflage_trophy/box_key_wtcs_3.png",
"box_key_wtcs_4": "items_camouflage_trophy/box_key_wtcs_4.png",
"box_key_wtcs_5": "items_camouflage_trophy/box_key_wtcs_5.png",
"box_key_wtcs_6": "items_camouflage_trophy/box_key_wtcs_6.png",
"box_ww_gold": "chests/box_ww_gold.png",
"box_ww_green": "chests/box_ww_green.png",
"bsa_bicycle_fold": "attachables/bsa_bicycle_fold.png",
"buccaneer_s1": "units/buccaneer_s1_improved.png",
"bv-155b-1": "units/bv-155b-1_improved.png",
"cannibal_axe": "attachables/cannibal_axe.png",
"cardicon_33": "avatars/cardicon_33.png",
"cardicon_bundeswehr_infantryman": "avatars/cardicon_bundeswehr_infantryman.png",
"cardicon_centurion": "avatars/cardicon_centurion.png",
"cardicon_ch_special_forces": "avatars/cardicon_ch_special_forces.png",
"cardicon_combat_exoskeleton": "avatars/cardicon_combat_exoskeleton.png",
"cardicon_desert_01_fix": "avatars/cardicon_desert_01_fix.png",
"cardicon_dogfighting_pilot": "avatars/cardicon_dogfighting_pilot.png",
"cardicon_experienced_shooter": "avatars/cardicon_experienced_shooter.png",
"cardicon_football_marathon_2024": "avatars/cardicon_football_marathon_2024.png",
"cardicon_fr_legioner": "avatars/cardicon_fr_legioner.png",
"cardicon_fr_sapper": "avatars/cardicon_fr_sapper.png",
"cardicon_gasmask": "avatars/cardicon_gasmask.png",
"cardicon_germ_tanker_gw": "avatars/cardicon_germ_tanker_gw.png",
"cardicon_hussar_fix": "avatars/cardicon_hussar_fix.png",
"cardicon_ind_pilot_mk": "avatars/cardicon_ind_pilot_mk.png",
"cardicon_jalil_zandi": "avatars/cardicon_jalil_zandi.png",
"cardicon_legioner": "avatars/cardicon_legioner.png",
"cardicon_loot_carrier_driver": "avatars/cardicon_loot_carrier_driver.png",
"cardicon_motolady": "avatars/cardicon_motolady.png",
"cardicon_newyear_23": "avatars/cardicon_newyear_23.png",
"cardicon_option": "avatars/cardicon_option.png",
"cardicon_paratrooper": "avatars/cardicon_paratrooper.png",
"cardicon_poddubny": "avatars/cardicon_poddubny.png",
"cardicon_sw_famale": "avatars/cardicon_sw_famale.png",
"cardicon_tanker_sw_modern_02": "avatars/cardicon_tanker_sw_modern_02.png",
"cardicon_test_driver": "avatars/cardicon_test_driver.png",
"cardicon_toon_bear": "avatars/cardicon_toon_bear.png",
"cardicon_toon_fox": "avatars/cardicon_toon_fox.png",
"cardicon_winter_marathon_2024": "avatars/cardicon_winter_marathon_2024.png",
"cardicon_winter_marathon_2025": "avatars/cardicon_winter_marathon_2025.png",
"cardicon_woman_scout": "avatars/cardicon_woman_scout.png",
"christmas_gnome": "attachables/christmas_gnome.png",
"christmas_gnome_girl": "attachables/christmas_gnome_girl.png",
"christmas_sock_decor": "attachables/christmas_sock_decor.png",
"christmas_tree_decor": "attachables/christmas_tree_decor.png",
"christmas_wreath": "attachables/christmas_wreath.png",
"cn_plz_83_130": "units/cn_plz_83_130.png",
"cn_qn506": "units/cn_qn506_improved.png",
"cn_t_80ud_478be": "units/cn_t_80ud_478be.png",
"cn_type_63_ar": "attachables/cn_type_63_ar.png",
"cn_type_64": "units/cn_type_64_improved.png",
"cn_wz_141": "units/cn_wz_141.png",
"colt_browning_m1895": "attachables/colt_browning_m1895.png",
"cr_32_bis": "units/cr_32_bis_improved.png",
"crock_head": "decals/crock_head.png",
"cuckoo_watch": "attachables/cuckoo_watch.png",
"db_7": "units/db_7_improved.png",
"death_valley_sign": "attachables/death_valley_sign.png",
"decor_black_quadrocopter": "attachables/decor_black_quadrocopter.png",
"decor_bmx": "attachables/decor_bmx.png",
"decor_christmas_board": "attachables/decor_christmas_board.png",
"decor_christmas_deer": "attachables/decor_christmas_deer.png",
"decor_demolition_bomb": "attachables/decor_demolition_bomb.png",
"decor_hut_on_chicken_legs": "attachables/decor_hut_on_chicken_legs.png",
"decor_metall_flame_md": "attachables/decor_metall_flame_md.png",
"decor_nutcraker": "attachables/decor_nutcraker.png",
"decor_snowbike_200": "attachables/decor_snowbike_200.png",
"decor_snowboard": "attachables/decor_snowboard.png",
"decor_snowshoes": "attachables/decor_snowshoes.png",
"decor_wheel_spike_md": "attachables/decor_wheel_spike_md.png",
"douglas_a_1h": "units/douglas_a_1h_improved.png",
"downhill_skating_decal": "decals/downhill_skating_decal.png",
"esport_box_5": "items_camouflage_trophy/esport_box_5.png",
"esport_box_6": "items_camouflage_trophy/esport_box_6.png",
"explore_more_decal": "decals/explore_more_decal.png",
"f-4f": "units/f-4f_improved.png",
"f-5a": "units/f-5a_improved.png",
"f-5ag_norway": "units/f-5ag_norway.png",
"f11f_1_late": "units/f11f_1_late_improved.png",
"f2g-1": "units/f2g-1_improved.png",
"f4d_1": "units/f4d_1_improved.png",
"f4f-4_martlet_mk4": "units/f4f-4_martlet_mk4_improved.png",
"f4u-6_au-1": "units/f4u-6_au-1_improved.png",
"f7f3": "units/f7f3_improved.png",
"f_100f_china": "units/f_100f_china.png",
"f_106a_1972": "units/f_106a_1972.png",
"f_14a_iriaf": "units/f_14a_iriaf_improved.png",
"f_16a_block_5_netherlands": "units/f_16a_block_5_netherlands.png",
"f_16xl": "units/f_16xl.png",
"f_6c_pakistan": "units/f_6c_pakistan.png",
"female_warrior_1": "decals/female_warrior_1.png",
"fire_decal_1": "decals/fire_decal_1.png",
"fire_decal_2": "decals/fire_decal_2.png",
"fire_decal_3": "decals/fire_decal_3.png",
"fire_decal_4": "decals/fire_decal_4.png",
"fire_decal_5": "decals/fire_decal_5.png",
"fire_decal_6": "decals/fire_decal_6.png",
"fire_decal_7": "decals/fire_decal_7.png",
"fire_decal_8": "decals/fire_decal_8.png",
"fire_decal_9": "decals/fire_decal_9.png",
"fj_4b_agm_12b": "units/fj_4b_agm_12b_improved.png",
"fr_amd_35_sa35": "units/fr_amd_35_sa35_improved.png",
"fr_amx_50_1950": "units/fr_amx_50_1950_improved.png",
"fr_amx_50_surblinde": "units/fr_amx_50_surblinde_improved.png",
"fr_amx_elc_901": "units/fr_amx_elc_901.png",
"fr_arras_class_amiens": "units/fr_arras_class_amiens.png",
"fr_battleship_strasbourg": "units/fr_battleship_strasbourg.png",
"fr_m46_patton": "units/fr_m46_patton.png",
"fr_panhard_ebr_1963": "units/fr_panhard_ebr_1963_improved.png",
"fr_trident_class_glaive_p671": "units/fr_trident_class_glaive_p671.png",
"fw-189a-1": "units/fw-189a-1_improved.png",
"fw-190c": "units/fw-190c_improved.png",
"ger_ammunition_wwii_512": "attachables/ger_ammunition_wwii_512.png",
"germ_battlecruiser_mackensen_class": "units/germ_battlecruiser_mackensen_class.png",
"germ_battleship_baden": "units/germ_battleship_baden.png",
"germ_battleship_ostfriesland": "units/germ_battleship_ostfriesland_improved.png",
"germ_boxer_3105": "units/germ_boxer_3105.png",
"germ_destroyer_class1924_jaguar1941": "units/germ_destroyer_class1924_jaguar1941_improved.png",
"germ_frigate_koln_lubeck": "units/germ_frigate_koln_lubeck_improved.png",
"germ_kv_1B_finland": "units/germ_kv_1b_finland_improved.png",
"germ_leopard_2_pt14": "units/germ_leopard_2_pt14_improved.png",
"germ_leopard_2av": "units/germ_leopard_2av_improved.png",
"germ_leopard_c2_mexas": "units/germ_leopard_c2_mexas_improved.png",
"germ_panzerjager_tiger_P_elefant": "units/germ_panzerjager_tiger_P_elefant_improved.png",
"germ_pzkpfw_VI_ausf_h1_tiger_animal_version": "units/germ_pzkpfw_vi_ausf_h1_tiger_animal_version_improved.png",
"germ_pzkpfw_VI_tiger_P": "units/germ_pzkpfw_vi_tiger_p_improved.png",
"germ_sdkfz_234_1": "units/germ_sdkfz_234_1_improved.png",
"germ_sdkfz_234_3": "units/germ_sdkfz_234_3_improved.png",
"germ_sdkfz_234_4": "units/germ_sdkfz_234_4_improved.png",
"germ_sdkfz_251_10": "units/germ_sdkfz_251_10_improved.png",
"germ_spz_12_3": "units/germ_spz_12_3_improved.png",
"germ_th_400": "units/germ_th_400.png",
"germ_th_800_bismark": "units/germ_th_800_bismark_improved.png",
"germ_type143_bussard": "units/germ_type143_bussard_improved.png",
"germ_vilkas": "units/germ_vilkas_improved.png",
"germ_vsw_flak_41": "units/germ_vsw_flak_41_improved.png",
"germ_vt_1_2": "units/germ_vt_1_2_improved.png",
"good_catch_decal": "decals/good_catch_decal.png",
"h-75a-2_finland": "units/h-75a-2_finland_improved.png",
"h_34": "units/h_34_improved.png",
"he-177a-3": "units/he-177a-3.png",
"he51b_2w": "units/he51b_2w_improved.png",
"he_112b_2": "units/he_112b_2_improved.png",
"hydra_badge": "decals/hydra_badge.png",
"i_180": "units/i_180_improved.png",
"i_29": "units/i_29_improved.png",
"iar_93b": "units/iar_93b.png",
"ice_climber_backpack": "attachables/ice_climber_backpack.png",
"il_2_m82": "units/il_2_m82_improved.png",
"il_8_1944": "units/il_8_1944.png",
"il_sholef": "units/il_sholef.png",
"it_albatros_class_f544": "units/it_albatros_class_f544.png",
"it_aubl_74_60_70m": "units/it_aubl_74_60_70m_improved.png",
"it_breda_52_autocannone": "units/it_breda_52_autocannone.png",
"it_cruiser_cadorna_class_cadorna": "units/it_cruiser_cadorna_class_cadorna.png",
"it_fiat_6614_firos": "units/firos_resized.png",
"item_danger_zone_decal": "items_camouflage_trophy/item_danger_zone_decal.png",
"item_eagles_shadow_decal": "items_camouflage_trophy/item_eagles_shadow_decal.png",
"item_g41": "chronicle/item_g41.png",
"item_germany_airforce_emblem": "decals/item_germany_airforce_emblem.png",
"item_germany_tank_emblem": "decals/item_germany_tank_emblem.png",
"item_mauser_98k": "chronicle/item_mauser_98k.png",
"item_mg_ppsh": "chronicle/item_mg_ppsh.png",
"item_mg_ppsh_42": "chronicle/item_mg_ppsh_42.png",
"item_mg_stg_44": "chronicle/item_mg_stg_44.png",
"item_northern_wind_decal": "items_camouflage_trophy/item_northern_wind_decal.png",
"item_ny_marathon_decal_japan_200_2": "decals/item_ny_marathon_decal_japan_200_2.png",
"item_owen_machine_carbine": "chronicle/item_owen_machine_carbine.png",
"item_project_x_decal": "items_camouflage_trophy/item_project_x_decal.png",
"item_sky_odyssey_decal": "items_camouflage_trophy/item_sky_odyssey_decal.png",
"item_summer_ops_girl_ger": "chronicle/item_summer_ops_girl_ger.png",
"item_summer_ops_girl_jp": "chronicle/item_summer_ops_girl_jp.png",
"item_summer_ops_girl_usa": "chronicle/item_summer_ops_girl_usa.png",
"item_supersonic_decal": "items_camouflage_trophy/item_supersonic_decal.png",
"item_svt_40": "chronicle/item_svt_40.png",
"item_symbol_japan": "chronicle/item_symbol_japan.png",
"item_symbol_usa": "chronicle/item_symbol_usa.png",
"item_ussr_airforce_emblem": "decals/item_ussr_airforce_emblem.png",
"item_ussr_tank_emblem": "decals/item_ussr_tank_emblem.png",
"item_viking_fury_decal": "items_camouflage_trophy/item_viking_fury_decal.png",
"items_akms": "attachables/items_akms.png",
"items_box17": "items_box17.png",
"items_box18": "items_box18.png",
"items_box18_1_77": "items_camouflage_trophy/items_box18_1_77.png",
"items_box_1_101": "items_camouflage_trophy/items_box_1_101.png",
"items_box_1_89": "items_camouflage_trophy/items_box_1_89.png",
"items_box_1_91": "items_camouflage_trophy/items_box_1_91.png",
"items_box_1_95": "items_camouflage_trophy/items_box_1_95.png",
"items_box_1_97": "items_camouflage_trophy/items_box_1_97.png",
"items_box_21_1_79": "items_camouflage_trophy/items_box_21_1_79.png",
"items_box_22_1_79_2": "items_camouflage_trophy/items_box_22_1_79_2.png",
"items_box_23_1_81": "items_camouflage_trophy/items_box_23_1_81.png",
"items_box_24_1_85": "items_camouflage_trophy/items_box_24_1_85.png",
"items_box_25_1_87": "items_camouflage_trophy/items_box_25_1_87.png",
"items_box_2_01": "items_camouflage_trophy/items_box_2_01.png",
"items_box_2_03": "items_camouflage_trophy/items_box_2_03.png",
"items_box_2_09": "items_camouflage_trophy/items_box_2_09.png",
"items_box_2_15": "items_camouflage_trophy/items_box_2_15.png",
"items_box_2_19": "items_camouflage_trophy/items_box_2_19.png",
"items_box_2_21": "items_camouflage_trophy/items_box_2_21.png",
"items_box_2_23": "items_camouflage_trophy/items_box_2_23.png",
"items_box_2_25_2": "items_camouflage_trophy/items_box_2_25_2.png",
"items_box_2_27": "items_camouflage_trophy/items_box_2_27.png",
"items_box_2_29": "items_camouflage_trophy/items_box_2_29.png",
"items_box_2_35": "items_camouflage_trophy/items_box_2_35.png",
"items_box_2_39": "items_camouflage_trophy/items_box_2_39.png",
"items_box_2_41": "items_camouflage_trophy/items_box_2_41.png",
"items_box_2_43": "items_camouflage_trophy/items_box_2_43.png",
"items_box_2_49": "items_camouflage_trophy/items_box_2_49.png",
"items_box_2_53": "items_camouflage_trophy/items_box_2_53.png",
"items_box_2_55": "items_camouflage_trophy/items_box_2_55.png",
"items_box_2_57": "items_camouflage_trophy/items_box_2_57.png",
"items_box_2_59": "items_camouflage_trophy/items_box_2_59.png",
"items_box_2_61": "items_camouflage_trophy/items_box_2_61.png",
"items_box_esport": "items_camouflage_trophy/items_box_esport.png",
"items_box_esport_II": "items_camouflage_trophy/items_box_esport_II.png",
"items_box_esport_III": "items_camouflage_trophy/items_box_esport_III.png",
"items_box_key_1_101": "items_camouflage_trophy/items_box_key_1_101.png",
"items_box_key_1_77": "items_camouflage_trophy/items_box_key_1_77.png",
"items_box_key_1_79": "items_camouflage_trophy/items_box_key_1_79.png",
"items_box_key_1_79_2": "items_camouflage_trophy/items_box_key_1_79_2.png",
"items_box_key_1_81": "items_camouflage_trophy/items_box_key_1_81.png",
"items_box_key_1_85": "items_camouflage_trophy/items_box_key_1_85.png",
"items_box_key_1_87": "items_camouflage_trophy/items_box_key_1_87.png",
"items_box_key_1_89": "items_camouflage_trophy/items_box_key_1_89.png",
"items_box_key_1_91": "items_camouflage_trophy/items_box_key_1_91.png",
"items_box_key_1_95": "items_camouflage_trophy/items_box_key_1_95.png",
"items_box_key_1_97": "items_camouflage_trophy/items_box_key_1_97.png",
"items_box_key_1_99": "items_camouflage_trophy/items_box_key_1_99.png",
"items_box_key_2_01": "items_camouflage_trophy/items_box_key_2_01.png",
"items_box_key_2_03": "items_camouflage_trophy/items_box_key_2_03.png",
"items_box_key_2_05": "items_camouflage_trophy/items_box_key_2_05.png",
"items_box_wtcs_2": "items_camouflage_trophy/items_box_wtcs_2.png",
"items_box_wtcs_3": "items_camouflage_trophy/items_box_wtcs_3.png",
"items_box_wtcs_4": "items_camouflage_trophy/items_box_wtcs_4.png",
"items_box_wtsc": "items_camouflage_trophy/items_box_wtsc.png",
"items_famas_f1": "attachables/items_famas_f1.png",
"items_fifa_cup": "items_fifa_2018/items_fifa_cup.png",
"items_foil_hat": "attachables/items_foil_hat.png",
"items_g36k": "attachables/items_g36k.png",
"items_golden_glove": "items_fifa_2018/items_golden_glove.png",
"items_helm_rome_gold": "attachables/items_helm_rome_gold.png",
"items_helmet_hat": "attachables/items_helmet_hat.png",
"items_jester_hat": "attachables/items_jester_hat.png",
"items_l85a1": "attachables/items_l85a1.png",
"items_m4_carbine": "attachables/items_m4_carbine.png",
"items_magic_hat": "attachables/items_magic_hat.png",
"items_pirate_hat": "attachables/items_pirate_hat.png",
"items_rabbit_hat": "attachables/items_rabbit_hat.png",
"items_sombrero_hat": "attachables/items_sombrero_hat.png",
"items_type_89f": "attachables/items_type_89f.png",
"items_uncle_sams_hat": "attachables/items_uncle_sams_hat.png",
"itp_m1": "units/itp_m1_improved.png",
"j6k1": "units/j6k1_improved.png",
"jaguar_e": "units/jaguar_e_improved.png",
"jaguar_is": "units/jaguar_is.png",
"jaws1_decal": "decals/jaws1_decal.png",
"jaws2_decal": "decals/jaws2_decal.png",
"jaws3_decal": "decals/jaws3_decal.png",
"jaws4_decal": "decals/jaws4_decal.png",
"jaws5_decal": "decals/jaws5_decal.png",
"jaws_shark_01": "decals/jaws_shark_01.png",
"jaws_shark_02": "decals/jaws_shark_02.png",
"jaws_shark_03": "decals/jaws_shark_03.png",
"jaws_shark_04": "decals/jaws_shark_04.png",
"jp_armoredcruiser_kurama": "units/jp_armoredcruiser_kurama_4.png",
"jp_battlecruiser_haruna": "units/jp_battlecruiser_haruna_improved.png",
"jp_battlecruiser_kirishima": "units/jp_battlecruiser_kirishima.png",
"jp_battleship_tosa": "units/jp_battleship_tosa.png",
"jp_destroyer_suzutsuki": "units/jp_destroyer_suzutsuki.png",
"jp_destroyer_yugure": "units/jp_destroyer_yugure_improved.png",
"jp_destroyer_yuudachi": "units/jp_destroyer_yuudachi_improved.png",
"jp_escort_hiburi_class_shisaka": "units/jp_escort_hiburi_class_shisaka.png",
"jp_pzkpfw_VI_ausf_e_tiger": "units/jp_pzkpfw_VI_ausf_e_tiger_improved.png",
"ju-388j": "units/ju-388j_improved.png",
"kfir_c10_colombia": "units/kfir_c10_colombia.png",
"kfir_c2": "units/kfir_c2_improved.png",
"ki_21_1hei": "units/ki_21_1hei_improved.png",
"ki_48_2_otsu": "units/ki_48_2_otsu.png",
"ki_94_2": "units/ki_94_2_improved.png",
"kitewing_decal": "decals/kitewing_decal.png",
"l85a1_ag": "attachables/l85a1_ag.png",
"la_174": "units/la_174_improved.png",
"lagg-3-34": "units/lagg-3-34_improved.png",
"lagg-i-301": "units/lagg-i-301_improved.png",
"m249_200": "attachables/m249_200.png",
"m4_late": "attachables/m4_late.png",
"marut_mk1": "units/marut_mk1.png",
"mb_152c1": "units/mb_152c1_improved.png",
"mbr-2": "units/mbr-2_improved.png",
"me-262a-2a": "units/me-262a-2a_improved.png",
"meteor_frmk9_iaf": "units/meteor_frmk9_iaf.png",
"mg3_kws_200": "attachables/mg3_kws_200.png",
"mg_mp40": "attachables/mg_mp40.png",
"mg_thompson": "attachables/mg_thompson.png",
"mig-21_pfm": "units/mig-21_pfm_improved.png",
"mig_23mf_germany": "units/mig_23mf_germany_improved.png",
"mig_25pd": "units/mig_25pd.png",
"minotaur_badge": "decals/minotaur_badge.png",
"mirage_2000c_s4": "units/mirage_2000c_s4_improved.png",
"mosquito_j30_sweden": "units/mosquito_j30_sweden.png",
"ny_marathon_decal_china": "decals/ny_marathon_decal_china.png",
"ny_marathon_decal_italy": "decals/ny_marathon_decal_italy.png",
"ny_pinup_decal_germany": "decals/ny_pinup_decal_germany.png",
"p-26a_34": "units/p-26a_34_improved.png",
"p-38j_marge": "units/p-38j_marge_improved.png",
"p-39q_25_france": "units/p-39q_25_france_improved.png",
"p-40c": "units/p-40c_improved.png",
"p-43a-1": "units/p-43a-1_improved.png",
"p-51b_7_sweden": "units/p-51b_7_sweden_improved.png",
"p-51c-10_france": "units/p-51c-10_france_improved.png",
"p-51c-11-nt_china": "units/p-51c-11-nt_china.png",
"p-59a": "units/p-59a_improved.png",
"p-63c-5_kingcobra_animal_version": "units/p-63c-5_kingcobra_animal_version_improved.png",
"pbm_5a": "units/pbm_5a.png",
"piat": "attachables/piat.png",
"po-2m": "units/po-2m_improved.png",
"powder_day_decal": "decals/powder_day_decal.png",
"pv_2d": "units/pv_2d_improved.png",
"re_2005_vdm": "units/re_2005_vdm.png",
"rpk_200": "attachables/rpk_200.png",
"sailing_catamaran": "attachables/sailing_catamaran.png",
"sb2c_5_thailand": "units/sb2c_5_thailand.png",
"sb_25j_netherlands": "units/sb_25j_netherlands.png",
"secret_santa_decal": "decals/secret_santa_decal.png",
"ski": "attachables/ski.png",
"skier_decal": "decals/skier_decal.png",
"slasher_hatchet": "attachables/slasher_hatchet.png",
"slasher_mask": "attachables/slasher_mask.png",
"sleigh": "attachables/sleigh.png",
"snake_head": "decals/snake_head.png",
"snowkiting_decal": "decals/snowkiting_decal.png",
"snowman_decor": "attachables/snowman_decor.png",
"snowmobile_nkl16": "attachables/snowmobile_nkl16.png",
"spitfire_lf_mk9c_cw_greece": "units/spitfire_lf_mk9c_cw_greece.png",
"spitfire_mk5b_float": "units/spitfire_mk5b_float.png",
"spitfire_mk9c_4cannons": "units/spitfire_mk9c_4cannons_improved.png",
"strikemaster_mk88": "units/strikemaster_mk88.png",
"su-8": "units/su-8_improved.png",
"su_25_558arz": "units/su_25_558arz_improved.png",
"summer_2023_paraglider_decal": "decals/summer_2023_paraglider_decal.png",
"summer_2023_windsurfing_decal": "decals/summer_2023_windsurfing_decal.png",
"summer_2023_wingsuit_decal": "decals/summer_2023_wingsuit_decal.png",
"sw_kungstiger": "units/sw_kungstiger.png",
"sw_patria_amv_ctcv_105": "units/sw_patria_amv_ctcv_105_improved.png",
"sw_patria_bmp_3": "units/sw_patria_bmp_3.png",
"sw_pbil_m40": "units/sw_pbil_m40_improved.png",
"sweden_ak5d": "attachables/sweden_ak5d.png",
"tiger_head": "decals/tiger_head.png",
"times_to_travel_decal": "decals/times_to_travel_decal.png",
"tis_ma": "units/tis_ma_improved.png",
"tornado_ids_de_mfg": "units/tornado_ids_de_mfg_improved.png",
"travel_gramophone": "attachables/travel_gramophone.png",
"type_88_200": "attachables/type_88_200.png",
"uk_a_13_mk2_1939": "units/uk_a_13_mk2_1939_improved.png",
"uk_a_22f_mk_7_churchill_crocodile": "units/uk_a_22f_mk_7_churchill_crocodile_improved.png",
"uk_a_33_excelsior": "units/uk_a_33_excelsior_improved.png",
"uk_a_34_comet_iron_duke": "units/uk_a_34_comet_iron_duke_improved.png",
"uk_alecto_mk_1": "units/uk_alecto_mk_1_improved.png",
"uk_armored_car_aec_mk_2": "units/uk_armored_car_aec_mk_2_improved.png",
"uk_battlecruiser_renown": "units/uk_battlecruiser_renown_improved.png",
"uk_battleship_q_elizabet_class_barham": "units/uk_battleship_q_elizabet_class_barham.png",
"uk_boxer_crv_block2": "units/uk_boxer_crv_block2.png",
"uk_centurion_mk_2": "units/uk_centurion_mk_2_improved.png",
"uk_centurion_mk_5_raac": "units/uk_centurion_mk_5_raac_improved.png",
"uk_churchill_avre": "units/uk_churchill_avre.png",
"uk_cruiser_tiger": "units/uk_cruiser_tiger_improved.png",
"uk_destroyer_g_garland": "units/uk_destroyer_g_garland_improved.png",
"uk_destroyer_tribal_mohawk": "units/uk_destroyer_tribal_mohawk_improved.png",
"uk_frigate_river": "units/uk_frigate_river_improved.png",
"uk_fv107_scimitar_mk2": "units/uk_fv107_scimitar_mk2.png",
"uk_matilda_hedgehog": "units/uk_matilda_hedgehog_improved.png",
"uk_mk1_grant": "units/uk_mk1_grant_improved.png",
"uk_ram_90mm_aa": "units/uk_ram_90mm_aa_improved.png",
"uk_sgb_309": "units/uk_sgb_309_improved.png",
"uk_shir_2": "units/uk_shir_2.png",
"us_ags_teledyne": "units/us_ags_teledyne_improved.png",
"us_battleship_mississippi": "units/us_battleship_mississippi_improved.png",
"us_battleship_oklahoma": "units/us_battleship_oklahoma.png",
"us_browning_m1918": "attachables/us_browning_m1918.png",
"us_browning_m1919a6": "attachables/us_browning_m1919a6.png",
"us_ccvl": "units/us_ccvl_improved.png",
"us_cruiser_baltimore_class": "units/us_cruiser_baltimore_class_improved.png",
"us_cruiser_des_moines_class_newport_news": "units/us_cruiser_des_moines_class_newport_news_improved.png",
"us_destroyer_porter_1944": "units/us_destroyer_porter_1944_improved.png",
"us_destroyer_somers_davis": "units/us_destroyer_somers_davis_improved.png",
"us_efv_p1": "units/us_efv_p1.png",
"us_losat_ccv": "units/us_losat_ccv.png",
"us_lvt_4_zis_2": "units/us_lvt_4_zis_2_improved.png",
"us_m551_76": "units/us_m551_76.png",
"us_m60a3_slep": "units/us_m60a3_slep_improved.png",
"us_m6a2e1": "units/us_m6a2e1_improved_improved.png",
"us_m8_greyhound": "units/us_m8_greyhound_improved.png",
"us_m8a1": "units/us_m8a1_improved.png",
"us_merkava_mk_1": "units/us_merkava_mk_1_improved.png",
"us_merkava_mk_2b_late": "units/us_merkava_mk_2b_late_improved.png",
"us_merkava_mk_3d": "units/us_merkava_mk_3d_improved.png",
"us_pt811": "units/us_pt811_improved.png",
"us_t18_e2": "units/us_t18_e2_improved.png",
"us_t30": "units/us_t30_improved.png",
"us_t86": "units/us_t86.png",
"us_xm_8": "units/us_xm_8_improved.png",
"usa_ciras_land_512": "attachables/usa_ciras_land_512.png",
"ussr_a_12_mk_2_matilda_2A_F96": "units/ussr_a_12_mk_2_matilda_2A_F96_improved.png",
"ussr_ammunition_wwii_512": "attachables/ussr_ammunition_wwii_512.png",
"ussr_ba_11": "units/ussr_ba_11_improved.png",
"ussr_battleship_oktyabrskaya_revolutsiya": "units/ussr_battleship_oktyabrskaya_revolutsiya.png",
"ussr_bm_13n": "units/ussr_bm_13n_improved.png",
"ussr_bmd_4": "units/ussr_bmd_4_improved.png",
"ussr_body_armor_6b43": "attachables/ussr_body_armor_6b43.png",
"ussr_bt_7a_f32": "units/ussr_bt_7a_f32_improved.png",
"ussr_cruiser_maxim_gorky": "units/ussr_cruiser_maxim_gorky_improved.png",
"ussr_cruiser_omaha_class_murmansk": "units/ussr_cruiser_omaha_class_murmansk.png",
"ussr_cruiser_shcherbakov": "units/ussr_cruiser_shcherbakov_improved.png",
"ussr_destroyer_leningrad": "units/ussr_destroyer_leningrad_improved.png",
"ussr_is_7": "units/ussr_is_7_improved.png",
"ussr_kv_220": "units/ussr_kv_220_improved.png",
"ussr_kv_2_1940": "units/ussr_kv_2_1940_improved.png",
"ussr_kv_8": "units/ussr_kv_8.png",
"ussr_m3c": "units/ussr_m3c_improved.png",
"ussr_marines": "decals/ussr_marines.png",
"ussr_mbk_161_1943": "units/ussr_mbk_161_1943_improved.png",
"ussr_mpk_122bis": "units/ussr_mpk_122bis_improved.png",
"ussr_mpk_201k": "units/ussr_mpk_201k_improved.png",
"ussr_object_248": "units/ussr_object_248_improved.png",
"ussr_object_279": "units/ussr_object_279_improved.png",
"ussr_object_292": "units/ussr_object_292.png",
"ussr_pr_205pe_k225": "units/ussr_pr_205pe_k225.png",
"ussr_pt_76_57": "units/ussr_pt_76_57_improved.png",
"ussr_pzkpfw_V": "units/ussr_pzkpfw_v_improved.png",
"ussr_rbt_5": "units/ussr_rbt_5_improved.png",
"ussr_su_76d": "units/ussr_su_76d_improved.png",
"ussr_su_76m_5st_kav_corps": "units/ussr_su_76m_5st_kav_corps_reworkerd.png",
"ussr_su_85a": "units/ussr_su_85a_improved.png",
"ussr_t_10a": "units/ussr_t_10a_improved.png",
"ussr_t_26E": "units/ussr_t_26E_improved.png",
"ussr_t_34E": "units/ussr_t_34E_improved.png",
"ussr_t_34_85_zis_53_v80": "units/ussr_t_34_85_zis_53_v80.png",
"ussr_t_44_po": "units/ussr_t_44_po.png",
"ussr_t_72b3_arena": "units/ussr_t_72b3_arena.png",
"ussr_t_72m2_moderna": "units/ussr_t_72m2_moderna_improved.png",
"ussr_t_80um2": "units/ussr_t_80um2_improved.png",
"ussr_text_silny": "decals/ussr_text_silny.png",
"ussr_text_smely": "decals/ussr_text_smely.png",
"ussr_type_62": "units/ussr_type_62_improved.png",
"vespiary": "attachables/vespiary.png",
"waffenhalter": "attachables/waffenhalter.png",
"we_can_climb_it_decal": "decals/we_can_climb_it_decal.png",
"whirlwind_p9": "units/whirlwind_p9_improved.png",
"willys_mb_dec": "attachables/willys_mb_dec.png",
"wolf_head": "decals/wolf_head.png",
"ww_chinese_farm": "decals/ww_chinese_farm.png",
"xf5f": "units/xf5f_improved.png",
"yak-3_eremin": "units/yak-3_eremin.png",
"yak-9t_france": "units/yak-9t_france_improved.png"
}
}
+16 -16
View File
@@ -1,44 +1,44 @@
// 联队(功能清单 I 节;implementation notes 第 1~3 节)。原版的联队名录、活跃度结算由服务器维护,这里都是离线版的取值。
// Local squadron catalogue and activity rules.
{
// 活跃度和联队研发点。前四项本地服务原样写进联队信息回复给客户端(maxActivityPerPeriod、maxClanActivity、rewardPeriodDays、historyDepth)。
// Set activity and squadron RP. The service reports maxActivityPerPeriod, maxClanActivity, rewardPeriodDays, and historyDepth in squadron replies.
"activity": {
"maxPerPeriod": 360, // 每个结算周期的活跃度上限
"squadronRpPerFullPeriod": 20000, // 活跃度满额时一个周期得到的联队研发点
"rewardPeriodDays": 3, // 结算周期(天)
"historyDepthDays": 14, // 客户端显示的活跃度历史长度(天)
// 玩家加入或创建联队时直接给几个满额周期的记录,不用真等几天就能研发联队载具(implementation notes 第 3.4 节)
"maxPerPeriod": 360, // Activity cap per reward period.
"squadronRpPerFullPeriod": 20000, // Squadron RP awarded for a full activity period.
"rewardPeriodDays": 3, // Reward period in days.
"historyDepthDays": 14, // Activity history displayed by the client, in days.
// Seed full periods on creation or joining so squadron research can start immediately.
"startingPeriods": 3
},
// 成员上限:正式联队,以及战斗群(battalion)刚建立时的上限(战斗群扩编的费用和步长来自游戏数据 warpoints.blk)
// Set the full squadron cap and initial battalion cap. Expansion cost and step size are read from warpoints.blk.
"memberLimits": { "normal": 128, "battalionInitial": 10 },
// 联队排行榜上显示的周期活跃度 = min(maxActivity, 成员当前活跃度之和 × activityMultiplier),让几名 NPC 也能显示出满编联队的规模
// Displayed leaderboard activity is min(maxActivity, summed member activity * activityMultiplier), so small NPC rosters can represent full squadrons.
"leaderboard": { "activityMultiplier": 10, "maxActivity": 100000 },
// 玩家新建联队的编号从这里开始
// Starting ID for player-created squadrons.
"firstNewClanId": 600001,
// 玩家的个人联队评分(街机、历史、全真):自己建队时、加入别人的联队时
// Personal arcade, realistic, and simulator squadron ratings for squadron creation and joining.
"playerRating": {
"founder": { "arc": 1500, "hist": 1500, "sim": 1500 },
"joiner": { "arc": 1450, "hist": 1500, "sim": 1400 }
},
// 第一次运行时生成的预置联队(<数据目录>/clans.json 不存在时)
// Seed these squadrons when clans.json does not yet exist in the data directory.
"presetClans": {
"createdDaysAgo": 180, // 第一支预置联队的建立时间;每支联队再加上自己的 createdAfterDays
"createdDaysAgo": 180, // Age of the first seeded squadron before applying each squadron's createdAfterDays offset.
"memberJoinSpacingMinutes": 60,
// 每支预置联队的累计战绩(客户端联队信息里的统计)
// Lifetime stats displayed for each seeded squadron.
"stats": {
"akills_arc": 4280, "akills_hist": 6150, "akills_sim": 1420,
"gkills_arc": 7890, "gkills_hist": 11240, "gkills_sim": 2680,
"deaths_arc": 5120, "deaths_hist": 6890, "deaths_sim": 1950,
"ftime_arc": 18400, "ftime_hist": 32600, "ftime_sim": 8900
},
// NPC 成员的个人评分 = max(下限, 联队评分 − 排位序号 × 步长),按街机、历史、全真分别算
// For each game mode, subtract the rank offset from the squadron rating and use the configured minimum as the lower bound.
"memberRating": { "step": { "arc": 45, "hist": 50, "sim": 40 }, "floor": { "arc": 800, "hist": 850, "sim": 700 } },
// role:LEADER(指挥官)、DEPUTY(副指挥官)、OFFICER(军官)、SERGEANT(军士)、REGULAR(普通成员);activity 是当前周期活跃度
// role is LEADER, DEPUTY, OFFICER, SERGEANT, or REGULAR. activity is the current period's activity.
"clans": [
{
"id": "500001", "tag": "[WTOF]", "name": "War Thunder Offline Guard", "type": "normal",
+3 -3
View File
@@ -1,7 +1,7 @@
// 离线版自定的上限(原版由服务器决定,客户端数据里没有)。游戏规定的上限(例如备用载具最多 100 个,scripts/weaponry/weaponryConsts.nut)不在这里,按游戏的来。
// Limits defined by the offline service. Limits enforced by the game, such as the spare cap in weaponryConsts.nut, are defined separately.
{
// 一次最多买几张经典道具(cln_buy_item 的数量)
// Maximum classic item quantity per cln_buy_item purchase.
"itemPiecesPerPurchase": 1000,
// 存档里最多保留几条开箱记录(userlogs,客户端用它播放开箱动画、核对奖品),超出的删最早的
// Maximum retained chest records. The client uses userlogs for chest animations and rewards. Older entries are evicted first.
"userLogsKept": 80
}
+11 -11
View File
@@ -1,16 +1,16 @@
// 本地交易所(功能清单 G 节"市场";implementation notes 第 6、8 节):用 GJN 买兑换券,买到的券进游戏库存。
// GJN 可以写两位小数(官方 GJN 价格等于美元价格)。
// The local marketplace sells coupons for GJN and places purchases in the game inventory.
// GJN supports two decimal places and uses the official USD-equivalent prices.
{
// 每次最多买几张
// Maximum coupon quantity per purchase.
"maxPerPurchase": 20,
// 卖给系统时扣除的手续费比例(0~0.99)。官方交易所的手续费是 15%(classInfo.market_fee = 0.15)。
// Fee withheld when selling coupons back to the system, from 0 to 0.99. The official marketplace fee is 15% (classInfo.market_fee = 0.15).
"sellFeeRate": 0.15,
// 载具券(shop.blk 里有 marketplaceItemdefId 的载具)
// Vehicle coupons use vehicles with a marketplaceItemdefId in shop.blk.
"vehicleCoupons": {
// 单辆车的价格(GJN)。来源:官方交易所快照 implementation notes
// (2026-11-26,取最低卖价;无人在售时取最高求购价);快照里没有的车保留原作者 2026-11-02 的记录。
// Per-vehicle GJN prices use implementation notes.
// Use the lowest sell listing or the highest buy order when no sell listing exists. Keep the 2026-11-02 reference price for unmatched vehicles.
"byVehicle": {
"a6m6c": 27.96,
"a_7k": 91.9,
@@ -246,18 +246,18 @@
"yak-3_eremin": 35.0,
"yak-9t_france": 37.8
},
// 上表没有的载具(例如游戏更新新加的)按等级定价:取第一个 upToRank 不小于载具等级的档位。离线版自定。
// For unlisted vehicles, use the first upToRank tier at or above the vehicle's rank.
"byRank": [
{ "upToRank": 1, "gjn": 8 }, { "upToRank": 2, "gjn": 14 }, { "upToRank": 3, "gjn": 22 }, { "upToRank": 4, "gjn": 35 },
{ "upToRank": 5, "gjn": 48 }, { "upToRank": 6, "gjn": 59 }, { "upToRank": 7, "gjn": 69 }, { "upToRank": 99, "gjn": 75 }
],
// 券的品质(决定名字颜色),按载具等级。离线版自定。
// Vehicle rank determines coupon rarity and the displayed name color.
"qualityByRank": [ { "upToRank": 3, "quality": 2 }, { "upToRank": 5, "quality": 3 }, { "upToRank": 99, "quality": 4 } ]
},
// 外观券和解锁券:每类一个价格(GJN)和品质。离线版自定。
// Cosmetic and unlock coupon prices and rarities have category defaults.
"cosmeticCoupons": {
// 按资源名(贴花、挂件、头像解锁名)单独定价(GJN),来源同上快照;没有的按下面各类默认价。
// Resource-specific GJN prices use the same snapshot. Unlisted resources use the category default.
"byResource": {
"akms_ag": 0.55,
"aks_74u": 0.88,
@@ -1,4 +1,4 @@
// 新存档的初始货币(原话 98:新存档初始 500 金鹰、15 万银狮,和正版新账号一样)。gjn 可以写两位小数。
// Starting balances for a new save. GJN supports two decimal places.
{
"silverLions": 150000,
"goldenEagles": 500,
@@ -1,8 +1,8 @@
// 经典道具回收与再合成(功能清单 H 节"融炼 / 合成";implementation notes 第 6、8 节)。
// 回收:每件经典道具回收成哪种零件,由游戏数据 config/items.blk 的 recycleItemResult 决定(不在这里)。
// 再合成:零件换随机经典道具的配方,原版由服务器下发,离线版自定,就是下面这些。
// Classic item recycling and synthesis.
// config/items.blk defines each classic item's recycling output in recycleItemResult.
// Local recipes exchange parts for a random classic item.
{
// 零件在库存里显示的名字;键是零件编号(items.blk 的 recycleItemResult)。
// Inventory labels keyed by the recycleItemResult part ID from items.blk.
"partNames": {
"299000": { "zh": "备用载具回收组件", "en": "Spare Supply Fragment" },
"299001": { "zh": "加成卡回收组件", "en": "Booster Fragment" },
@@ -10,12 +10,12 @@
"299003": { "zh": "任务令回收组件", "en": "Order Fragment" },
"299004": { "zh": "合同回收组件", "en": "Wager Fragment" }
},
// 同种零件几个换一件该类随机道具
// Number of parts of the same type required to synthesize one item.
"partsPerItem": 2,
// 每种零件最多能换出几种道具(该类的永久道具按名字排序后取前几种)
// Maximum eligible reward types per part. Select permanent items by name.
"itemsPerPart": 8,
// 一张包装券给几个道具;没写的道具给 1 个
// Number of items awarded per packaging coupon. Unlisted items grant one.
"piecesPerItem": { "item_universal_spare": 3 },
// 某种零件没有可换的道具时(例如折扣券都是限时的),改为换这些零件对应的道具
// Use these fallback rewards if a part has no eligible items, such as a category that contains only time-limited discounts.
"fallbackParts": [299000, 299001]
}
@@ -1,22 +1,22 @@
// 兑换码(功能清单 G 节;implementation notes 第 5.3 节)。在本地网页商店和游戏原生的兑换码窗口里都能用,输入不分大小写。
// 原话 116:GJN 充值码和新手礼包码保留,定位是给玩家的作弊码。
// Redemption codes work in the local web store and the in-game dialog. Input is case-insensitive.
// GJN balance codes and the starter code are optional offline cheats.
{
// 高级账户天数码:<前缀>-<天数>D,例如 PREMIUM-30D。
// Premium time codes use <prefix>-<days>D, for example PREMIUM-30D.
"premiumDays": {
"prefixes": ["PREMIUM", "WTO-PREM", "PREM", "VIP"],
"maxDays": 3650,
// 页面上展示的示例
// Examples shown in the store.
"examples": ["PREMIUM-7D", "PREMIUM-30D", "PREMIUM-365D"]
},
// GJN 充值码(作弊码):<前缀>-<数量>,例如 WTO-GJN-1000。
// Optional GJN cheats use <prefix>-<amount>, for example WTO-GJN-1000.
"gjn": {
"prefixes": ["WTO-GJN", "GJN"],
"maxAmount": 1000000,
"examples": ["WTO-GJN-100", "WTO-GJN-1000"]
},
// 固定兑换码:每个存档只能用一次。奖励可以写 premiumDays(高级账户天数)、goldenEagles(金鹰)、silverLions(银狮)、gjn,不写的就是 0。
// Fixed codes are redeemable once per save. Omitted premiumDays, goldenEagles, silverLions, and gjn rewards default to zero.
"fixedCodes": {
"WTO-STARTER": { "premiumDays": 7, "goldenEagles": 1000, "gjn": 100 }
}
+8 -8
View File
@@ -1,13 +1,13 @@
// 研发的离线版自定规则(implementation notes 第 4.5 节)。
// Offline research target selection.
{
// 当前研发目标完成或被买下后,若同一研发线的直接后继载具(reqAir 指向刚完成的这辆)已可研发,优先接续它。
// When the target is completed or purchased, prefer an eligible same-line successor whose reqAir references it.
"preferLineSuccessor": true,
// 没有同线直接后继(如新存档、当前研发线到头或下一等级尚未开放)时,从该系可研发载具里挑哪一辆:
// 原版也由服务器自动选(客户端函数 shop_get_countries_list_with_autoset_units 读的就是服务器自动设的研发目标),
// 但怎么选是服务器的规则,客户端里没有,所以这里是离线版自定;玩家随时可以在科技树里改选。
// "highestRank" 等级最高的(与原版"选择下一个研发目标"窗口默认挑车一致,优先推进当前已开放的最高等级);同等级选所需研发点最少的,再相同按科技树先后
// "lowestRank" 等级最低的;同等级选所需研发点最少的,再相同按科技树先后
// "treeOrder" 科技树里排在最前面的
// When no direct successor is eligible, choose among the branch's researchable vehicles.
// The client reads the default target from the server through shop_get_countries_list_with_autoset_units.
// The offline service selects the default. Players can select another vehicle in the tech tree.
// highestRank starts with the highest eligible rank, matching the default next-target dialog. Break ties by required RP, then tree order.
// lowestRank starts with the lowest eligible rank. Break ties by required RP, then tree order.
// treeOrder selects the first eligible vehicle in tech tree order.
"autoTargetPick": "highestRank"
}
+22 -22
View File
@@ -1,12 +1,12 @@
// 本地商店的商品和价格(功能清单 G 节;implementation notes 第 5、8 节)。
// 原版的这些价格由 Gaijin 服务器下发,游戏文件里没有;这里是离线版的取值,出处见 implementation notes 第 8 节。
// Local store products and prices.
// The stock store receives prices from the server. The offline price sources are documented in implementation notes.
{
// GJN 价格一律是官方 Gaijin 商店的美元价,1 GJN = 1 美元(用户原话 121)。
// GJN prices use the official USD prices at 1 GJN per USD.
// 金鹰包:用 GJN 买(游戏内的付款窗口、本地网页商店)。
// id 必须和游戏 aces.vromfs.bin 的 config/gui.blk bundles/guid 里的名字一致,游戏靠它找到商品。
// 档位和价格按官方商店 catalog.php?category=GoldenEagles(2026-11-25):官方只卖这 6 档(gui.blk 里另有 500、15000、20000 三档,官方不卖);
// 5000 以上三档官方页面同时标原价和现价($33、$66、$165),这里取现价。
// Golden Eagle packs use GJN in both the in-game payment dialog and the local web store.
// The id must match the entry in bundles/guid in config/gui.blk from aces.vromfs.bin.
// These six tiers were available in the official GoldenEagles catalogue on 2026-11-25.
// For tiers of 5,000 Eagles or more, use the listed sale price instead of the original price.
"goldenEaglePacks": [
{ "id": "eagles150", "goldenEagles": 150, "gjn": 0.99 },
{ "id": "eagles1000", "goldenEagles": 1000, "gjn": 6.6 },
@@ -16,7 +16,7 @@
{ "id": "eagles25000", "goldenEagles": 25000, "gjn": 114 }
],
// 银狮包:在游戏内的货币商店里用金鹰买。数值来自原作者项目 backend/COMMERCE.md(原作者注明出处是社区 wiki wikiwiki.jp 的"課金"页)。
// Silver Lion packs cost Golden Eagles. The reference pricing table cites the community wiki's pricing page.
"silverLionPacks": [
{ "id": "warpoints1k", "silverLions": 1000, "goldenEagles": 3 },
{ "id": "warpoints11k", "silverLions": 11000, "goldenEagles": 30 },
@@ -26,7 +26,7 @@
{ "id": "warpoints1300k", "silverLions": 1300000, "goldenEagles": 3000 }
],
// 高级账户:在游戏内的高级账户窗口里用金鹰买。
// These premium account terms are purchased with Golden Eagles in the game.
"premiumForGoldenEagles": [
{ "id": "prem_1d", "days": 1, "goldenEagles": 190 },
{ "id": "prem_7d", "days": 7, "goldenEagles": 690 },
@@ -36,20 +36,20 @@
{ "id": "prem_365d", "days": 365, "goldenEagles": 14900 }
],
// 高级账户:用 GJN 买。id 必须和构建写进 gui.blk 的名字一致(packages/build/src/main-pack.ts EXTRA_STORE_BUNDLE_GUIDS)。
// 档位和价格按官方商店 catalog.php?category=PremiumAccount(2026-11-25)。
// These premium account terms are purchased with GJN. Their IDs must match the build's bundle GUID entries.
// Terms and prices use the official PremiumAccount catalogue from 2026-11-25.
"premiumForGjn": [
{ "id": "wto_prem_20d", "days": 20, "gjn": 7.49 },
{ "id": "wto_prem_60d", "days": 60, "gjn": 19.99 },
{ "id": "wto_prem_180d", "days": 180, "gjn": 39.99 }
],
// 礼包载具:按官方礼包售卖(多车礼包一次给多辆车及附赠内容,其余科技树礼包车每辆车一个礼包),用 GJN 买(或用"老福爷付过了"直接买下)。
// Vehicle packs contain one or more vehicles and their bonuses. The local store supports GJN and free offline payment.
"vehiclePacks": {
// 多车礼包(5 个三车礼包、9 个国家的新手礼包;用户原话 123 方案 A):买下一次发放列表中全部载具及附赠的金鹰、高级账户天数、银狮。
// 这里列出的载具不再另外生成单车礼包。名称不手写,运行时从玩家的游戏语言包读取:
// - groupKey:取 lang/units.csv 的科技树折叠组名(如 shop/group/germ_tiger_east_west_group)拼成礼包名;
// - starter: true:取第一辆车所属国家在 lang/menu.csv 的国家名拼成新手礼包名。
// Multi-vehicle and national starter packs grant the listed vehicles, Golden Eagles, premium time, and Silver Lions in one purchase.
// Vehicles in these packs are excluded from single-vehicle packs. Pack names are generated from game localization data.
// groupKey uses the tech tree group name from lang/units.csv, such as shop/group/germ_tiger_east_west_group.
// starter uses the first vehicle's country name from lang/_common_languages.csv.
"multiVehiclePacks": [
{
"id": "wto_pack_two_fronts",
@@ -173,9 +173,9 @@
"silverLions": 120000
}
],
// 默认内容按载具等级:取第一个 upToRank 不小于载具等级的档位。
// 只用于官方价格查不到的车(implementation notes 第 8 节)。每档取官方礼包在该等级最常见的价格和附赠内容;
// 2 级官方没有单车礼包,按上面的规则落到 3 级那档。
// Choose the first upToRank tier that includes the vehicle's rank.
// Fallback tiers use the most common official price and pack contents when an exact official price is unavailable.
// Rank II falls under the rank III tier because the official catalogue has no rank II single-vehicle pack.
"byRank": [
{ "upToRank": 1, "gjn": 4.99, "goldenEagles": 0, "premiumDays": 7 },
{ "upToRank": 3, "gjn": 34.99, "goldenEagles": 1000, "premiumDays": 15 },
@@ -185,9 +185,9 @@
{ "upToRank": 7, "gjn": 69.99, "goldenEagles": 2500, "premiumDays": 20 },
{ "upToRank": 99, "gjn": 79.99, "goldenEagles": 3000, "premiumDays": 30 }
],
// 单辆车的礼包内容,覆盖按等级的默认值;键是载具名(char.vromfs.bin config/wpcost.blk)。
// 价格是官方礼包的美元价(implementation notes,出处见 implementation notes 第 8 节);
// 附赠的金鹰和高级账户天数按官方礼包页面写的内容。
// Per-vehicle overrides use vehicle IDs from config/wpcost.blk in char.vromfs.bin.
// GJN prices use the official USD prices in implementation notes.
// Golden Eagle and premium time bonuses match the listed pack contents.
"byVehicle": {
"a-26c-45-dt": {"gjn": 19.99, "goldenEagles": 2000, "premiumDays": 15},
"a_10a_early": {"gjn": 59.99, "goldenEagles": 2000, "premiumDays": 15},
@@ -1,12 +1,12 @@
// 新版库存里的银狮补给箱(道具商店里用银狮买,开箱掉落兑换券或经典道具;implementation notes 第 6~8 节)。
// 原作者没有对应的箱子,下面的数值都是离线版自定。
// External inventory supply chests cost Silver Lions and award coupons or classic items.
// The offline service defines these chest prices and rewards.
//
// 每组奖品写一种,"weightEach" 是组里每一项的权重:
// { "classicItems": { "recyclePart": 零件编号, "pick": 取几种 } } 经典道具包装券,按回收零件分类(299000 备用载具、299001 加成卡、299002 折扣、299003 任务令、299004 合同),按名字排序后取前几种
// { "coupons": { "kind": "skin|decal|attachable", "skip": 跳过前几张, "pick": 取几张 } } 外观兑换券,按编号排序
// { "marketVehicles": { "minRank": 1, "maxRank": 4, "pick": 6 } } 交易所载具券,按等级、国家、名字排序后各国轮流取
// Use one entry format per reward group. weightEach applies to each selected item.
// classicItems selects permanent item coupons by recyclePart, then takes the first pick items by name. See recycling.jsonc for part IDs.
// coupons selects cosmetic coupons by kind, then applies skip and pick in item ID order.
// marketVehicles selects vehicle coupons within the rank range, rotating by nation and ordering by rank and name.
{
// 开箱一次最多买几个(游戏道具商店里的数量上限)
// Maximum number of chests per purchase in the in-game item shop.
"maxPerPurchase": 10,
"chests": [
{
+14 -14
View File
@@ -1,19 +1,19 @@
// 经典战利品箱(功能清单 H 节"银狮补给箱""奖池载具直购";implementation notes 第 7、8 节)。
// 原版的箱子由服务器下发,客户端数据里没有;客户端按奖品权重自己算出并公示每项概率(calcTrophiesDropChance)。
// Classic trophy chests, including Silver Lion supply chests and direct event vehicle purchases.
// The server supplies chest definitions. The client uses calcTrophiesDropChance to display probabilities from the item weights.
//
// 每项奖品写一种:
// { "silverLions": 数量, "weight": 权重 }
// { "goldenEagles": 数量, "weight": 权重 }
// { "item": "道具名", "count": 张数, "weight": 权重 } 道具名见 char.vromfs.bin config/items.blk
// { "itemsOfType": "道具类型", "pick": 取几种, "count": 每种张数, ... } 类型:rateBooster、wager、universalSpare 等;只取永久道具,按名字排序后取前几种
// { "eventVehicles": { "minRank": 1, "maxRank": 3, "pick": 4 }, ... } 活动载具(不在交易所卖的),按等级、国家、名字排序后各国轮流取
// 一组奖品(itemsOfType、eventVehicles)写 "weightEach"(每项的权重)或 "weightTotal"(整组的权重,平分给每项)。
// 已拥有的载具不会被抽到。
// Use one entry format per reward.
// { "silverLions": <amount>, "weight": <weight> }
// { "goldenEagles": <amount>, "weight": <weight> }
// { "item": "<item name>", "count": <quantity>, "weight": <weight> } uses an item name from config/items.blk in char.vromfs.bin.
// { "itemsOfType": "<type>", "pick": <items to select>, "count": <quantity per item>, ... } takes the first permanent items by name.
// { "eventVehicles": { "minRank": 1, "maxRank": 3, "pick": 4 }, ... } selects non-market event vehicles by rank, nation rotation, and name.
// For grouped rewards, weightEach applies to each reward and weightTotal is divided evenly across the group.
// Owned vehicles are excluded from the draw.
{
"supplyTrophies": [
{
// 银狮补给箱。价格和奖品权重来自原作者项目 data/offline-crate-rules.json(silverPerDraw、rawWeights,
// 权重相加为 100,即每抽的百分比)。原作者的"50 GJN"奖品(权重 0.01)在经典战利品箱里没有对应的奖品类型,没有放进来。
// The Silver Lion chest uses silverPerDraw and rawWeights from the reference offline-crate-rules.json.
// The reference weights sum to 100. The classic trophy format has no GJN reward, so the 50 GJN entry is omitted.
"id": "wto_silver_supply_trophy",
"iconStyle": "small_wooden_box",
"silverLions": 60000,
@@ -33,7 +33,7 @@
]
},
{
// 老兵补给箱:原作者没有对应的箱子,离线版自定。
// The Veteran Supply Chest uses offline-specific prices and rewards.
"id": "wto_veteran_supply_trophy",
"iconStyle": "big_chest",
"silverLions": 150000,
@@ -49,6 +49,6 @@
}
],
// 奖池载具直购:每辆活动载具一个只能买一次的箱子,用金鹰买。价格来自原作者 offline-crate-rules.json 的 directVehiclePriceGE。
// Each event vehicle has a one-time Golden Eagle purchase. The price comes from directVehiclePriceGE in the reference chest rules.
"directVehicles": { "goldenEagles": 20000 }
}