@@ -58,19 +58,19 @@ async def get_character_info(request: Request, state: AltersDep, redis: RedisDep
|
||||
|
||||
|
||||
@router.get('/info/oath/{suitId}/{skillId}')
|
||||
async def get_oath_info(state: AltersDep, suitId: str, skillId: str, rarity: str, redis: RedisDep):
|
||||
async def get_oath_info(state: AltersDep, suitId: str, skillId: str, rarity: str, lv: int, redis: RedisDep):
|
||||
def get_info():
|
||||
skill = None
|
||||
version = state.equVersion
|
||||
equ = get_equipment(version)
|
||||
oath = next((x for x in equ.oath_suits if x.suitId == suitId and x.rarity == rarity), None)
|
||||
oath = next((x for x in equ.oath_suits if x.suitId == suitId and x.rarity == rarity and str(x.level) == str(lv)), None)
|
||||
if oath is not None:
|
||||
oathSkill = next((x for x in oath.skills if x.skillId == skillId), None)
|
||||
if oathSkill is not None:
|
||||
skill = {**oathSkill.__dict__, 'point': oath.points, 'imageUrl': oath.imageUrl}
|
||||
skill = {**oathSkill.__dict__, 'point': oath.points.split(',')[lv - 1], 'imageUrl': oath.imageUrl}
|
||||
return skill
|
||||
|
||||
info = get_redis_info(redis, f'dcalc:oath:{suitId}:{rarity}:{skillId}', get_info)
|
||||
info = get_redis_info(redis, f'dcalc:oath:{suitId}:{rarity}:{lv}:{skillId}', get_info)
|
||||
return response(data=info)
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -27,8 +27,8 @@ export default defineRequest((request) => {
|
||||
const res = await request.post(`/skillTree/`, { code })
|
||||
return res.data
|
||||
},
|
||||
async getOathInfo(suitId: string, skillId: string, rarity: string) {
|
||||
const res = await request.get(`/info/oath/${suitId}/${skillId}`, { params: { rarity } })
|
||||
async getOathInfo(suitId: string, skillId: string, rarity: string, lv: number) {
|
||||
const res = await request.get(`/info/oath/${suitId}/${skillId}`, { params: { rarity, lv } })
|
||||
return res.data
|
||||
},
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ const curOathInfo = computed(() => {
|
||||
return infoStore.oathSkills?.[curEquInfo.value?.suit[0]]
|
||||
})
|
||||
|
||||
const curOathSkillLvs = asyncComputed(async () => {
|
||||
const curOathSkillInfo = asyncComputed(async () => {
|
||||
if (!curOathInfo.value || !curEquInfo.value?.suit[0]) {
|
||||
return undefined
|
||||
}
|
||||
@@ -349,23 +349,24 @@ const curOathSkillLvs = asyncComputed(async () => {
|
||||
curEquInfo.value?.suit[0],
|
||||
oathSkillId.value,
|
||||
curOathSkillLv.value.rarity,
|
||||
curOathSkillLv.value.lv,
|
||||
)
|
||||
return res
|
||||
})
|
||||
|
||||
const curOathSkillInfo = computed(() => {
|
||||
const res = curOathSkillLvs.value
|
||||
if (!res) {
|
||||
return undefined
|
||||
}
|
||||
// console.log(curEquInfo.value?.suit[0])
|
||||
return {
|
||||
...res,
|
||||
SkillAttack: parseFloat(res.SkillAttack.toString().split(',')[curOathSkillLv.value.lv - 1]),
|
||||
Buffer: parseFloat(res.Buffer.toString().split(',')[curOathSkillLv.value.lv - 1]),
|
||||
point: parseFloat(res.point.toString().split(',')[curOathSkillLv.value.lv - 1]),
|
||||
}
|
||||
})
|
||||
// const curOathSkillInfo = computed(() => {
|
||||
// const res = curOathSkillLvs.value
|
||||
// if (!res) {
|
||||
// return undefined
|
||||
// }
|
||||
// // console.log(curEquInfo.value?.suit[0])
|
||||
// return {
|
||||
// ...res,
|
||||
// SkillAttack: parseFloat(res.SkillAttack.toString().split(',')[curOathSkillLv.value.lv - 1]),
|
||||
// Buffer: parseFloat(res.Buffer.toString().split(',')[curOathSkillLv.value.lv - 1]),
|
||||
// point: parseFloat(res.point.toString().split(',')[curOathSkillLv.value.lv - 1]),
|
||||
// }
|
||||
// })
|
||||
|
||||
const chooseCategory = (cat: string) => {
|
||||
type.value = cat
|
||||
|
||||
@@ -13,6 +13,7 @@ export const useInfoStore = defineStore('infoStore', () => {
|
||||
suitId: string
|
||||
skillId: string
|
||||
rarity: string
|
||||
lv: number
|
||||
data: ISuit
|
||||
}[]
|
||||
>([])
|
||||
@@ -54,17 +55,17 @@ export const useInfoStore = defineStore('infoStore', () => {
|
||||
return result
|
||||
})
|
||||
|
||||
const getOathInfo = async (suitId: string, skillId: string, rarity: string) => {
|
||||
const getOathInfo = async (suitId: string, skillId: string, rarity: string, lv: number) => {
|
||||
const res = oathCache.value.find(
|
||||
(o) => o.suitId === suitId && o.skillId === skillId && o.rarity === rarity,
|
||||
(o) => o.suitId === suitId && o.skillId === skillId && o.rarity === rarity && o.lv === lv,
|
||||
)
|
||||
if (res) {
|
||||
return {
|
||||
...res.data,
|
||||
}
|
||||
}
|
||||
const data: ISuit = await api.getOathInfo(suitId, skillId, rarity)
|
||||
oathCache.value.push({ suitId, skillId, rarity, data })
|
||||
const data: ISuit = await api.getOathInfo(suitId, skillId, rarity, lv)
|
||||
oathCache.value.push({ suitId, skillId, rarity, lv, data })
|
||||
return {
|
||||
...data,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user