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

@@ -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"
}
}