feat: migrated tankopedia pages

This commit is contained in:
TrèsAbhi committed 2024-09-07 20:40:06 -05:00
1 parent 135dd85a82
commit 9ae8b0ac49
30 files changed
+77 -19

No files matched your search

+4 -5
View File
@@ -1,8 +1,7 @@
import { assertSecret } from '@blitzkit/core/src/blitzkit/assertSecret';
import { ASSETS_REPO } from '../../../../src/constants/assets';
import { assertSecret } from './assertSecret';
export function asset(path: string) {
return `https://raw.githubusercontent.com/tresabhi/${ASSETS_REPO}/${assertSecret(
process.env.NEXT_PUBLIC_ASSET_BRANCH,
)}/${path}`;
return `https://raw.githubusercontent.com/${assertSecret(
process.env.NEXT_PUBLIC_ASSET_REPO,
)}/${assertSecret(process.env.NEXT_PUBLIC_ASSET_BRANCH)}/${path}`;
}
@@ -0,0 +1,3 @@
export function degressiveStat(crew: number) {
return 0.875 / (0.00375 * 100 * crew + 0.5) - 1;
}
+5 -1
View File
@@ -7,6 +7,7 @@ export * from './checkConsumableProvisionInclusivity';
export * from './coefficient';
export * from './consumableDefinitions';
export * from './createDefaultSkills';
export * from './degressiveStat';
export * from './equipmentDefinitions';
export * from './eventManager';
export * from './fetchCdonLz4';
@@ -14,8 +15,10 @@ export * from './filterTank';
export * from './gameDefinitions';
export * from './isExplosive';
export * from './modelDefinitions';
export * from './pose';
export * from './normalizeBoundingBox';
export * from './progressiveStat';
export * from './provisionDefinitions';
export * from './resolveDpm';
export * from './resolvePenetrationCoefficient';
export * from './reviews';
export * from './skillDefinitions';
@@ -26,5 +29,6 @@ export * from './tankCharacteristics';
export * from './tankDefinitions';
export * from './tankIcon';
export * from './tankNames';
export * from './unionBoundingBox';
export * from './uniqueGuns';
export * from './youtubers';
@@ -0,0 +1,8 @@
import { BoundingBox } from '@blitzkit/core';
import { Vector3Tuple } from 'three';
export function normalizeBoundingBox(boundingBox: BoundingBox) {
return boundingBox.max.map(
(max, index) => max - boundingBox.min[index],
) as Vector3Tuple;
}
-9
View File
@@ -1,9 +0,0 @@
import { EventManager } from './eventManager';
export enum Pose {
HullDown,
FaceHug,
Default,
}
export const poseEvent = new EventManager<Pose>();
@@ -0,0 +1,3 @@
export function progressiveStat(crew: number) {
return (0.00375 * 100 * crew + 0.5) / 0.875 - 1;
}
+39
View File
@@ -0,0 +1,39 @@
import { GunDefinition, ShellDefinition } from './tankDefinitions';
export function resolveDpm(
gun: GunDefinition,
shell: ShellDefinition,
damageCoefficient = 1,
reloadCoefficient = 1,
intraClipCoefficient = 1,
) {
const alpha = shell.damage.armor * damageCoefficient;
let dps: number;
if (gun.type === 'regular') {
dps = alpha / (reloadCoefficient * gun.reload);
} else if (gun.type === 'autoLoader') {
dps =
(alpha * gun.count) /
(gun.reload * reloadCoefficient +
(gun.count - 1) * gun.intraClip * intraClipCoefficient);
} else {
const mostOptimalShell = gun.reload.reduce<null | {
index: number;
reload: number;
}>((current, reloadRaw, index) => {
const reload =
reloadRaw * reloadCoefficient +
(index > 0 ? gun.intraClip * intraClipCoefficient : 0);
if (current === null || reload < current.reload) {
return { index, reload };
}
return current;
}, null)!;
dps = alpha / mostOptimalShell?.reload;
}
return dps * 60;
}
@@ -4,7 +4,11 @@ import { ProvisionDefinitions } from '@blitzkit/core/src/blitzkit/provisionDefin
import { EquipmentMatrix } from '../../../website/src/stores/duel';
import { resolveNearPenetration } from '../blitz/resolveNearPenetration';
import { coefficient } from './coefficient';
import { degressiveStat } from './degressiveStat';
import { isExplosive } from './isExplosive';
import { normalizeBoundingBox } from './normalizeBoundingBox';
import { progressiveStat } from './progressiveStat';
import { resolveDpm } from './resolveDpm';
import { resolvePenetrationCoefficient } from './resolvePenetrationCoefficient';
import { sum } from './sum';
import {
@@ -15,6 +19,7 @@ import {
TrackDefinition,
TurretDefinition,
} from './tankDefinitions';
import { unionBoundingBox } from './unionBoundingBox';
export type TankCharacteristics = ReturnType<typeof tankCharacteristics>;
@@ -0,0 +1,9 @@
import { BoundingBox } from '@blitzkit/core/src/blitzkit/modelDefinitions';
import { Vector3Tuple } from 'three';
export function unionBoundingBox(a: BoundingBox, b: BoundingBox) {
return {
min: a.min.map((a, index) => Math.min(a, b.min[index])) as Vector3Tuple,
max: a.max.map((a, index) => Math.max(a, b.max[index])) as Vector3Tuple,
} satisfies BoundingBox;
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { emptyAllStats } from '@blitzkit/core/src/blitzstars/getStatsInPeriod/constants';
import { BlitzStats } from '../core/statistics/compositeStats/constants';
import { emptyAllStats } from '../blitz';
import { BlitzStats } from '../statistics';
export interface IndividualTankStats {
all: BlitzStats;