mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: further progress on embeds
This commit is contained in:
1 parent
33cd556c45
commit
d35ed8a212
4 files changed
+84
-24
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { GunDefinition, ProvisionDefinitions, TankDefinition } from '../protos';
|
||||
import { availableProvisions } from './availableProvisions';
|
||||
|
||||
const PROVISION_PREFERENCES = [
|
||||
19, // improved fuel
|
||||
18, // standard fuel
|
||||
22, // protective kit
|
||||
];
|
||||
|
||||
function infinityFallback(value: number) {
|
||||
return value === -1 ? Infinity : value;
|
||||
}
|
||||
|
||||
export function createDefaultProvisions(
|
||||
tank: TankDefinition,
|
||||
gun: GunDefinition,
|
||||
provisionDefinitions: ProvisionDefinitions,
|
||||
) {
|
||||
const provisionsList = availableProvisions(tank, gun, provisionDefinitions);
|
||||
|
||||
return provisionsList
|
||||
.sort(
|
||||
(a, b) =>
|
||||
infinityFallback(PROVISION_PREFERENCES.indexOf(a.id)) -
|
||||
infinityFallback(PROVISION_PREFERENCES.indexOf(b.id)),
|
||||
)
|
||||
.sort((a, b) => (b.crew ?? 0) - (a.crew ?? 0))
|
||||
.slice(0, tank.max_provisions)
|
||||
.map(({ id }) => id);
|
||||
}
|
||||
@@ -43,6 +43,7 @@ export * from './uniqueGuns';
|
||||
export * from './unwrapBlitzkitResponse';
|
||||
export * from './votes';
|
||||
// export * from './withCORSProxy';
|
||||
export * from './createDefaultProvisions';
|
||||
export * from './metaSortTank';
|
||||
export * from './romanize';
|
||||
export * from './youtubers';
|
||||
Reference in new issue
Block a user