feat: func_converter 일부 항목 이식
This commit is contained in:
@@ -228,4 +228,4 @@ export const diplomacyStateInfo: Record<diplomacyState, diplomacyInfo> = {
|
||||
1: { name: '선포중', color: 'magenta' },
|
||||
2: { name: '통상' },
|
||||
7: { name: '불가침', color: 'green' },
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import bs from 'binary-search';
|
||||
|
||||
const connectMap: [number, string][] = [
|
||||
[50, '안함'],
|
||||
[100, '무관심'],
|
||||
[400, '보통'],
|
||||
[200, '가끔'],
|
||||
[800, '자주'],
|
||||
[1600, '열심'],
|
||||
[3200, '중독'],
|
||||
[6400, '폐인'],
|
||||
[12800, '경고'],
|
||||
]
|
||||
|
||||
export function formatConnectScore(connect: number) {
|
||||
const idx = bs(connectMap, connect, ([key], needle) => key - needle);
|
||||
if(idx >= 0){
|
||||
return connectMap[idx][1]??'?';
|
||||
}
|
||||
return connectMap[-(idx + 1)][1]??'?';
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import bs from 'binary-search';
|
||||
|
||||
const defenceMap: [number,string][] = [
|
||||
[0, "△"],
|
||||
[60, "○"],
|
||||
[80, "◎"],
|
||||
[90, "☆"],
|
||||
[999, "×"],
|
||||
]
|
||||
|
||||
export function formatDefenceTrain(defenceTrain: number): string {
|
||||
const idx = bs(defenceMap, defenceTrain, ([defenceKey], needle) => defenceKey - needle);
|
||||
if(idx >= 0){
|
||||
return defenceMap[idx][1]??'?';
|
||||
}
|
||||
return defenceMap[-(idx + 1)][1]??'?';
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import bs from 'binary-search';
|
||||
|
||||
export const DexLevelMap: [number, string, string][] = [
|
||||
[0, 'navy', 'F-'],
|
||||
[350, 'navy', 'F'],
|
||||
[1375, 'navy', 'F+'],
|
||||
[3500, 'skyblue', 'E-'],
|
||||
[7125, 'skyblue', 'E'],
|
||||
[12650, 'skyblue', 'E+'],
|
||||
[20475, 'seagreen', 'D-'],
|
||||
[31000, 'seagreen', 'D'],
|
||||
[44625, 'seagreen', 'D+'],
|
||||
[61750, 'teal', 'C-'],
|
||||
[82775, 'teal', 'C'],
|
||||
[108100, 'teal', 'C+'],
|
||||
[138125, 'limegreen', 'B-'],
|
||||
[173250, 'limegreen', 'B'],
|
||||
[213875, 'limegreen', 'B+'],
|
||||
[260400, 'darkorange', 'A-'],
|
||||
[313225, 'darkorange', 'A'],
|
||||
[372750, 'darkorange', 'A+'],
|
||||
[439375, 'tomato', 'S-'],
|
||||
[513500, 'tomato', 'S'],
|
||||
[595525, 'tomato', 'S+'],
|
||||
[685850, 'darkviolet', 'Z-'],
|
||||
[784875, 'darkviolet', 'Z'],
|
||||
[893000, 'darkviolet', 'Z+'],
|
||||
[1010625, 'gold', 'EX-'],
|
||||
[1138150, 'gold', 'EX'],
|
||||
[1275975, 'white', 'EX+'],
|
||||
];
|
||||
|
||||
export type DexInfo = {
|
||||
level: number,
|
||||
name: string,
|
||||
color: string,
|
||||
}
|
||||
|
||||
export function formatDexLevel(dex: number): DexInfo {
|
||||
const rawIdx = bs(DexLevelMap, dex, ([dexKey], needle) => dexKey - needle);
|
||||
const level = rawIdx >= 0 ? rawIdx : -(rawIdx + 1);
|
||||
|
||||
const [, color, name] = DexLevelMap[level];
|
||||
|
||||
return {
|
||||
level,
|
||||
name,
|
||||
color
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import bs from 'binary-search';
|
||||
|
||||
const hornorMap: [number, string][] = [
|
||||
[640, '전무'],
|
||||
[2560, '무명'],
|
||||
[5760, '신동'],
|
||||
[10240, '약간'],
|
||||
[16000, '평범'],
|
||||
[23040, '지역적'],
|
||||
[31360, '전국적'],
|
||||
[40960, '세계적'],
|
||||
[45000, '유명'],
|
||||
[51840, '명사'],
|
||||
[55000, '호걸'],
|
||||
[64000, '효웅'],
|
||||
[77440, '영웅'],
|
||||
]
|
||||
|
||||
export function formatHonor(experience: number): string {
|
||||
const idx = bs(hornorMap, experience, ([experienceKey], needle) => experienceKey - needle);
|
||||
if (idx >= 0) {
|
||||
return hornorMap[idx][1] ?? '?';
|
||||
}
|
||||
return hornorMap[-(idx + 1)][1] ?? '?';
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
export const OfficerLevelMapDefault: Record<number, string> = {
|
||||
12: '군주',
|
||||
11: '참모',
|
||||
10: '제1장군',
|
||||
9: '제1모사',
|
||||
8: '제2장군',
|
||||
7: '제2모사',
|
||||
6: '제3장군',
|
||||
5: '제3모사',
|
||||
4: '태수',
|
||||
3: '군사',
|
||||
2: '종사',
|
||||
1: '일반',
|
||||
0: '재야',
|
||||
}
|
||||
|
||||
export const OfficerLevelMapByNationLevel: Record<number, Record<number, string>> = {
|
||||
7: {
|
||||
12: '황제',
|
||||
11: '승상',
|
||||
10: '표기장군',
|
||||
9: '사공',
|
||||
8: '거기장군',
|
||||
7: '태위',
|
||||
6: '위장군',
|
||||
5: '사도'
|
||||
},
|
||||
|
||||
6: {
|
||||
12: '왕',
|
||||
11: '광록훈',
|
||||
10: '좌장군',
|
||||
9: '상서령',
|
||||
8: '우장군',
|
||||
7: '중서령',
|
||||
6: '전장군',
|
||||
5: '비서령'
|
||||
},
|
||||
|
||||
5: {
|
||||
12: '공',
|
||||
11: '광록대부',
|
||||
10: '안국장군',
|
||||
9: '집금오',
|
||||
8: '파로장군',
|
||||
7: '소부'
|
||||
},
|
||||
|
||||
4: {
|
||||
12: '주목',
|
||||
11: '태사령',
|
||||
10: '아문장군',
|
||||
9: '낭중',
|
||||
8: '호군',
|
||||
7: '종사중랑'
|
||||
},
|
||||
|
||||
3: {
|
||||
12: '주자사',
|
||||
11: '주부',
|
||||
10: '편장군',
|
||||
9: '간의대부'
|
||||
},
|
||||
|
||||
2: {
|
||||
12: '군벌',
|
||||
11: '참모',
|
||||
10: '비장군',
|
||||
9: '부참모'
|
||||
},
|
||||
|
||||
1: {
|
||||
12: '영주',
|
||||
11: '참모'
|
||||
},
|
||||
|
||||
0: {
|
||||
12: '두목',
|
||||
11: '부두목'
|
||||
},
|
||||
}
|
||||
export function formatOfficerLevelText(officerLevel: number, nationLevel?: number) {
|
||||
if (officerLevel < 5) {
|
||||
return OfficerLevelMapDefault[officerLevel] ?? '???';
|
||||
}
|
||||
|
||||
const nationMap = nationLevel === undefined
|
||||
? OfficerLevelMapDefault
|
||||
: (OfficerLevelMapByNationLevel[nationLevel] ?? OfficerLevelMapDefault);
|
||||
|
||||
return nationMap[officerLevel] ?? (OfficerLevelMapDefault[officerLevel] ?? '???');
|
||||
}
|
||||
Generated
+11
@@ -44,6 +44,7 @@
|
||||
"axios": "^0.26.1",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-preset-modern-browsers": "^15.0.2",
|
||||
"binary-search": "^1.3.6",
|
||||
"bootstrap": "^5.1.3",
|
||||
"bootstrap-vue-3": "=0.1.8",
|
||||
"bootswatch": "^5.1.3",
|
||||
@@ -3453,6 +3454,11 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/binary-search": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/binary-search/-/binary-search-1.3.6.tgz",
|
||||
"integrity": "sha512-nbE1WxOTTrUWIfsfZ4aHGYu5DOuNkbxGokjV6Z2kxfJK3uaAb8zNK1muzOeipoLHZjInT4Br88BHpzevc681xA=="
|
||||
},
|
||||
"node_modules/boolbase": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
@@ -13092,6 +13098,11 @@
|
||||
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
|
||||
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
|
||||
},
|
||||
"binary-search": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/binary-search/-/binary-search-1.3.6.tgz",
|
||||
"integrity": "sha512-nbE1WxOTTrUWIfsfZ4aHGYu5DOuNkbxGokjV6Z2kxfJK3uaAb8zNK1muzOeipoLHZjInT4Br88BHpzevc681xA=="
|
||||
},
|
||||
"boolbase": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
"axios": "^0.26.1",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-preset-modern-browsers": "^15.0.2",
|
||||
"binary-search": "^1.3.6",
|
||||
"bootstrap": "^5.1.3",
|
||||
"bootstrap-vue-3": "=0.1.8",
|
||||
"bootswatch": "^5.1.3",
|
||||
|
||||
Reference in New Issue
Block a user