mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
fix: crew skill off by 1 roman numerals
This commit is contained in:
1 parent
282b8f8a37
commit
ab0d3f7170
3 files changed
+48
-5
No files matched your search
@@ -43,4 +43,5 @@ export * from './uniqueGuns';
|
|||||||
export * from './unwrapBlitzkitResponse';
|
export * from './unwrapBlitzkitResponse';
|
||||||
export * from './votes';
|
export * from './votes';
|
||||||
// export * from './withCORSProxy';
|
// export * from './withCORSProxy';
|
||||||
|
export * from './romanize';
|
||||||
export * from './youtubers';
|
export * from './youtubers';
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Thank you, Rene Pot!
|
||||||
|
*
|
||||||
|
* https://stackoverflow.com/a/9083076/12294756
|
||||||
|
*/
|
||||||
|
export function romanize(num: number) {
|
||||||
|
if (isNaN(num)) return NaN;
|
||||||
|
var digits = String(+num).split(''),
|
||||||
|
key = [
|
||||||
|
'',
|
||||||
|
'C',
|
||||||
|
'CC',
|
||||||
|
'CCC',
|
||||||
|
'CD',
|
||||||
|
'D',
|
||||||
|
'DC',
|
||||||
|
'DCC',
|
||||||
|
'DCCC',
|
||||||
|
'CM',
|
||||||
|
'',
|
||||||
|
'X',
|
||||||
|
'XX',
|
||||||
|
'XXX',
|
||||||
|
'XL',
|
||||||
|
'L',
|
||||||
|
'LX',
|
||||||
|
'LXX',
|
||||||
|
'LXXX',
|
||||||
|
'XC',
|
||||||
|
'',
|
||||||
|
'I',
|
||||||
|
'II',
|
||||||
|
'III',
|
||||||
|
'IV',
|
||||||
|
'V',
|
||||||
|
'VI',
|
||||||
|
'VII',
|
||||||
|
'VIII',
|
||||||
|
'IX',
|
||||||
|
],
|
||||||
|
roman = '',
|
||||||
|
i = 3;
|
||||||
|
while (i--) roman = (key[+digits.pop()! + i * 10] || '') + roman;
|
||||||
|
return Array(+digits.join('') + 1).join('M') + roman;
|
||||||
|
}
|
||||||
@@ -2,8 +2,7 @@ import {
|
|||||||
asset,
|
asset,
|
||||||
fetchSkillDefinitions,
|
fetchSkillDefinitions,
|
||||||
permanentSkills,
|
permanentSkills,
|
||||||
TIER_ROMAN_NUMERALS,
|
romanize,
|
||||||
type Tier,
|
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { Flex } from '@radix-ui/themes';
|
import { Flex } from '@radix-ui/themes';
|
||||||
import { GenericTankComponentButton } from './ModuleButtons/GenericTankComponentButton';
|
import { GenericTankComponentButton } from './ModuleButtons/GenericTankComponentButton';
|
||||||
@@ -31,9 +30,7 @@ export function CrewSkillManager({
|
|||||||
key={skill}
|
key={skill}
|
||||||
special={!permanentSkills.includes(skill)}
|
special={!permanentSkills.includes(skill)}
|
||||||
selected={level > 0}
|
selected={level > 0}
|
||||||
discriminator={
|
discriminator={level === 0 ? undefined : romanize(level)}
|
||||||
level === 0 ? undefined : TIER_ROMAN_NUMERALS[level as Tier]
|
|
||||||
}
|
|
||||||
icon={asset(`icons/skills/${skill}.webp`)}
|
icon={asset(`icons/skills/${skill}.webp`)}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
if (!onChange) return;
|
if (!onChange) return;
|
||||||
|
|||||||
Reference in new issue
Block a user