Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const buildData = (doll) => {
const { id, skins } = doll;
const rank = (parseInt((Number(id) / 1000), 10) === 1) ? 1 : doll.rank;
return Object.assign(
doll,
{
skins: skins.filter(skin => parseInt(skin.id / 1000, 10) !== 5), // 5000 번대 스킨 쓸모없는 것 같음
rank: dollRank[rank],
alias: dollAlias[doll.id] || [],
},
);
};
const dollMap = new Map(dolls.map(e => [e.id, e]));
const getAll = () => {
const dollDict = {};
dollMap.forEach((e, id) => {
dollDict[id] = buildData(new Doll(e.toJSON()));
});
return dollDict;
};
const getNewById = (id) => {
const doll = dollMap.get(id);
if (!doll) { return null; }
return buildData(new Doll(doll.toJSON()));
// TODO:need to make buildImage function (이미지 가져오는 함수 만들기)(18-03-26)
// argument mod is fairy's modification by rarity (1 : default , 2 : rarity 3 , 3 : rarity 5)
// mod 인수는 인형의 강화단계에 따라 3단계로 나누어집니다 (1 : 기본단계, 2: 3단계 강화부터, 3:최종강화)
function buildImage(name) {
const fname = `${name}_1`;
return `${domain}/fairy/${fname}.png`;
}
// TODO:add build code : skill, stats (18-03-26)
// TODO:change variation Fairy upcase name problem (gf-core레포의 fairy를 fairies로 바꾸던가 해야할듯)(18-03-26)
// TODO:change portrait value to url NOT NULL (null로 되어있는 portrait의 값을 url기반의 값으로 변경)(18-03-26)
const fairyList = fairy.map((Fairy) => {
const result = {
id: Fairy.id,
name: Fairy.name,
krName: Fairy.krName,
category: Fairy.category,
skill: Fairy.getSkill(),
grow: Fairy.grow,
buildTime: Fairy.buildTime,
images: buildImage(Fairy.name),
portrait: null,
};
return result;
});
export default fairyList;
})),
];
}
function buildSkill(skill) {
return {
id: skill.id,
name: skill.name,
path: `${domain}/skill/${skill.path}.png`,
desc: skill.desc,
data: skill.data,
dataPool: skill.dataPool,
nightDataPool: skill.nightDataPool,
};
}
const dollList = dolls.map((doll) => {
const rank = (parseInt((Number(doll.id) / 1000), 10) === 1) ? 1 : doll.rank;
const spine = spineMap.get(doll.id);
let result = { };
try {
result = {
id: doll.id,
name: doll.name,
krName: doll.krName,
nicknames: (dollNickname[doll.id % 20000] ? dollNickname[doll.id % 20000] : []),
illust: doll.illust,
voice: doll.voice,
type: typeMap.get(doll.type) || {},
rank: rankMap.get(rank) || {},
spineCode: spine ? spine.code : undefined,
skins: doll.skins,
case 3:
return 'rare';
case 4:
return 'epochal';
case 5:
return id > 1000 ? 'extra' : 'legendary';
default:
return undefined;
}
}
function hasUpgrade(id) {
return [2, 51, 55, 57, 93, 94].indexOf(id) > 0;
}
const dollList = dolls.map((doll) => {
const typeName = getTypeName(doll.type);
const rankName = getRankName(doll.id, doll.rank);
const typeIcon = require(`./resources/typeicons/${typeName}_${rankName}.png`);
const portrait = require(`./resources/portraits/${doll.id}.png`);
const illust = {
common: require(`./resources/illustrations/${doll.id}/0/common.png`),
damaged: require(`./resources/illustrations/${doll.id}/0/damaged.png`),
};
const skinList = doll.skins.map((e, i) => ({
name: e,
illust: {
common: require(`./resources/illustrations/${doll.id}/${i + 1}/common.png`),
damaged: require(`./resources/illustrations/${doll.id}/${i + 1}/damaged.png`),
import { dolls } from 'girlsfrontline-core';
const typeNameMap = [undefined, 'HG', 'SMG', 'RF', 'AR', 'MG', 'SG'];
const rankNameMap = [undefined, 'extra', 'general', 'rare', 'epochal', 'legendary'];
const map = new Map(dolls.map(obj => [obj.key, obj.val]));
const initialState = {
typeNameMap,
rankNameMap,
map,
list: dolls,
};
const reducer = (state = initialState) => state;
export default reducer;
default: color = '#ffcd4a'; break;
}
return color;
};
const buildData = equip => Object.assign(
equip,
{
buildTime: ((equip.fitGuns || equip.company === '16Lab') ? 0 : equip.buildTime),
color: getColor(equip.rank),
alias: equipAlias[equip.id] || [],
},
);
const equipMap = new Map(equips.map(e => [e.id, e]));
const getAll = () => {
const equipDict = {};
equipMap.forEach((e, id) => {
equipDict[id] = buildData(new Equip(e.toJSON()));
});
return equipDict;
};
const getNewById = (id) => {
const equip = equipMap.get(id);
if (!equip) { return null; }
return buildData(new Equip(equip.toJSON()));
const { alias: { fairy: fairyAlias } } = gfextradata({ locale: 'ko' });
const buildData = fairy => Object.assign(
fairy,
{
buildTime: (
fairy.id > 1000
|| fairy.id === 18
|| fairy.id === 19
|| fairy.id === 20
) ? 0 : fairy.buildTime,
alias: fairyAlias[fairy.id] || [],
},
);
const fairyMap = new Map(fairies.map(e => [e.id, e]));
const getAll = () => {
const fairyDict = {};
fairyMap.forEach((e, id) => {
fairyDict[id] = buildData(new Fairy(e.toJSON()));
});
return fairyDict;
};
const getNewById = (id) => {
const fairy = fairyMap.get(id);
if (!fairy) { return null; }
return buildData(new Fairy(fairy.toJSON()));
dollMap.forEach((e, id) => {
dollDict[id] = buildData(new Doll(e.toJSON()));
});
equipMap.forEach((e, id) => {
equipDict[id] = buildData(new Equip(e.toJSON()));
});
fairyMap.forEach((e, id) => {
fairyDict[id] = buildData(new Fairy(e.toJSON()));
});