Skip to content

Commit

Permalink
[fix] #119 #131 #140
Browse files Browse the repository at this point in the history
  • Loading branch information
Diving-Fish committed Sep 17, 2024
1 parent d57f2e4 commit f5073dd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 45 deletions.
50 changes: 9 additions & 41 deletions web/src/components/ChartTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -587,50 +587,18 @@ export default {
next: next,
};
},
get_min_ach(idx) {
return [0, 50, 60, 70, 75, 80, 90, 94, 97, 98, 99, 99.5, 100, 100.5, 101][
idx
];
},
getMoreRa(item) {
let coeff = new ScoreCoefficient(item.achievements)
let ds = item.ds;
let idx = coeff.idx;
let ach4 = Math.round(item.achievements * 10000);
let min_idx = Math.max(idx, 7);
let min_ach4 = Math.round(this.get_min_ach(min_idx) * 10000);
let max_idx = Math.min(min_idx + 3, 13);
let max_ach4 = Math.round(this.get_min_ach(max_idx + 1) * 10000);
let coeff = new ScoreCoefficient(item.achievements);
let more_ra = [];
for (let curr_ach4 = min_ach4; curr_ach4 < max_ach4; curr_ach4 += 2500) {
// console.log(curr_ach4, JSON.stringify(more_ra));
let curr_min_ra = new ScoreCoefficient(curr_ach4 / 10000).ra(ds);
if (curr_min_ra > new ScoreCoefficient((curr_ach4 - 1) / 10000).ra(ds)) {
if (curr_ach4 > ach4)
more_ra.push({
ra: curr_min_ra,
achievements: curr_ach4 / 10000,
});
while (more_ra.length < 5 && coeff.idx < coeff.get_table_len() - 1) {
const res = coeff.get_more_ra_local(item.ds);
if (res == null) {
coeff.set_idx(coeff.idx + 1);
more_ra.push({ra: coeff.ra(item.ds), achievements: coeff.a});
}
let curr_max_ra = new ScoreCoefficient((curr_ach4 + 2499) / 10000).ra(ds);
if (curr_max_ra > curr_min_ra) {
let l = curr_ach4,
r = curr_ach4 + 2499,
ans = r;
while (r >= l) {
let mid = Math.floor((r + l) / 2);
if (new ScoreCoefficient(mid / 10000).ra(ds) > curr_min_ra) {
ans = mid;
r = mid - 1;
} else {
l = mid + 1;
}
}
if (curr_ach4 > ach4)
more_ra.push({
ra: curr_max_ra,
achievements: ans / 10000,
});
else {
more_ra.push(res);
coeff.a = res.achievements;
}
}
return more_ra;
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ChuniTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {
},
methods: {
getLevel(index) {
return ["#22bb5b", "#fb9c2d", "#f64861", "#9e45e2", "#1B1B1B", "cyan"][index];
return ["#22bb5b", "#fb9c2d", "#f64861", "#9e45e2", "#607d8b", "cyan"][index];
},
getFC(str) {
if (str.startsWith("fullcombo")) return "green";
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/DeveloperToken.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="pl-6 mb-4">
<span style="color: #00000099">需要查分器中的玩家数据用于其他应用程序开发?请点击<a @click="open = true">这里</a>~</span>
<span style="opacity: 0.7;">需要查分器中的玩家数据用于其他应用程序开发?请点击<a @click="open = true">这里</a>~</span>
<v-dialog
width="800px"
:fullscreen="$vuetify.breakpoint.mobile"
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ProSettingsChuni.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default {
this.$vuetify.theme.dark = this.darkTheme;
},
getLevel(index) {
return ["#22bb5b", "#fb9c2d", "#f64861", "#9e45e2", "#1B1B1B", "cyan"][index];
return ["#22bb5b", "#fb9c2d", "#f64861", "#9e45e2", "#607d8b", "cyan"][index];
},
getFC(str) {
if (!str) return "grey";
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div
:style="$vuetify.breakpoint.mobile ? '' : 'display: flex; align-items: flex-end; justify-content: space-between'">
<h1>舞萌 DX | 中二节奏查分器</h1>
<profile :available_plates="available_plates" ref="profile" />
<profile v-if="username !== '未登录'" :available_plates="available_plates" ref="profile" />
</div>
<agreement></agreement>
<v-divider class="mt-4 mb-4" />
Expand Down Expand Up @@ -864,6 +864,7 @@ export default {
this.$message.success("用户分数及相对难度信息获取完成");
} else {
this.$message.warning("未获取用户分数");
this.chuniLoading = false;
}
this.$refs.pq.init();
that.loading = false;
Expand Down Expand Up @@ -922,6 +923,7 @@ export default {
})
.catch(() => {
this.$message.error("加载中二乐曲数据失败!");
this.chuniLoading = false;
})
})
.catch((err) => {
Expand Down
22 changes: 22 additions & 0 deletions web/src/scripts/ScoreCoefficient.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,28 @@ class ScoreCoefficient {
}
}

set_idx(idx) {
if (this.idx < SCORE_COEFFICIENT_TABLE.length) {
this.a = SCORE_COEFFICIENT_TABLE[idx][0]
this.c = SCORE_COEFFICIENT_TABLE[idx][1]
this.r = SCORE_COEFFICIENT_TABLE[idx][2]
this.idx = idx
}
}

get_more_ra_local(ds) {
const ra = this.ra(ds) + 1;
const ach = Math.ceil(Math.min(ra * 100 / ds / this.c, 100.5) * 10000) / 10000;
if (this.idx === SCORE_COEFFICIENT_TABLE.length - 1 || ach < SCORE_COEFFICIENT_TABLE[this.idx + 1][0]) {
return { ra: ra, achievements: ach };
}
return undefined;
}

get_table_len() {
return SCORE_COEFFICIENT_TABLE.length;
}

ra(ds) {
return Math.floor(this.c * ds * Math.min(100.5, this.a) / 100);
}
Expand Down

0 comments on commit f5073dd

Please sign in to comment.