🌱 背包物品数据库建立&读写

This commit is contained in:
BTMuli
2025-12-09 01:10:36 +08:00
parent 446b9a7d78
commit b1fe5b6987
4 changed files with 355 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
/**
* Yae 插件类型定义
* @since Beta v0.7.8
* @since Beta v0.9.0
*/
declare namespace TGApp.Plugins.Yae {
@@ -9,4 +9,146 @@ declare namespace TGApp.Plugins.Yae {
* @since Beta v0.7.8
*/
type AchiListRes = Array<TGApp.Plugins.UIAF.Achievement>;
/**
* 后端返的背包物品数据
* @since Beta v0.9.0
*/
type BagListRes = Array<BagItemUnion>;
/**
* 背包物品类型
* @since Beta v0.9.0
*/
type BagItemUnion =
| BagItem<"material">
| BagItem<"weapon">
| BagItem<"reliquary">
| BagItem<"furniture">
| BagItem<"virtual">
| BagItem<"unknown">;
/**
* 背包物品信息
* @since Beta v0.9.0
*/
type BagItem<T extends ItemKindEnum> = {
/** 物品ID */
item_id: number;
/** 物品类型 */
kind: T;
/** 物品信息 */
info: ItemInfoMap[T];
};
/**
* 物品信息表,用于锁定类型
* @since Beta v0.9.0
*/
type ItemInfoMap = {
/** 材料 */
material: MaterialInfo;
/** 圣遗物 */
reliquary: ReliquaryInfo;
/** 武器 */
weapon: WeaponInfo;
/** 家具 */
furniture: FurnitureInfo;
/** 虚拟物品 */
virtual: VirtualInfo;
/** 未知 */
unknown: Record<string, never>;
};
/**
* 物品类型
* @since Beta v0.9.0
*/
const ItemKindType = <const>{
/** 材料 */
material: "material",
/** 圣遗物 */
relic: "reliquary",
/** 武器 */
weapon: "weapon",
/** 家具 */
furniture: "furniture",
/** 虚拟物品 */
virtual: "virtual",
/** 未知 */
unknown: "unknown",
};
/**
* 物品类型枚举
* @since Beta v0.9.0
*/
type ItemKindEnum = (typeof ItemKindType)[keyof typeof ItemKindType];
/**
* 材料物品信息
* @since Beta v0.9.0
*/
type MaterialInfo = {
/** 数量 */
count: number;
};
/**
* 圣遗物物品信息
* @since Beta v0.9.0
*/
type ReliquaryInfo = {
/** 等级 */
level: number;
/** 经验 */
exp: number;
/** 精炼等级 */
promote_level: number;
/** 主属性ID */
main_prop_id: number;
/** 副属性 */
append_prop_id_list: Array<number>;
/** 是否标记 */
is_marked: boolean;
/** 是否锁定 */
is_locked: true;
};
/**
* 武器信息
* @since Beta v0.9.0
*/
type WeaponInfo = {
/** 等级 */
level: number;
/** 经验 */
exp: number;
/** 精炼等级 */
promote_level: number;
/** 未知Map */
affix_map: Record<string, number>;
/** 未知属性 */
is_arkhe_ousia: boolean;
/** 是否锁定 */
is_locked: boolean;
};
/**
* 家具信息
* @since Beta v0.9.0
*/
type FurnitureInfo = {
/** 数量 */
count: number;
};
/**
* 虚拟物品
* @since Beta v0.9.0
*/
type VirtualInfo = {
/** 数量 */
count: number;
};
}

51
src/types/Sqlite/UserBag.d.ts vendored Normal file
View File

@@ -0,0 +1,51 @@
/**
* 用户背包物品相关类型定义文件
* @since Beta v0.9.0
*/
declare namespace TGApp.Sqlite.UserBag {
/**
* 用户背包材料表-存储数据
* @since Beta v0.9.0
*/
type TableMaterialRaw = {
/** 存档/用户UID */
uid: number;
/** 材料ID */
id: number;
/** 材料数量 */
count: number;
/** 材料更新记录 */
records: string;
/** 更新时间 */
updated: string;
};
/**
* 用户背包材料表-解析数据
* @since Beta v0.9.0
*/
type TableMaterial = {
/** 存档/用户UID */
uid: number;
/** 材料ID */
id: number;
/** 材料数量 */
count: number;
/** 材料更新记录 */
records: Array<MaterialRecord>;
/** 更新时间 */
updated: string;
};
/**
* 材料更新记录
* @since Beta v0.9.0
*/
type MaterialRecord = {
/** 数量 */
count: number;
/** 时间戳(秒) */
time: number;
};
}