fix: ts format에서 하한값 기준으로 수정

This commit is contained in:
2022-04-07 03:03:38 +09:00
parent ad89dd0ffb
commit 0a3c98ec5a
2 changed files with 27 additions and 25 deletions
+13 -12
View File
@@ -1,21 +1,22 @@
import bs from 'binary-search'; import bs from 'binary-search';
const connectMap: [number, string][] = [ const connectMap: [number, string][] = [
[50, '안함'], [0, '안함'],
[100, '무관심'], [50, '무관심'],
[400, '보통'], [100, '보통'],
[200, '가끔'], [400, '가끔'],
[800, '자주'], [200, '자주'],
[1600, '열심'], [800, '열심'],
[3200, '중독'], [1600, '중독'],
[6400, '폐인'], [3200, '폐인'],
[12800, '경고'], [6400, '경고'],
[12800, '헐...'],
] ]
export function formatConnectScore(connect: number) { export function formatConnectScore(connect: number) {
const idx = bs(connectMap, connect, ([key], needle) => key - needle); const idx = bs(connectMap, connect, ([key], needle) => key - needle);
if(idx >= 0){ if (idx >= 0) {
return connectMap[idx][1]??'?'; return connectMap[idx][1] ?? '?';
} }
return connectMap[-(idx + 1)][1]??'?'; return connectMap[-(idx + 1)][1] ?? '?';
} }
+14 -13
View File
@@ -1,19 +1,20 @@
import bs from 'binary-search'; import bs from 'binary-search';
const hornorMap: [number, string][] = [ const hornorMap: [number, string][] = [
[640, '전무'], [0, '전무'],
[2560, '무명'], [640, '무명'],
[5760, '신동'], [2560, '신동'],
[10240, '약간'], [5760, '약간'],
[16000, '평범'], [10240, '평범'],
[23040, '지역적'], [16000, '지역적'],
[31360, '전국적'], [23040, '전국적'],
[40960, '세계적'], [31360, '세계적'],
[45000, '유명'], [40960, '유명'],
[51840, '명사'], [45000, '명사'],
[55000, '호걸'], [51840, '호걸'],
[64000, '효웅'], [55000, '효웅'],
[77440, '영웅'], [64000, '영웅'],
[77440, '구세주'],
] ]
export function formatHonor(experience: number): string { export function formatHonor(experience: number): string {