mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
Merge pull request #2 from tresabhi/1.5.2
This commit is contained in:
5 files changed
+31
-34
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkrieg",
|
"name": "blitzkrieg",
|
||||||
"version": "1.5.1",
|
"version": "1.5.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import { PlayerClanData } from '../types/playerClanData.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: false,
|
inDevelopment: true,
|
||||||
inPublic: true,
|
inPublic: true,
|
||||||
|
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
@@ -88,9 +88,12 @@ export default {
|
|||||||
WN8:
|
WN8:
|
||||||
entries.reduce((accumulator, [tankIdString, stats]) => {
|
entries.reduce((accumulator, [tankIdString, stats]) => {
|
||||||
const tankId = Number(tankIdString);
|
const tankId = Number(tankIdString);
|
||||||
const tankWN8 = getWN8(tankAverages[tankId].all, stats);
|
|
||||||
|
|
||||||
return accumulator + tankWN8 * stats.battles;
|
// edge case where new tanks don't have averages
|
||||||
|
if (tankAverages[tankId]) {
|
||||||
|
const tankWN8 = getWN8(tankAverages[tankId].all, stats);
|
||||||
|
return accumulator + tankWN8 * stats.battles;
|
||||||
|
} else return accumulator;
|
||||||
}, 0) / totalBattles,
|
}, 0) / totalBattles,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+6
-11
@@ -21,7 +21,6 @@ import last5AM from '../core/blitzstars/last5AM.js';
|
|||||||
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
||||||
import cmdName from '../core/interaction/cmdName.js';
|
import cmdName from '../core/interaction/cmdName.js';
|
||||||
import fullBlitzStarsStats from '../core/interaction/fullBlitzStarsStats.js';
|
import fullBlitzStarsStats from '../core/interaction/fullBlitzStarsStats.js';
|
||||||
import infoEmbed from '../core/interaction/infoEmbed.js';
|
|
||||||
import { supportBlitzStars } from '../core/interaction/supportBlitzStars.js';
|
import { supportBlitzStars } from '../core/interaction/supportBlitzStars.js';
|
||||||
import addUsernameOption from '../core/options/addUsernameOption.js';
|
import addUsernameOption from '../core/options/addUsernameOption.js';
|
||||||
import { args } from '../core/process/args.js';
|
import { args } from '../core/process/args.js';
|
||||||
@@ -33,7 +32,7 @@ import { TanksStats } from '../types/tanksStats.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: false,
|
inDevelopment: true,
|
||||||
inPublic: true,
|
inPublic: true,
|
||||||
|
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
@@ -83,7 +82,7 @@ export default {
|
|||||||
(accumulator, [tankIdString, tankStats]) => {
|
(accumulator, [tankIdString, tankStats]) => {
|
||||||
const tankId = Number(tankIdString);
|
const tankId = Number(tankIdString);
|
||||||
|
|
||||||
return tankId === 0
|
return tankId === 0 || tankAverages[tankId] === undefined
|
||||||
? accumulator
|
? accumulator
|
||||||
: {
|
: {
|
||||||
...accumulator,
|
...accumulator,
|
||||||
@@ -93,10 +92,10 @@ export default {
|
|||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
const careerWN8s = tankStatsOverTimeEntries.reduce<Record<number, number>>(
|
const careerWN8s = tankStatsOverTimeEntries.reduce<Record<number, number>>(
|
||||||
(accumulator, [tankIdString, tankStats]) => {
|
(accumulator, [tankIdString]) => {
|
||||||
const tankId = Number(tankIdString);
|
const tankId = Number(tankIdString);
|
||||||
|
|
||||||
return tankId === 0
|
return tankId === 0 || tankAverages[tankId] === undefined
|
||||||
? accumulator
|
? accumulator
|
||||||
: {
|
: {
|
||||||
...accumulator,
|
...accumulator,
|
||||||
@@ -141,8 +140,8 @@ export default {
|
|||||||
name={tankId === 0 ? 'Total' : resolveTankName(Number(tankIdString))}
|
name={tankId === 0 ? 'Total' : resolveTankName(Number(tankIdString))}
|
||||||
winrate={tankStats.wins / tankStats.battles}
|
winrate={tankStats.wins / tankStats.battles}
|
||||||
careerWinrate={career.wins / career.battles}
|
careerWinrate={career.wins / career.battles}
|
||||||
WN8={todayWN8s[tankId]}
|
WN8={isNaN(todayWN8s[tankId]) ? undefined : todayWN8s[tankId]}
|
||||||
careerWN8={careerWN8s[tankId]}
|
careerWN8={isNaN(careerWN8s[tankId]) ? undefined : careerWN8s[tankId]}
|
||||||
damage={tankStats.damage_dealt / tankStats.battles}
|
damage={tankStats.damage_dealt / tankStats.battles}
|
||||||
careerDamage={career.damage_dealt / career.battles}
|
careerDamage={career.damage_dealt / career.battles}
|
||||||
survival={tankStats.survived_battles / tankStats.battles}
|
survival={tankStats.survived_battles / tankStats.battles}
|
||||||
@@ -189,10 +188,6 @@ export default {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds:
|
|
||||||
rows.length >= 6
|
|
||||||
? [infoEmbed('Very large image!', "Don't forget to oom in.")]
|
|
||||||
: undefined,
|
|
||||||
files: [image],
|
files: [image],
|
||||||
components: [actionRow],
|
components: [actionRow],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ export interface RowProps {
|
|||||||
name: string;
|
name: string;
|
||||||
winrate: number;
|
winrate: number;
|
||||||
careerWinrate: number;
|
careerWinrate: number;
|
||||||
WN8: number;
|
WN8?: number;
|
||||||
careerWN8: number;
|
careerWN8?: number;
|
||||||
damage: number;
|
damage: number;
|
||||||
careerDamage: number;
|
careerDamage: number;
|
||||||
survival: number;
|
survival: number;
|
||||||
@@ -42,9 +42,9 @@ export function Row({
|
|||||||
/>
|
/>
|
||||||
<RowStat
|
<RowStat
|
||||||
name="WN8"
|
name="WN8"
|
||||||
value={WN8.toFixed(0)}
|
value={WN8 === undefined ? '--' : WN8.toFixed(0)}
|
||||||
career={careerWN8.toFixed(0)}
|
career={careerWN8 === undefined ? '--' : careerWN8.toFixed(0)}
|
||||||
percentile={getWN8Percentile(WN8)}
|
percentile={WN8 === undefined ? undefined : getWN8Percentile(WN8)}
|
||||||
/>
|
/>
|
||||||
<RowStat
|
<RowStat
|
||||||
name="Damage"
|
name="Damage"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { WargamingResponse } from '../../types/wargamingResponse.js';
|
import { WargamingResponse } from '../../types/wargamingResponse.js';
|
||||||
import URLToBase64 from '../ui/URLToBase64.js';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
"1": {
|
"1": {
|
||||||
@@ -57,16 +56,16 @@ export const TANK_IDS = Object.keys(tankopedia).map((id) => Number(id));
|
|||||||
export const TANKS = TANK_IDS.map((id) => tankopedia[id]);
|
export const TANKS = TANK_IDS.map((id) => tankopedia[id]);
|
||||||
export const TANK_NAMES = TANKS.map((tank) => tank.name);
|
export const TANK_NAMES = TANKS.map((tank) => tank.name);
|
||||||
|
|
||||||
console.log('Encoding tank images...');
|
// console.log('Encoding tank images...');
|
||||||
await Promise.all(
|
// await Promise.all(
|
||||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
// Object.entries(tankopedia).map(async ([, tank]) => {
|
||||||
try {
|
// try {
|
||||||
tank.images.normal = await URLToBase64(tank.images.normal);
|
// tank.images.normal = await URLToBase64(tank.images.normal);
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.warn(
|
// console.warn(
|
||||||
`Failed to encode tank image for ${tank.images.normal}: ${error}`,
|
// `Failed to encode tank image for ${tank.images.normal}: ${error}`,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}),
|
// }),
|
||||||
);
|
// );
|
||||||
console.log('Encoded tank images');
|
// console.log('Encoded tank images');
|
||||||
Reference in new issue
Block a user