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