🐛 修复部分 eslint 报错

This commit is contained in:
BTMuli
2023-06-25 16:57:55 +08:00
parent 7567bba147
commit 9f9a1de09f
11 changed files with 48 additions and 37 deletions

View File

@@ -14,13 +14,13 @@ import { timeToSecond } from "./transTime";
* @returns {string} 转换后的深渊数据
*/
export function transCharacterData(data: TGApp.Game.Abyss.CharacterData[]): string {
const res = data.map((item) => {
const res: TGApp.Sqlite.Abyss.Character[] = data.map((item) => {
return {
id: item.avatar_id,
value: item.value,
star: item.rarity,
};
}) as TGApp.Sqlite.Abyss.Character[];
});
return JSON.stringify(res);
}
@@ -31,7 +31,7 @@ export function transCharacterData(data: TGApp.Game.Abyss.CharacterData[]): stri
* @returns {string} 转换后的深渊数据
*/
export function transFloorData(data: TGApp.Game.Abyss.Floor[]): string {
const floor = data.map((item) => {
const floor: TGApp.Sqlite.Abyss.Floor[] = data.map((item) => {
return {
id: item.index,
winStar: item.star,
@@ -43,15 +43,15 @@ export function transFloorData(data: TGApp.Game.Abyss.Floor[]): string {
winStar: level.star,
maxStar: level.max_star,
upBattle: transBattleData(
level.battles.find((l) => l.index === 1) as TGApp.Game.Abyss.Battle,
<TGApp.Game.Abyss.Battle>level.battles.find((l) => l.index === 1),
),
downBattle: transBattleData(
level.battles.find((l) => l.index === 2) as TGApp.Game.Abyss.Battle,
<TGApp.Game.Abyss.Battle>level.battles.find((l) => l.index === 2),
),
};
}),
};
}) as TGApp.Sqlite.Abyss.Floor[];
});
return JSON.stringify(floor);
}

View File

@@ -64,8 +64,8 @@ function transAvatar(data: TGApp.Game.Record.Avatar[]): string {
level: item.level,
star: item.rarity === 105 ? 5 : item.rarity,
constellation: item.actived_constellation_num,
isShow: item.is_chosen ? 1 : 0,
} as TGApp.Sqlite.Record.Avatar;
isShow: item.is_chosen ? <1>1 : <0>0,
};
})
.sort((a, b) => {
// 先按星级降序
@@ -113,14 +113,14 @@ function transStat(data: TGApp.Game.Record.Stats): string {
*/
function transWorld(data: TGApp.Game.Record.WorldExplore[]): string {
const worlds: TGApp.Sqlite.Record.WorldExplore[] = data.map((item) => {
let offerings;
let offerings: TGApp.Sqlite.Record.WorldOffering[] = [];
if (item.offerings !== undefined) {
offerings = item.offerings.map((offering) => {
return {
name: offering.name,
icon: offering.icon,
level: offering.level,
} as TGApp.Sqlite.Record.WorldOffering;
};
});
}
return {
@@ -133,7 +133,7 @@ function transWorld(data: TGApp.Game.Record.WorldExplore[]): string {
offerings,
bg: item.background_image,
cover: item.cover,
} as TGApp.Sqlite.Record.WorldExplore;
};
});
return JSON.stringify(worlds);
}
@@ -155,7 +155,7 @@ function transHome(data: TGApp.Game.Record.Home[]): string {
furniture: item.item_num,
visit: item.visit_num,
bg: item.icon,
} as TGApp.Sqlite.Record.Home;
};
});
return JSON.stringify(homes);
}

View File

@@ -41,7 +41,7 @@ export function transUserRoles(
name: data.name,
fetter: data.fetter,
level: data.level,
element: transElement(data.element as EnumElementEn),
element: transElement(data.element),
star: data.rarity === 105 ? 5 : data.rarity,
weapon: transWeapon(data.weapon),
reliquary: transReliquary(data.reliquaries),