mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
♻️ 重新建表以存储新格式数据
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<div class="tua-abl-mid">
|
||||
<div class="tua-abl-fetter">
|
||||
<img src="/icon/material/105.webp" alt="fetter" />
|
||||
<span>{{ props.modelValue.base.fetter }}</span>
|
||||
<span>{{ props.modelValue.avatar.fetter }}</span>
|
||||
</div>
|
||||
<div class="tua-abl-other">
|
||||
<span v-if="!isFetterMax">
|
||||
@@ -41,8 +41,8 @@
|
||||
<img :src="`/icon/relic/${index + 1}.webp`" alt="relic" v-if="relic === false" />
|
||||
<img :src="relic.icon" alt="relic" v-if="relic !== false" />
|
||||
</div>
|
||||
<div class="tua-rl-bg" v-if="relic !== false">
|
||||
<img :src="`/icon/bg/${relic.rarity}-Star.webp`" alt="bg" />
|
||||
<div class="tua-rl-bg">
|
||||
<img :src="`/icon/bg/${relic.rarity}-Star.webp`" alt="bg" v-if="relic !== false" />
|
||||
</div>
|
||||
<div :class="`tua-rl-relic rarity${relic.rarity}`" v-if="relic !== false">
|
||||
{{ relic.level }}
|
||||
@@ -51,10 +51,18 @@
|
||||
<!-- 右侧数值及加成 -->
|
||||
<div class="tua-relic-right">
|
||||
<div class="tua-relic-name">
|
||||
{{ relic === false ? getRelicName(index) : getPropName(relic) }}
|
||||
{{ relic === false ? getRelicName(index) : relic.main_property.value }}
|
||||
</div>
|
||||
<div class="tua-relic-prop">
|
||||
{{ relic !== false ? relic.main_property.value : "" }}
|
||||
<div class="tua-relic-prop" v-if="relic !== false">
|
||||
<div v-if="getPropName(relic) !== false">
|
||||
<img
|
||||
v-if="getPropName(relic).icon !== ''"
|
||||
:src="getPropName(relic).icon"
|
||||
alt="prop"
|
||||
:title="getPropName(relic).name"
|
||||
/>
|
||||
<span v-else>{{ getPropName(relic)?.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,7 +78,7 @@ import { getZhElement } from "../../utils/toolFunc.js";
|
||||
import TItembox, { TItemBoxData } from "../main/t-itembox.vue";
|
||||
|
||||
interface TuaAvatarBoxProps {
|
||||
modelValue: TGApp.Game.Avatar.DetailList;
|
||||
modelValue: TGApp.Sqlite.Character.UserRole;
|
||||
}
|
||||
|
||||
type FixedLenArr<T, N extends number> = [T, ...T[]] & { length: N };
|
||||
@@ -80,7 +88,7 @@ const props = defineProps<TuaAvatarBoxProps>();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const avatarBox = computed<TItemBoxData>(() => {
|
||||
const avatar = props.modelValue.base;
|
||||
const avatar = props.modelValue.avatar;
|
||||
return {
|
||||
size: "100px",
|
||||
height: "120px",
|
||||
@@ -118,10 +126,10 @@ const weaponBox = computed<TItemBoxData>(() => {
|
||||
};
|
||||
});
|
||||
const isFetterMax = computed<boolean>(() => {
|
||||
if (props.modelValue.base.id === 10000005 || props.modelValue.base.id === 10000007) {
|
||||
if (props.modelValue.avatar.id === 10000005 || props.modelValue.avatar.id === 10000007) {
|
||||
return true;
|
||||
}
|
||||
return props.modelValue.base.fetter === 10;
|
||||
return props.modelValue.avatar.fetter === 10;
|
||||
});
|
||||
const skills = computed<TGApp.Game.Avatar.Skill[]>(() => {
|
||||
return props.modelValue.skills.filter((skill) => skill.skill_type === 1);
|
||||
@@ -141,8 +149,8 @@ const nameCard = ref<string | false>(false);
|
||||
|
||||
onMounted(async () => {
|
||||
if (!props.modelValue) return;
|
||||
if (props.modelValue.base.id !== 10000005 && props.modelValue.base.id !== 10000007) {
|
||||
const role = await TGSqlite.getAppCharacter(props.modelValue.base.id);
|
||||
if (props.modelValue.avatar.id !== 10000005 && props.modelValue.avatar.id !== 10000007) {
|
||||
const role = await TGSqlite.getAppCharacter(props.modelValue.avatar.id);
|
||||
nameCard.value = `/source/nameCard/profile/${role.nameCard}.webp`;
|
||||
} else {
|
||||
nameCard.value = "/source/nameCard/profile/原神·印象.webp";
|
||||
@@ -154,9 +162,8 @@ function getRelicName(pos: number): string {
|
||||
return nameList[pos];
|
||||
}
|
||||
|
||||
function getPropName(relic: TGApp.Game.Avatar.Relic): string {
|
||||
const prop = userStore.getProp(relic.main_property.property_type);
|
||||
return prop === false ? "" : prop.name;
|
||||
function getPropName(relic: TGApp.Game.Avatar.Relic): TGApp.Game.Avatar.PropMapItem | false {
|
||||
return userStore.getProp(relic.main_property.property_type);
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
@@ -307,8 +314,7 @@ function getPropName(relic: TGApp.Game.Avatar.Relic): string {
|
||||
|
||||
.tua-abr-relic {
|
||||
display: flex;
|
||||
width: 180px;
|
||||
height: 60px;
|
||||
width: 120px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 5px;
|
||||
@@ -341,13 +347,15 @@ function getPropName(relic: TGApp.Game.Avatar.Relic): string {
|
||||
}
|
||||
|
||||
.tua-rl-bg {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
background: var(--box-bg-3);
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +406,6 @@ function getPropName(relic: TGApp.Game.Avatar.Relic): string {
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
row-gap: 5px;
|
||||
}
|
||||
|
||||
.tua-relic-name {
|
||||
@@ -408,7 +415,15 @@ function getPropName(relic: TGApp.Game.Avatar.Relic): string {
|
||||
}
|
||||
|
||||
.tua-relic-prop {
|
||||
display: inline-flex;
|
||||
color: var(--box-text-4);
|
||||
font-size: 12px;
|
||||
|
||||
img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
filter: invert(0.5) contrast(1) drop-shadow(0 0 5px var(--common-shadow-4));
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,19 +9,13 @@
|
||||
<span v-else> 暂无数据 </span>
|
||||
</div>
|
||||
<div class="uc-top-btns" data-html2canvas-ignore>
|
||||
<v-btn class="uc-top-btn" @click="refreshRoles()">
|
||||
<v-btn class="uc-top-btn" @click="refresh()">
|
||||
<template #prepend>
|
||||
<v-icon>mdi-refresh</v-icon>
|
||||
</template>
|
||||
更新角色数据
|
||||
刷新
|
||||
</v-btn>
|
||||
<v-btn class="uc-top-btn" @click="refreshTalent()">
|
||||
<template #prepend>
|
||||
<v-icon>mdi-refresh</v-icon>
|
||||
</template>
|
||||
更新天赋数据
|
||||
</v-btn>
|
||||
<v-btn class="uc-top-btn" @click="shareRoles()">
|
||||
<v-btn class="uc-top-btn" @click="share()">
|
||||
<template #prepend>
|
||||
<v-icon>mdi-share</v-icon>
|
||||
</template>
|
||||
@@ -30,7 +24,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="uc-grid">
|
||||
<TucRoleBox
|
||||
<TuaAvatarBox
|
||||
v-for="(role, index) in roleList"
|
||||
:key="index"
|
||||
:model-value="role"
|
||||
@@ -38,31 +32,15 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<TucDetailOverlay
|
||||
v-if="!detailDev"
|
||||
v-model="visible"
|
||||
@clickL="clickOverlay('left')"
|
||||
@clickR="clickOverlay('right')"
|
||||
:data-val="dataVal"
|
||||
/>
|
||||
<DucDetailOverlay
|
||||
v-if="detailDev"
|
||||
v-model="visible"
|
||||
@clickL="clickOverlay('left')"
|
||||
@clickR="clickOverlay('right')"
|
||||
:data-val="dataVal"
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onBeforeMount, onMounted, ref } from "vue";
|
||||
|
||||
import DucDetailOverlay from "../../components/devCharacter/duc-detail-overlay.vue";
|
||||
import showSnackbar from "../../components/func/snackbar.js";
|
||||
import ToLoading from "../../components/overlay/to-loading.vue";
|
||||
import TucDetailOverlay from "../../components/userCharacter/tuc-detail-overlay.vue";
|
||||
import TucRoleBox from "../../components/userCharacter/tuc-role-box.vue";
|
||||
import TGSqlite from "../../plugins/Sqlite/index.js";
|
||||
import TuaAvatarBox from "../../components/userAvatar/tua-avatar-box.vue";
|
||||
import TSUserAvatar from "../../plugins/Sqlite/modules/userAvatar.js";
|
||||
import { useUserStore } from "../../store/modules/user.js";
|
||||
import TGLogger from "../../utils/TGLogger.js";
|
||||
import { generateShareImg } from "../../utils/TGShare.js";
|
||||
@@ -87,23 +65,6 @@ const dataVal = ref<TGApp.Sqlite.Character.UserRole>(<TGApp.Sqlite.Character.Use
|
||||
const selectIndex = ref(0);
|
||||
const detailDev = ref(true);
|
||||
|
||||
function clickOverlay(pos: "left" | "right") {
|
||||
if (pos === "left") {
|
||||
if (selectIndex.value === 0) {
|
||||
selectIndex.value = roleList.value.length - 1;
|
||||
} else {
|
||||
selectIndex.value -= 1;
|
||||
}
|
||||
} else {
|
||||
if (selectIndex.value === roleList.value.length - 1) {
|
||||
selectIndex.value = 0;
|
||||
} else {
|
||||
selectIndex.value += 1;
|
||||
}
|
||||
}
|
||||
dataVal.value = roleList.value[selectIndex.value];
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
if (userStore.account.value) {
|
||||
user.value = userStore.account.value;
|
||||
@@ -114,7 +75,7 @@ onMounted(async () => {
|
||||
await TGLogger.Info("[Character][onMounted] 进入角色页面");
|
||||
loadingTitle.value = "正在获取角色数据";
|
||||
loading.value = true;
|
||||
await loadRole();
|
||||
await load();
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
@@ -125,31 +86,28 @@ function switchOld(): void {
|
||||
});
|
||||
}
|
||||
|
||||
async function loadRole(): Promise<void> {
|
||||
async function load(): Promise<void> {
|
||||
if (!user.value) return;
|
||||
const roleData = await TGSqlite.getUserCharacter(user.value.gameUid);
|
||||
if (roleData !== false) {
|
||||
roleData.sort((a, b) => {
|
||||
if (a.star !== b.star) return b.star - a.star;
|
||||
if (a.element !== b.element) return a.element.localeCompare(b.element);
|
||||
return a.cid - b.cid;
|
||||
});
|
||||
roleList.value = roleData;
|
||||
dataVal.value = roleData[selectIndex.value];
|
||||
isEmpty.value = false;
|
||||
await TGLogger.Info(`[Character][loadRole][${user.value.gameUid}] 成功加载角色数据`);
|
||||
await TGLogger.Info(
|
||||
`[Character][loadRole][${user.value.gameUid}] 共获取到${roleData.length}个角色`,
|
||||
);
|
||||
} else {
|
||||
await TGLogger.Warn(`[Character][loadRole][${user.value.gameUid}] 未获取到角色数据`);
|
||||
}
|
||||
const roleData = await TSUserAvatar.getAvatars(user.value.gameUid);
|
||||
roleData.sort((a, b) => {
|
||||
if (a.avatar.rarity !== b.avatar.rarity) return b.avatar.rarity - a.avatar.rarity;
|
||||
if (a.avatar.element !== b.avatar.element)
|
||||
return a.avatar.element.localeCompare(b.avatar.element);
|
||||
return a.cid - b.cid;
|
||||
});
|
||||
roleList.value = roleData;
|
||||
dataVal.value = roleData[selectIndex.value];
|
||||
isEmpty.value = false;
|
||||
await TGLogger.Info(`[Character][loadRole][${user.value.gameUid}] 成功加载角色数据`);
|
||||
await TGLogger.Info(
|
||||
`[Character][loadRole][${user.value.gameUid}] 共获取到${roleData.length}个角色`,
|
||||
);
|
||||
}
|
||||
|
||||
async function refreshRoles(): Promise<void> {
|
||||
async function refresh(): Promise<void> {
|
||||
if (!user.value) return;
|
||||
await TGLogger.Info(`[Character][refreshRoles][${user.value.gameUid}] 正在更新角色数据`);
|
||||
loadingTitle.value = "正在获取角色数据";
|
||||
loadingTitle.value = "正在获取角色列表";
|
||||
loading.value = true;
|
||||
if (!userStore.cookie.value) {
|
||||
showSnackbar({
|
||||
@@ -162,94 +120,48 @@ async function refreshRoles(): Promise<void> {
|
||||
const cookie = {
|
||||
account_id: userStore.cookie.value.account_id,
|
||||
cookie_token: userStore.cookie.value.cookie_token,
|
||||
ltoken: userStore.cookie.value.ltoken,
|
||||
ltuid: userStore.cookie.value.ltuid,
|
||||
};
|
||||
const res = await TGRequest.User.byLToken.getRoleList(cookie, user.value);
|
||||
if (Array.isArray(res)) {
|
||||
await TGLogger.Info(`[Character][refreshRoles][${user.value.gameUid}] 获取角色数据成功`);
|
||||
await TGLogger.Info(
|
||||
`[Character][refreshRoles][${user.value.gameUid}] 共获取到${res.length}个角色`,
|
||||
const listRes = await TGRequest.User.byCookie.getAvatarList(cookie, user.value.gameUid);
|
||||
if (!Array.isArray(listRes)) {
|
||||
showSnackbar({
|
||||
text: `[${listRes.retcode}] ${listRes.message}`,
|
||||
color: "error",
|
||||
});
|
||||
await TGLogger.Error(`[Character][refreshRoles][${user.value.gameUid}] 获取角色列表失败`);
|
||||
await TGLogger.Error(
|
||||
`[Character][refreshRoles][${user.value.gameUid}] ${listRes.retcode} ${listRes.message}`,
|
||||
);
|
||||
loadingTitle.value = "正在保存角色数据";
|
||||
await TGSqlite.saveUserCharacter(user.value.gameUid, res);
|
||||
loadingTitle.value = "正在更新角色数据";
|
||||
await loadRole();
|
||||
} else {
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
const idList = listRes.map((i) => i.id.toString());
|
||||
loadingTitle.value = "正在获取角色数据";
|
||||
loadingSub.value = `共${idList.length}个角色`;
|
||||
const res = await TGRequest.User.byCookie.getAvatarDetail(cookie, user.value.gameUid, idList);
|
||||
if ("retcode" in res) {
|
||||
showSnackbar({
|
||||
text: `[${res.retcode}] ${res.message}`,
|
||||
color: "error",
|
||||
});
|
||||
await TGLogger.Error(`[Character][refreshRoles][${user.value.gameUid}] 更新角色数据失败`);
|
||||
await TGLogger.Error(`[Character][refreshRoles][${user.value.gameUid}] 获取角色数据失败`);
|
||||
await TGLogger.Error(
|
||||
`[Character][refreshRoles][${user.value.gameUid}] ${res.retcode} ${res.message}`,
|
||||
);
|
||||
}
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function refreshTalent(): Promise<void> {
|
||||
if (!user.value) return;
|
||||
loadingTitle.value = "正在获取天赋数据";
|
||||
loading.value = true;
|
||||
if (!userStore.cookie.value) {
|
||||
showSnackbar({
|
||||
text: "请先登录",
|
||||
color: "error",
|
||||
});
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
for (const role of roleList.value) {
|
||||
loadingTitle.value = `正在获取${role.name}的天赋数据`;
|
||||
loadingSub.value = `CID:${role.cid}`;
|
||||
const res = await TGRequest.User.calculate.getSyncAvatarDetail(
|
||||
userStore.cookie.value.account_id,
|
||||
userStore.cookie.value.cookie_token,
|
||||
user.value.gameUid,
|
||||
role.cid,
|
||||
);
|
||||
if ("skill_list" in res) {
|
||||
const talent: TGApp.Sqlite.Character.RoleTalent[] = [];
|
||||
res.skill_list.map((skill, index) => {
|
||||
return talent.push({
|
||||
id: skill.id,
|
||||
pos: index,
|
||||
level: skill.level_current,
|
||||
max: skill.max_level,
|
||||
name: skill.name,
|
||||
icon: skill.icon,
|
||||
});
|
||||
});
|
||||
const skillStr = talent.map((i) => `${i.id}:${i.level}`).join(",");
|
||||
await TGLogger.Info(
|
||||
`[Character][refreshTalent][${user.value.gameUid}] 成功获取到${role.name}的天赋数据 ${skillStr}`,
|
||||
);
|
||||
await TGSqlite.saveUserCharacterTalent(user.value.gameUid, role.cid, talent);
|
||||
} else {
|
||||
loadingTitle.value = `获取${role.name}的天赋数据失败`;
|
||||
loadingSub.value = `[${res.retcode}] ${res.message}`;
|
||||
await TGLogger.Error(
|
||||
`[Character][refreshTalent][${user.value.gameUid}] 获取 ${role.name} 的天赋数据失败`,
|
||||
);
|
||||
await TGLogger.Error(
|
||||
`[Character][refreshTalent][${user.value.gameUid}] ${res.retcode} ${res.message}`,
|
||||
);
|
||||
setTimeout(() => {}, 1000);
|
||||
}
|
||||
}
|
||||
loadingTitle.value = "正在更新天赋数据";
|
||||
loadingSub.value = "";
|
||||
userStore.propMap.value = res.property_map;
|
||||
loadingTitle.value = "正在保存角色数据";
|
||||
await TSUserAvatar.saveAvatars(user.value.gameUid, res.list);
|
||||
await TGLogger.Info(`[Character][refreshRoles][${user.value.gameUid}] 成功更新角色数据`);
|
||||
await TGLogger.Info(
|
||||
`[Character][refreshRoles][${user.value.gameUid}] 共更新${res.list.length}个角色`,
|
||||
);
|
||||
await load();
|
||||
loading.value = false;
|
||||
showSnackbar({
|
||||
text: "成功更新数据,即将刷新页面",
|
||||
});
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
async function shareRoles(): Promise<void> {
|
||||
async function share(): Promise<void> {
|
||||
if (!user.value) return;
|
||||
await TGLogger.Info(`[Character][shareRoles][${user.value.gameUid}] 正在生成分享图片`);
|
||||
const rolesBox = <HTMLElement>document.querySelector(".uc-box");
|
||||
@@ -323,6 +235,6 @@ function selectRole(role: TGApp.Sqlite.Character.UserRole): void {
|
||||
.uc-grid {
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins/Sqlite/index.ts
|
||||
* @description Sqlite 数据库操作类
|
||||
* @since Beta v0.5.0
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
import { app } from "@tauri-apps/api";
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
insertAppData,
|
||||
insertGameAccountData,
|
||||
insertRecordData,
|
||||
insertRoleData,
|
||||
} from "./sql/insertData.js";
|
||||
|
||||
class Sqlite {
|
||||
@@ -289,60 +288,6 @@ class Sqlite {
|
||||
return res[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 保存用户角色数据
|
||||
* @since Beta v0.3.3
|
||||
* @param {string} uid 用户 uid
|
||||
* @param {TGApp.Game.Character.ListItem[]} data 角色数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public async saveUserCharacter(
|
||||
uid: string,
|
||||
data: TGApp.Game.Character.ListItem[],
|
||||
): Promise<void> {
|
||||
const db = await this.getDB();
|
||||
const sql = insertRoleData(uid, data);
|
||||
await db.execute(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 保存用户角色天赋数据
|
||||
* @since Beta v0.3.3
|
||||
* @param {string} uid 用户 uid
|
||||
* @param {number} cid 角色 ID
|
||||
* @param {TGApp.Sqlite.Character.RoleTalent[]} data 角色天赋数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public async saveUserCharacterTalent(
|
||||
uid: string,
|
||||
cid: number,
|
||||
data: TGApp.Sqlite.Character.RoleTalent[],
|
||||
): Promise<void> {
|
||||
const db = await this.getDB();
|
||||
const sql = `UPDATE UserCharacters
|
||||
SET talent = '${JSON.stringify(data)}',
|
||||
updated = datetime('now', 'localtime')
|
||||
WHERE uid = '${uid}'
|
||||
AND cid = ${cid}`;
|
||||
await db.execute(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取用户角色数据
|
||||
* @since Beta v0.3.3
|
||||
* @param {string} uid 用户 uid
|
||||
* @returns {Promise<TGApp.Sqlite.Character.UserRole[]|false>}
|
||||
*/
|
||||
public async getUserCharacter(uid: string): Promise<TGApp.Sqlite.Character.UserRole[] | false> {
|
||||
const db = await this.getDB();
|
||||
const sql = `SELECT *
|
||||
FROM UserCharacters
|
||||
WHERE uid = '${uid}'`;
|
||||
const res: TGApp.Sqlite.Character.UserRole[] = await db.select(sql);
|
||||
if (res.length === 0) return false;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 检测特定表是否存在
|
||||
* @since Beta v0.4.5
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import TGSqlite from "../index.js";
|
||||
import { insertRoleData } from "../sql/insertData.js";
|
||||
|
||||
/**
|
||||
* @description 获取用户角色id列表
|
||||
@@ -18,8 +19,52 @@ async function getAllAvatarId(): Promise<string[]> {
|
||||
return res.map((i) => i.cid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取用户角色数据
|
||||
* @since Beta v0.5.3
|
||||
* @param {string} uid 用户 uid
|
||||
* @returns {Promise<TGApp.Sqlite.Character.UserRole[]>}
|
||||
*/
|
||||
async function getAvatars(uid: string): Promise<TGApp.Sqlite.Character.UserRole[]> {
|
||||
const db = await TGSqlite.getDB();
|
||||
type resType = Array<TGApp.Sqlite.Character.UserRoleDB>;
|
||||
const res = await db.select<resType>("SELECT * FROM UserCharacters WHERE uid = ?;", [uid]);
|
||||
return res.map((i) => {
|
||||
return {
|
||||
uid: i.uid,
|
||||
cid: i.cid,
|
||||
avatar: JSON.parse(i.avatar),
|
||||
weapon: JSON.parse(i.weapon),
|
||||
relics: JSON.parse(i.relics),
|
||||
constellations: JSON.parse(i.constellations),
|
||||
costumes: JSON.parse(i.costumes),
|
||||
skills: JSON.parse(i.skills),
|
||||
propSelected: JSON.parse(i.propSelected),
|
||||
propBase: JSON.parse(i.propBase),
|
||||
propExtra: JSON.parse(i.propExtra),
|
||||
propRecommend: JSON.parse(i.propRecommend),
|
||||
updated: i.updated,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 保存用户角色数据
|
||||
* @since Beta v0.5.3
|
||||
* @param {string} uid 用户 uid
|
||||
* @param {TGApp.Game.Avatar.DetailList[]} data 角色数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function saveAvatars(uid: string, data: TGApp.Game.Avatar.DetailList[]): Promise<void> {
|
||||
const db = await TGSqlite.getDB();
|
||||
const sql = insertRoleData(uid, data);
|
||||
await db.execute(sql);
|
||||
}
|
||||
|
||||
const TSUserAvatar = {
|
||||
getAllAvatarId,
|
||||
getAvatars,
|
||||
saveAvatars,
|
||||
};
|
||||
|
||||
export default TSUserAvatar;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- @file plugins Sqlite sql createTable.sql
|
||||
-- @file plugins/Sqlite/sql/createTable.sql
|
||||
-- @brief sqlite数据库创建表语句
|
||||
-- @since Beta v0.4.5
|
||||
-- @since Beta v0.5.3
|
||||
|
||||
-- @brief 创建成就数据表
|
||||
create table if not exists Achievements
|
||||
@@ -114,23 +114,24 @@ create table if not exists UserRecord
|
||||
updated text
|
||||
);
|
||||
|
||||
-- @brief 删除旧的角色数据表
|
||||
drop table if exists UserCharacters;
|
||||
|
||||
-- @brief 创建角色数据表
|
||||
create table if not exists UserCharacters
|
||||
(
|
||||
uid integer,
|
||||
cid integer,
|
||||
img text,
|
||||
name text,
|
||||
fetter integer,
|
||||
level integer,
|
||||
element text,
|
||||
star integer,
|
||||
avatar text,
|
||||
weapon text,
|
||||
reliquary text,
|
||||
constellation text,
|
||||
activeConstellation integer,
|
||||
costume text,
|
||||
talent text,
|
||||
relics text,
|
||||
constellations text,
|
||||
costumes text,
|
||||
skills text,
|
||||
propSelected text,
|
||||
propBase text,
|
||||
propExtra text,
|
||||
propRecommend text,
|
||||
updated text,
|
||||
primary key (uid, cid)
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins Sqlite sql insertData.ts
|
||||
* @file plugins/Sqlite/sql/insertData.ts
|
||||
* @description Sqlite 插入数据 sql 语句
|
||||
* @since Beta v0.3.3
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
import { transCharacterData, transFloorData } from "../utils/transAbyssData.js";
|
||||
@@ -237,34 +237,32 @@ export function insertRecordData(data: TGApp.Game.Record.FullData, uid: string):
|
||||
|
||||
/**
|
||||
* @description 插入用户角色数据
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.5.3
|
||||
* @param {string} uid 用户 UID
|
||||
* @param {TGApp.User.Character.Item[]} data 角色数据
|
||||
* @param {TGApp.Game.Avatar.DetailList[]} data 角色数据
|
||||
* @returns {string} sql
|
||||
*/
|
||||
export function insertRoleData(uid: string, data: TGApp.Game.Character.ListItem[]): string {
|
||||
export function insertRoleData(uid: string, data: TGApp.Game.Avatar.DetailList[]): string {
|
||||
const sql = data.map((item) => {
|
||||
const role = transUserRoles(item);
|
||||
return `
|
||||
INSERT INTO UserCharacters (uid, cid, name, img, name, fetter, level, element, star, weapon, reliquary,
|
||||
constellation, activeConstellation, costume, updated)
|
||||
VALUES (${uid}, ${role.cid}, '${role.name}', '${role.img}', '${role.name}', ${role.fetter}, ${role.level},
|
||||
'${role.element}', ${role.star}, '${role.weapon}', '${role.reliquary}', '${role.constellation}',
|
||||
${role.activeConstellation}, '${role.costume}', datetime('now', 'localtime'))
|
||||
INSERT INTO UserCharacters (uid, cid, avatar, weapon, relics, constellations, costumes, skills,
|
||||
propSelected, propBase, propExtra, propRecommend, updated)
|
||||
VALUES (${uid}, ${role.cid}, '${role.avatar}', '${role.weapon}', '${role.relics}', '${role.constellations}',
|
||||
'${role.costumes}', '${role.skills}', '${role.propSelected}', '${role.propBase}', '${role.propExtra}',
|
||||
'${role.propRecommend}', datetime('now', 'localtime'))
|
||||
ON CONFLICT(uid, cid) DO UPDATE
|
||||
SET name = '${role.name}',
|
||||
img = '${role.img}',
|
||||
name = '${role.name}',
|
||||
fetter = ${role.fetter},
|
||||
level = ${role.level},
|
||||
element = '${role.element}',
|
||||
star = ${role.star},
|
||||
weapon = '${role.weapon}',
|
||||
reliquary = '${role.reliquary}',
|
||||
constellation = '${role.constellation}',
|
||||
activeConstellation = ${role.activeConstellation},
|
||||
costume = '${role.costume}',
|
||||
updated = datetime('now', 'localtime');
|
||||
SET avatar = '${role.avatar}',
|
||||
weapon = '${role.weapon}',
|
||||
relics = '${role.relics}',
|
||||
constellations = '${role.constellations}',
|
||||
costumes = '${role.costumes}',
|
||||
skills = '${role.skills}',
|
||||
propSelected = '${role.propSelected}',
|
||||
propBase = '${role.propBase}',
|
||||
propExtra = '${role.propExtra}',
|
||||
propRecommend = '${role.propRecommend}',
|
||||
updated = datetime('now', 'localtime');
|
||||
`;
|
||||
});
|
||||
return sql.join("");
|
||||
|
||||
@@ -1,157 +1,31 @@
|
||||
/**
|
||||
* @file plugins Sqlite utils transUserRoles.ts
|
||||
* @file plugins/Sqlite/utils/transUserRoles.ts
|
||||
* @description 转换用户角色数据格式,用于数据库存储
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.0
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
enum EnumElementEn {
|
||||
pyro = "Pyro",
|
||||
hydro = "Hydro",
|
||||
anemo = "Anemo",
|
||||
electro = "Electro",
|
||||
cryo = "Cryo",
|
||||
geo = "Geo",
|
||||
dendro = "Dendro",
|
||||
}
|
||||
|
||||
enum EnumElement {
|
||||
pyro = "火元素",
|
||||
hydro = "水元素",
|
||||
anemo = "风元素",
|
||||
electro = "雷元素",
|
||||
cryo = "冰元素",
|
||||
geo = "岩元素",
|
||||
dendro = "草元素",
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 将通过 api 获取到的用户角色数据转换为数据库中的数据
|
||||
* @since Alpha v0.2.0
|
||||
* @since Beta v0.5.3
|
||||
* @param {TGApp.Game.Character.ListItem} data 用户角色数据
|
||||
* @returns {TGApp.Sqlite.Character.UserRole} 转换后的用户角色数据
|
||||
*/
|
||||
export function transUserRoles(
|
||||
data: TGApp.Game.Character.ListItem,
|
||||
): TGApp.Sqlite.Character.UserRole {
|
||||
data: TGApp.Game.Avatar.DetailList,
|
||||
): TGApp.Sqlite.Character.UserRoleDB {
|
||||
return {
|
||||
uid: -1,
|
||||
cid: data.id,
|
||||
img: data.image,
|
||||
name: data.name,
|
||||
fetter: data.fetter,
|
||||
level: data.level,
|
||||
element: transElement(data.element),
|
||||
star: data.rarity === 105 ? 5 : data.rarity,
|
||||
weapon: transWeapon(data.weapon),
|
||||
reliquary: transReliquary(data.reliquaries),
|
||||
constellation: transConstellation(data.constellations),
|
||||
activeConstellation: data.actived_constellation_num,
|
||||
costume: JSON.stringify(data.costumes),
|
||||
talent: "",
|
||||
cid: data.base.id,
|
||||
avatar: JSON.stringify(data.base),
|
||||
weapon: JSON.stringify(data.weapon),
|
||||
relics: JSON.stringify(data.relics),
|
||||
constellations: JSON.stringify(data.constellations),
|
||||
costumes: JSON.stringify(data.costumes),
|
||||
skills: JSON.stringify(data.skills),
|
||||
propSelected: JSON.stringify(data.selected_properties),
|
||||
propBase: JSON.stringify(data.base_properties),
|
||||
propExtra: JSON.stringify(data.extra_properties),
|
||||
propRecommend: JSON.stringify(data.recommend_relic_property),
|
||||
updated: "",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 将角色元素转换为数据库中的数据
|
||||
* @since Alpha v0.2.0
|
||||
* @param {EnumElementEn} data 角色元素
|
||||
* @returns {EnumElement} 转换后的角色元素
|
||||
*/
|
||||
function transElement(data: EnumElementEn): EnumElement {
|
||||
switch (data) {
|
||||
case EnumElementEn.pyro:
|
||||
return EnumElement.pyro;
|
||||
case EnumElementEn.hydro:
|
||||
return EnumElement.hydro;
|
||||
case EnumElementEn.anemo:
|
||||
return EnumElement.anemo;
|
||||
case EnumElementEn.electro:
|
||||
return EnumElement.electro;
|
||||
case EnumElementEn.cryo:
|
||||
return EnumElement.cryo;
|
||||
case EnumElementEn.geo:
|
||||
return EnumElement.geo;
|
||||
case EnumElementEn.dendro:
|
||||
return EnumElement.dendro;
|
||||
default:
|
||||
throw new Error("未知的角色元素类型");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 将角色武器转换为数据库中的数据
|
||||
* @since Alpha v0.2.0
|
||||
* @param {TGApp.Game.Character.LIWeapon} data 角色武器
|
||||
* @returns {string} 转换后的角色武器
|
||||
*/
|
||||
function transWeapon(data: TGApp.Game.Character.LIWeapon): string {
|
||||
const weapon: TGApp.Sqlite.Character.RoleWeapon = {
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
type: data.type_name,
|
||||
star: data.rarity,
|
||||
level: data.level,
|
||||
promote: data.promote_level,
|
||||
description: data.desc,
|
||||
affix: data.affix_level,
|
||||
};
|
||||
return JSON.stringify(weapon);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 将角色命座转换为数据库中的数据
|
||||
* @since Alpha v0.2.0
|
||||
* @param {TGApp.Game.Character.LIRelic[]} data 角色命座
|
||||
* @returns {string} 转换后的角色命座
|
||||
*/
|
||||
function transReliquary(data: TGApp.Game.Character.LIRelic[]): string {
|
||||
if (data.length === 0) {
|
||||
return "";
|
||||
}
|
||||
const reliquary: TGApp.Sqlite.Character.RoleReliquary[] = [];
|
||||
for (const item of data) {
|
||||
reliquary.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
pos: item.pos,
|
||||
posName: item.pos_name,
|
||||
star: item.rarity,
|
||||
level: item.level,
|
||||
icon: item.icon,
|
||||
set: {
|
||||
id: item.set.id,
|
||||
name: item.set.name,
|
||||
effect: item.set.affixes.map((setItem) => {
|
||||
return {
|
||||
active: setItem.activation_number,
|
||||
description: setItem.effect,
|
||||
};
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
return JSON.stringify(reliquary);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 将角色命座转换为数据库中的数据
|
||||
* @since Alpha v0.2.0
|
||||
* @param {TGApp.Game.Character.LIConstellation[]} data 角色命座
|
||||
* @returns {string} 转换后的角色命座
|
||||
*/
|
||||
function transConstellation(data: TGApp.Game.Character.LIConstellation[]): string {
|
||||
const constellation: TGApp.Sqlite.Character.RoleConstellation[] = [];
|
||||
for (const item of data) {
|
||||
constellation.push({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.icon,
|
||||
description: item.effect,
|
||||
active: item.is_actived,
|
||||
pos: item.pos,
|
||||
});
|
||||
}
|
||||
return JSON.stringify(constellation);
|
||||
}
|
||||
|
||||
34
src/types/Game/Avatar.d.ts
vendored
34
src/types/Game/Avatar.d.ts
vendored
@@ -123,12 +123,12 @@ declare namespace TGApp.Game.Avatar {
|
||||
* @property {Relic[]} relics - 角色圣遗物信息
|
||||
* @property {Constellation[]} constellations - 角色命座信息
|
||||
* @property {Costume[]} costumes - 角色时装信息
|
||||
* @property {WeaponProp[]} selected_properties - 角色选中属性
|
||||
* @property {WeaponProp[]} base_properties - 角色基础属性
|
||||
* @property {WeaponProp[]} extra_properties - 角色额外属性
|
||||
* @property {WeaponProp[]} element_properties - 角色元素属性
|
||||
* @property {Prop[]} selected_properties - 角色选中属性
|
||||
* @property {Prop[]} base_properties - 角色基础属性
|
||||
* @property {Prop[]} extra_properties - 角色额外属性
|
||||
* @property {Prop[]} element_properties - 角色元素属性
|
||||
* @property {Skill[]} skills - 角色技能信息
|
||||
* @property {RelicRecommendProp[]} recommend_relic_properties - 推荐圣遗物属性
|
||||
* @property {RelicRecommendProp} recommend_relic_property - 推荐圣遗物属性
|
||||
* @return DetailList
|
||||
*/
|
||||
interface DetailList {
|
||||
@@ -137,12 +137,12 @@ declare namespace TGApp.Game.Avatar {
|
||||
relics: Relic[];
|
||||
constellations: Constellation[];
|
||||
costumes: Costume[];
|
||||
selected_properties: WeaponProp[];
|
||||
base_properties: WeaponProp[];
|
||||
extra_properties: WeaponProp[];
|
||||
element_properties: WeaponProp[];
|
||||
selected_properties: Prop[];
|
||||
base_properties: Prop[];
|
||||
extra_properties: Prop[];
|
||||
element_properties: Prop[];
|
||||
skills: Skill[];
|
||||
recommend_relic_properties: RelicRecommendProp[];
|
||||
recommend_relic_property: RelicRecommendProp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,8 +159,8 @@ declare namespace TGApp.Game.Avatar {
|
||||
* @property {string} type_name - 武器类型名称
|
||||
* @property {string} desc - 武器描述
|
||||
* @property {number} affix_level - 武器精炼等级
|
||||
* @property {WeaponProp} main_property - 武器主属性
|
||||
* @property {WeaponProp} sub_property - 武器副属性
|
||||
* @property {Prop} main_property - 武器主属性
|
||||
* @property {Prop} sub_property - 武器副属性
|
||||
* @return WeaponDetail
|
||||
*/
|
||||
interface WeaponDetail {
|
||||
@@ -174,21 +174,21 @@ declare namespace TGApp.Game.Avatar {
|
||||
type_name: string;
|
||||
desc: string;
|
||||
affix_level: number;
|
||||
main_property: WeaponProp;
|
||||
sub_property: WeaponProp;
|
||||
main_property: Prop;
|
||||
sub_property: Prop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 角色详情武器属性数据类型
|
||||
* @interface WeaponProp
|
||||
* @interface Prop
|
||||
* @since Beta v0.5.3
|
||||
* @property {number} property_type - 属性类型
|
||||
* @property {string} base - 基础属性
|
||||
* @property {string} add - 附加属性
|
||||
* @property {string} final - 最终属性
|
||||
* @return WeaponProp
|
||||
* @return Prop
|
||||
*/
|
||||
interface WeaponProp {
|
||||
interface Prop {
|
||||
property_type: number;
|
||||
base: string;
|
||||
add: string;
|
||||
|
||||
194
src/types/Sqlite/Character.d.ts
vendored
194
src/types/Sqlite/Character.d.ts
vendored
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @file types/Sqlite/Character.d.ts
|
||||
* @description 角色相关类型定义文件
|
||||
* @since Alpha v0.2.0
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace TGApp.Sqlite.Character
|
||||
* @since Alpha v0.2.0
|
||||
* @since Beta v0.5.3
|
||||
* @description 角色相关类型定义命名空间
|
||||
* @memberof TGApp.Sqlite
|
||||
*/
|
||||
@@ -40,157 +40,71 @@ declare namespace TGApp.Sqlite.Character {
|
||||
|
||||
/**
|
||||
* @description 用户角色列表的角色类型
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.5.3
|
||||
* @interface UserRole
|
||||
* @property {number} uid - 用户 ID
|
||||
* @property {number} cid - 角色 ID
|
||||
* @property {string} img - 全身像
|
||||
* @property {string} name - 角色名称
|
||||
* @property {number} fetter - 角色好感
|
||||
* @property {number} level - 角色等级
|
||||
* @property {string} element - 角色元素类型
|
||||
* @property {number} star - 角色星级
|
||||
* @property {RoleWeapon} weapon - 角色武器类型 // 数据库中以字符串形式存储
|
||||
* @property {RoleReliquary[]} reliquary - 角色圣遗物套装 // 数据库中以字符串形式存储
|
||||
* @property {RoleConstellation[]} constellation - 角色命座 // 数据库中以字符串形式存储
|
||||
* @property {number} activeConstellation - 角色激活命座
|
||||
* @property {RoleCostume} costume - 角色时装 // 数据库中以字符串形式存储
|
||||
* @property {RoleTalent[]} talent - 角色天赋 // 数据库中以字符串形式存储
|
||||
* @property {TGApp.Game.Avatar.Avatar} avatar - 角色信息
|
||||
* @property {TGApp.Game.Avatar.WeaponDetail} weapon - 角色武器信息
|
||||
* @property {TGApp.Game.Avatar.Relic[]} relics - 角色圣遗物信息
|
||||
* @property {TGApp.Game.Avatar.Constellation[]} constellations - 角色命之座信息
|
||||
* @property {TGApp.Game.Avatar.Costume[]} costumes - 角色衣装信息
|
||||
* @property {TGApp.Game.Avatar.Skill[]} skills - 角色技能信息
|
||||
* @property {TGApp.Game.Avatar.Prop[]} propSelected - 角色属性信息
|
||||
* @property {TGApp.Game.Avatar.Prop[]} propBase - 角色基础属性信息
|
||||
* @property {TGApp.Game.Avatar.Prop[]} propExtra - 角色额外属性信息
|
||||
* @property {TGApp.Game.Avatar.RelicRecommendProp} propRecommend - 角色推荐属性信息
|
||||
* @property {string} updated - 数据更新时间
|
||||
* @return UserRole
|
||||
*/
|
||||
interface UserRole {
|
||||
uid: number;
|
||||
cid: number;
|
||||
img: string;
|
||||
name: string;
|
||||
fetter: number;
|
||||
level: number;
|
||||
element: string;
|
||||
star: number;
|
||||
weapon: string;
|
||||
reliquary: string;
|
||||
constellation: string;
|
||||
activeConstellation: number;
|
||||
costume: string;
|
||||
talent: string;
|
||||
avatar: TGApp.Game.Avatar.Avatar;
|
||||
weapon: TGApp.Game.Avatar.WeaponDetail;
|
||||
relics: TGApp.Game.Avatar.Relic[];
|
||||
constellations: TGApp.Game.Avatar.Constellation[];
|
||||
costumes: TGApp.Game.Avatar.Costume[];
|
||||
skills: TGApp.Game.Avatar.Skill[];
|
||||
propSelected: TGApp.Game.Avatar.Prop[];
|
||||
propBase: TGApp.Game.Avatar.Prop[];
|
||||
propExtra: TGApp.Game.Avatar.Prop[];
|
||||
propRecommend: TGApp.Game.Avatar.RelicRecommendProp;
|
||||
updated: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 角色列表的武器数据类型
|
||||
* @since Alpha v0.2.0
|
||||
* @interface RoleWeapon
|
||||
* @property {number} id - 武器 ID
|
||||
* @property {string} name - 武器名称
|
||||
* @property {string} type - 武器类型
|
||||
* @property {number} star - 武器星级
|
||||
* @property {number} level - 武器等级
|
||||
* @property {number} promote - 武器突破
|
||||
* @property {string} description - 武器描述
|
||||
* @property {number} affix - 武器精炼
|
||||
* @return RoleWeapon
|
||||
* @description 存于数据库的角色数据
|
||||
* @since Beta v0.5.3
|
||||
* @interface UserRoleDB
|
||||
* @property {number} uid - 用户 ID
|
||||
* @property {number} cid - 角色 ID
|
||||
* @property {string} avatar - 角色信息
|
||||
* @property {string} weapon - 角色武器信息
|
||||
* @property {string} relics - 角色圣遗物信息
|
||||
* @property {string} constellations - 角色命之座信息
|
||||
* @property {string} costumes - 角色衣装信息
|
||||
* @property {string} skills - 角色技能信息
|
||||
* @property {string} propSelected - 角色属性信息
|
||||
* @property {string} propBase - 角色基础属性信息
|
||||
* @property {string} propExtra - 角色额外属性信息
|
||||
* @property {string} propRecommend - 角色推荐属性信息
|
||||
* @property {string} updated - 数据更新时间
|
||||
* @return UserRoleDB
|
||||
*/
|
||||
interface RoleWeapon {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
star: number;
|
||||
level: number;
|
||||
promote: number;
|
||||
description: string;
|
||||
affix: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 角色列表的圣遗物数据类型
|
||||
* @since Alpha v0.2.0
|
||||
* @interface RoleReliquary
|
||||
* @property {number} id - 圣遗物 ID
|
||||
* @property {string} name - 圣遗物名称
|
||||
* @property {number} pos - 圣遗物部位
|
||||
* @property {string} posName - 圣遗物部位名称
|
||||
* @property {number} star - 圣遗物星级
|
||||
* @property {number} level - 圣遗物等级
|
||||
* @property {string} icon - 圣遗物图标
|
||||
* @property {number} set.id - 圣遗物套装 ID
|
||||
* @property {string} set.name - 圣遗物套装名称
|
||||
* @property {number} set.effect[].active - 圣遗物套装效果激活数量
|
||||
* @property {string} set.effect[].description - 圣遗物套装效果描述
|
||||
* @return RoleReliquary
|
||||
*/
|
||||
interface RoleReliquary {
|
||||
id: number;
|
||||
name: string;
|
||||
pos: number;
|
||||
posName: string;
|
||||
star: number;
|
||||
level: number;
|
||||
icon: string;
|
||||
set: {
|
||||
id: number;
|
||||
name: string;
|
||||
effect: Array<{
|
||||
active: number;
|
||||
description: string;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 角色列表的命座数据类型
|
||||
* @since Alpha v0.2.0
|
||||
* @interface RoleConstellation
|
||||
* @property {number} id - 命座 ID
|
||||
* @property {string} name - 命座名称
|
||||
* @property {string} icon - 命座图标
|
||||
* @property {string} description - 命座描述
|
||||
* @property {boolean} active - 命座是否激活
|
||||
* @property {number} pos - 命座位置
|
||||
* @return RoleConstellation
|
||||
*/
|
||||
interface RoleConstellation {
|
||||
id: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
active: boolean;
|
||||
pos: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 角色列表的时装数据类型
|
||||
* @since Alpha v0.2.0
|
||||
* @interface RoleCostume
|
||||
* @property {number} id - 时装 ID
|
||||
* @property {string} name - 时装名称
|
||||
* @property {string} icon - 时装图标
|
||||
* @return RoleCostume
|
||||
*/
|
||||
interface RoleCostume {
|
||||
id: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 角色列表的天赋数据类型
|
||||
* @since Alpha v0.2.1
|
||||
* @interface RoleTalent
|
||||
* @property {number} id - 天赋 ID
|
||||
* @property {number} pos - 天赋位置
|
||||
* @property {string} name - 天赋名称
|
||||
* @property {string} icon - 天赋图标
|
||||
* @property {number} max - 天赋最大等级
|
||||
* @property {number} level - 天赋等级
|
||||
* @return RoleTalent
|
||||
*/
|
||||
interface RoleTalent {
|
||||
id: number;
|
||||
pos: number;
|
||||
name: string;
|
||||
icon: string;
|
||||
max: number;
|
||||
level: number;
|
||||
interface UserRoleDB {
|
||||
uid: number;
|
||||
cid: number;
|
||||
avatar: string;
|
||||
weapon: string;
|
||||
relics: string;
|
||||
constellations: string;
|
||||
costumes: string;
|
||||
skills: string;
|
||||
propSelected: string;
|
||||
propBase: string;
|
||||
propExtra: string;
|
||||
propRecommend: string;
|
||||
updated: string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user