mirror of https://github.com/hykilpikonna/AquaDX
[+] Allow disable music rank for own machine (#110)
* [+] Allow disable music rank for own machine * fixpull/111/head
parent
dfee2cd71f
commit
151535139f
|
@ -5,6 +5,7 @@
|
|||
import Icon from "@iconify/svelte";
|
||||
import StatusOverlays from "../StatusOverlays.svelte";
|
||||
import { GAME } from "../../libs/sdk";
|
||||
import GameSettingFields from "./GameSettingFields.svelte";
|
||||
|
||||
const profileFields = [
|
||||
['name', t('settings.mai2.name')],
|
||||
|
@ -72,6 +73,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
<GameSettingFields game="mai2"/>
|
||||
<button class="exportButton" on:click={exportData}>
|
||||
<Icon icon="bxs:file-export"/>
|
||||
{t('settings.export')}
|
||||
|
|
|
@ -153,6 +153,8 @@ export const EN_REF_SETTINGS = {
|
|||
'settings.fields.gameUsername.desc': 'Your name shown in game',
|
||||
'settings.fields.optOutOfLeaderboard.name': 'Opt Out of Leaderboard',
|
||||
'settings.fields.optOutOfLeaderboard.desc': 'You will still be able to see yourself on the leaderboard after logging in',
|
||||
'settings.fields.enableMusicRank.name': 'Enable Recommended Music Rank on Your Machine',
|
||||
'settings.fields.enableMusicRank.desc': 'If you have your own ranking, you can turn this off. It only affects your own machine',
|
||||
'settings.mai2.name': 'Player Name',
|
||||
'settings.profile.picture': 'Profile Picture',
|
||||
'settings.profile.upload-new': 'Upload New',
|
||||
|
|
|
@ -163,6 +163,8 @@ const zhSettings: typeof EN_REF_SETTINGS = {
|
|||
'settings.fields.gameUsername.desc': '在游戏中显示的用户名',
|
||||
'settings.fields.optOutOfLeaderboard.name': '不参与排行榜',
|
||||
'settings.fields.optOutOfLeaderboard.desc': '登录之后还是可以在排行榜上看到自己',
|
||||
'settings.fields.enableMusicRank.name': '在你的机台上启用“推荐乐曲排行榜”',
|
||||
'settings.fields.enableMusicRank.desc': '如果你自己设计了排行榜的话,可以关闭这个。只会影响你自己的机器',
|
||||
'settings.mai2.name': '玩家名字',
|
||||
'settings.profile.picture': '头像',
|
||||
'settings.profile.upload-new': '上传',
|
||||
|
|
|
@ -43,6 +43,9 @@ class AquaGameOptions(
|
|||
|
||||
@SettingField("chu3-matching")
|
||||
var chusanMatchingReflector: String = "",
|
||||
|
||||
@SettingField("mai2")
|
||||
var enableMusicRank: Boolean = true,
|
||||
)
|
||||
|
||||
interface AquaGameOptionsRepo : JpaRepository<AquaGameOptions, Long>
|
||||
|
|
|
@ -3,6 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import ext.logger
|
||||
import ext.thread
|
||||
import icu.samnyan.aqua.sega.allnet.TokenChecker
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.QMai2UserPlaylog
|
||||
import org.springframework.scheduling.annotation.Scheduled
|
||||
|
@ -55,7 +56,14 @@ class GetGameRankingHandler(
|
|||
override fun handle(request: Map<String, Any>): Any = mapOf(
|
||||
"type" to request["type"],
|
||||
"gameRankingList" to when(request["type"]) {
|
||||
1 -> musicRankingCache.map { mapOf("id" to it.musicId, "point" to it.weight, "userName" to "") }
|
||||
1 -> {
|
||||
val opts = TokenChecker.getCurrentSession()?.user?.gameOptions
|
||||
// If is null or true, return the ranking list
|
||||
if (opts?.enableMusicRank == false)
|
||||
emptyList()
|
||||
else
|
||||
musicRankingCache.map { mapOf("id" to it.musicId, "point" to it.weight, "userName" to "") }
|
||||
}
|
||||
else -> emptyList()
|
||||
}
|
||||
)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE aqua_game_options ADD enable_music_rank BIT(1) NOT NULL DEFAULT 1;
|
Loading…
Reference in New Issue