mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-22 21:59:49 +08:00
👽️ 更新深境螺旋相关类型和数据转换,支持新版本的增益处理
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 深境螺旋数据转换
|
||||
* @since Beta v0.9.0
|
||||
* @since Beta v0.10.1
|
||||
*/
|
||||
|
||||
import { timestampToDate } from "@utils/toolFunc.js";
|
||||
@@ -22,7 +22,7 @@ export function transCharacterData(data: Array<TGApp.Game.Abyss.CharacterData>):
|
||||
|
||||
/**
|
||||
* 转换楼层数据
|
||||
* @since Beta v0.9.0
|
||||
* @since Beta v0.10.1
|
||||
* @param data - 接口获取楼层数据
|
||||
* @returns 转换后的楼层数据
|
||||
*/
|
||||
@@ -33,11 +33,29 @@ export function transFloorData(data: Array<TGApp.Game.Abyss.Floor>): string {
|
||||
maxStar: item.max_star,
|
||||
isUnlock: item.is_unlock ? 1 : 0,
|
||||
levels: item.levels.map(transLevelData),
|
||||
buff: item.ley_line_disorder,
|
||||
buff: transFloorBuff(item),
|
||||
}));
|
||||
return JSON.stringify(floor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换楼层增益
|
||||
* @since Beta v0.10.1
|
||||
* @param data - 接口获取楼层数据
|
||||
* @returns 增益字符串
|
||||
*/
|
||||
function transFloorBuff(data: TGApp.Game.Abyss.Floor): Array<string> {
|
||||
const res: Array<string> = [];
|
||||
if (data.ley_line_disorder_upper.length > 0) {
|
||||
res.push(`【上半】${data.ley_line_disorder_upper.join(";")}`);
|
||||
}
|
||||
if (data.ley_line_disorder_lower.length > 0) {
|
||||
res.push(`【下半】${data.ley_line_disorder_lower.join(";")}`);
|
||||
}
|
||||
if (data.ley_line_disorder.length > 0) res.push(...data.ley_line_disorder);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换关卡数据
|
||||
* @since Beta v0.9.0
|
||||
|
||||
8
src/types/Game/Abyss.d.ts
vendored
8
src/types/Game/Abyss.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 深境螺旋相关类型
|
||||
* @since Beta v0.9.0
|
||||
* @since Beta v0.10.1
|
||||
*/
|
||||
|
||||
declare namespace TGApp.Game.Abyss {
|
||||
@@ -68,7 +68,7 @@ declare namespace TGApp.Game.Abyss {
|
||||
|
||||
/**
|
||||
* 楼层数据
|
||||
* @since Beta v0.9.0
|
||||
* @since Beta v0.10.1
|
||||
*/
|
||||
type Floor = {
|
||||
/** 楼层 */
|
||||
@@ -96,6 +96,10 @@ declare namespace TGApp.Game.Abyss {
|
||||
settle_date_time: TGApp.Game.Base.DateTime | null;
|
||||
/** 地脉异常 */
|
||||
ley_line_disorder: Array<string>;
|
||||
/** 地脉异常:上半 */
|
||||
ley_line_disorder_upper: Array<string>;
|
||||
/** 地脉异常:下半 */
|
||||
ley_line_disorder_lower: Array<string>;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user