mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: 1.3.3
This commit is contained in:
1 parent
d62708c21e
commit
7a6de17c1c
5 files changed
+45
-37
No files matched your search
@@ -95,25 +95,28 @@ export default async function getTankStatsOverTime(
|
||||
return Math.max(get(latest.all), get(previous.all));
|
||||
}
|
||||
|
||||
tanksBeforeAndAfter[tankId] = {
|
||||
battles: diff((a) => a.battles),
|
||||
capture_points: diff((a) => a.capture_points),
|
||||
damage_dealt: diff((a) => a.damage_dealt),
|
||||
damage_received: diff((a) => a.damage_received),
|
||||
dropped_capture_points: diff((a) => a.dropped_capture_points),
|
||||
frags: diff((a) => a.frags),
|
||||
frags8p: diff((a) => a.frags8p),
|
||||
hits: diff((a) => a.hits),
|
||||
losses: diff((a) => a.losses),
|
||||
max_frags: max((a) => a.max_frags),
|
||||
max_xp: max((a) => a.max_xp),
|
||||
shots: diff((a) => a.shots),
|
||||
spotted: diff((a) => a.spotted),
|
||||
survived_battles: diff((a) => a.survived_battles),
|
||||
win_and_survived: diff((a) => a.win_and_survived),
|
||||
wins: diff((a) => a.wins),
|
||||
xp: diff((a) => a.xp),
|
||||
};
|
||||
// check if there was a change in battles as games in ratings do update last_battle_time
|
||||
if (diff((a) => a.battles) > 0) {
|
||||
tanksBeforeAndAfter[tankId] = {
|
||||
battles: diff((a) => a.battles),
|
||||
capture_points: diff((a) => a.capture_points),
|
||||
damage_dealt: diff((a) => a.damage_dealt),
|
||||
damage_received: diff((a) => a.damage_received),
|
||||
dropped_capture_points: diff((a) => a.dropped_capture_points),
|
||||
frags: diff((a) => a.frags),
|
||||
frags8p: diff((a) => a.frags8p),
|
||||
hits: diff((a) => a.hits),
|
||||
losses: diff((a) => a.losses),
|
||||
max_frags: max((a) => a.max_frags),
|
||||
max_xp: max((a) => a.max_xp),
|
||||
shots: diff((a) => a.shots),
|
||||
spotted: diff((a) => a.spotted),
|
||||
survived_battles: diff((a) => a.survived_battles),
|
||||
win_and_survived: diff((a) => a.win_and_survived),
|
||||
wins: diff((a) => a.wins),
|
||||
xp: diff((a) => a.xp),
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return tanksBeforeAndAfter;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import isDev from '../process/isDev.js';
|
||||
|
||||
export type TankType = 'heavyTank' | 'AT-SPG' | 'mediumTank' | 'lightTank';
|
||||
|
||||
export interface Tankopedia {
|
||||
@@ -54,18 +56,20 @@ export const TANK_TYPE_EMOJIS: Record<TankType, string> = {
|
||||
lightTank: '🇱',
|
||||
};
|
||||
|
||||
console.log('Encoding tank images...');
|
||||
await Promise.all(
|
||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
||||
if (tank.images.normal) {
|
||||
const response = await fetch(tank.images.normal);
|
||||
const blob = await response.arrayBuffer();
|
||||
const base64 = `data:${response.headers.get(
|
||||
'content-type',
|
||||
)};base64,${Buffer.from(blob).toString('base64')}`;
|
||||
if (!isDev()) {
|
||||
console.log('Encoding tank images...');
|
||||
await Promise.all(
|
||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
||||
if (tank.images.normal) {
|
||||
const response = await fetch(tank.images.normal);
|
||||
const blob = await response.arrayBuffer();
|
||||
const base64 = `data:${response.headers.get(
|
||||
'content-type',
|
||||
)};base64,${Buffer.from(blob).toString('base64')}`;
|
||||
|
||||
tank.images.normal = base64;
|
||||
}
|
||||
}),
|
||||
);
|
||||
console.log('Encoded tank images');
|
||||
tank.images.normal = base64;
|
||||
}
|
||||
}),
|
||||
);
|
||||
console.log('Encoded tank images');
|
||||
}
|
||||
Reference in new issue
Block a user