mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-20 04:14:12 +01: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
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkrieg",
|
"name": "blitzkrieg",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const periodNames: Record<Period, string> = {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: false,
|
inDevelopment: true,
|
||||||
inPublic: true,
|
inPublic: true,
|
||||||
|
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ export default function GenericStats({
|
|||||||
stats,
|
stats,
|
||||||
columnCount = 2,
|
columnCount = 2,
|
||||||
}: GenericStatsProps) {
|
}: GenericStatsProps) {
|
||||||
const itemsPerRow = Math.ceil(stats.length / columnCount);
|
const filteredStats = stats.filter(([, value]) => value !== `${-Infinity}`);
|
||||||
|
const itemsPerRow = Math.ceil(filteredStats.length / columnCount);
|
||||||
const columns: Stat[][] = [];
|
const columns: Stat[][] = [];
|
||||||
|
|
||||||
stats.forEach((stat, index) => {
|
filteredStats.forEach((stat, index) => {
|
||||||
const column = Math.floor(index / itemsPerRow);
|
const column = Math.floor(index / itemsPerRow);
|
||||||
if (!columns[column]) columns[column] = [];
|
if (!columns[column]) columns[column] = [];
|
||||||
columns[column].push(stat);
|
columns[column].push(stat);
|
||||||
|
|||||||
@@ -95,25 +95,28 @@ export default async function getTankStatsOverTime(
|
|||||||
return Math.max(get(latest.all), get(previous.all));
|
return Math.max(get(latest.all), get(previous.all));
|
||||||
}
|
}
|
||||||
|
|
||||||
tanksBeforeAndAfter[tankId] = {
|
// check if there was a change in battles as games in ratings do update last_battle_time
|
||||||
battles: diff((a) => a.battles),
|
if (diff((a) => a.battles) > 0) {
|
||||||
capture_points: diff((a) => a.capture_points),
|
tanksBeforeAndAfter[tankId] = {
|
||||||
damage_dealt: diff((a) => a.damage_dealt),
|
battles: diff((a) => a.battles),
|
||||||
damage_received: diff((a) => a.damage_received),
|
capture_points: diff((a) => a.capture_points),
|
||||||
dropped_capture_points: diff((a) => a.dropped_capture_points),
|
damage_dealt: diff((a) => a.damage_dealt),
|
||||||
frags: diff((a) => a.frags),
|
damage_received: diff((a) => a.damage_received),
|
||||||
frags8p: diff((a) => a.frags8p),
|
dropped_capture_points: diff((a) => a.dropped_capture_points),
|
||||||
hits: diff((a) => a.hits),
|
frags: diff((a) => a.frags),
|
||||||
losses: diff((a) => a.losses),
|
frags8p: diff((a) => a.frags8p),
|
||||||
max_frags: max((a) => a.max_frags),
|
hits: diff((a) => a.hits),
|
||||||
max_xp: max((a) => a.max_xp),
|
losses: diff((a) => a.losses),
|
||||||
shots: diff((a) => a.shots),
|
max_frags: max((a) => a.max_frags),
|
||||||
spotted: diff((a) => a.spotted),
|
max_xp: max((a) => a.max_xp),
|
||||||
survived_battles: diff((a) => a.survived_battles),
|
shots: diff((a) => a.shots),
|
||||||
win_and_survived: diff((a) => a.win_and_survived),
|
spotted: diff((a) => a.spotted),
|
||||||
wins: diff((a) => a.wins),
|
survived_battles: diff((a) => a.survived_battles),
|
||||||
xp: diff((a) => a.xp),
|
win_and_survived: diff((a) => a.win_and_survived),
|
||||||
};
|
wins: diff((a) => a.wins),
|
||||||
|
xp: diff((a) => a.xp),
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return tanksBeforeAndAfter;
|
return tanksBeforeAndAfter;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import isDev from '../process/isDev.js';
|
||||||
|
|
||||||
export type TankType = 'heavyTank' | 'AT-SPG' | 'mediumTank' | 'lightTank';
|
export type TankType = 'heavyTank' | 'AT-SPG' | 'mediumTank' | 'lightTank';
|
||||||
|
|
||||||
export interface Tankopedia {
|
export interface Tankopedia {
|
||||||
@@ -54,18 +56,20 @@ export const TANK_TYPE_EMOJIS: Record<TankType, string> = {
|
|||||||
lightTank: '🇱',
|
lightTank: '🇱',
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Encoding tank images...');
|
if (!isDev()) {
|
||||||
await Promise.all(
|
console.log('Encoding tank images...');
|
||||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
await Promise.all(
|
||||||
if (tank.images.normal) {
|
Object.entries(tankopedia).map(async ([, tank]) => {
|
||||||
const response = await fetch(tank.images.normal);
|
if (tank.images.normal) {
|
||||||
const blob = await response.arrayBuffer();
|
const response = await fetch(tank.images.normal);
|
||||||
const base64 = `data:${response.headers.get(
|
const blob = await response.arrayBuffer();
|
||||||
'content-type',
|
const base64 = `data:${response.headers.get(
|
||||||
)};base64,${Buffer.from(blob).toString('base64')}`;
|
'content-type',
|
||||||
|
)};base64,${Buffer.from(blob).toString('base64')}`;
|
||||||
|
|
||||||
tank.images.normal = base64;
|
tank.images.normal = base64;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
console.log('Encoded tank images');
|
console.log('Encoded tank images');
|
||||||
|
}
|
||||||
Reference in new issue
Block a user