[+] Allow disable music rank for own machine

pull/110/head
Clansty 2025-01-18 06:24:59 +08:00
parent 202df27f88
commit caba213e9d
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
6 changed files with 18 additions and 1 deletions

View File

@ -5,6 +5,7 @@
import Icon from "@iconify/svelte"; import Icon from "@iconify/svelte";
import StatusOverlays from "../StatusOverlays.svelte"; import StatusOverlays from "../StatusOverlays.svelte";
import { GAME } from "../../libs/sdk"; import { GAME } from "../../libs/sdk";
import GameSettingFields from "./GameSettingFields.svelte";
const profileFields = [ const profileFields = [
['name', t('settings.mai2.name')], ['name', t('settings.mai2.name')],
@ -72,6 +73,7 @@
</div> </div>
</div> </div>
{/each} {/each}
<GameSettingFields game="mai2"/>
<button class="exportButton" on:click={exportData}> <button class="exportButton" on:click={exportData}>
<Icon icon="bxs:file-export"/> <Icon icon="bxs:file-export"/>
{t('settings.export')} {t('settings.export')}

View File

@ -153,6 +153,8 @@ export const EN_REF_SETTINGS = {
'settings.fields.gameUsername.desc': 'Your name shown in game', 'settings.fields.gameUsername.desc': 'Your name shown in game',
'settings.fields.optOutOfLeaderboard.name': 'Opt Out of Leaderboard', '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.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.mai2.name': 'Player Name',
'settings.profile.picture': 'Profile Picture', 'settings.profile.picture': 'Profile Picture',
'settings.profile.upload-new': 'Upload New', 'settings.profile.upload-new': 'Upload New',

View File

@ -163,6 +163,8 @@ const zhSettings: typeof EN_REF_SETTINGS = {
'settings.fields.gameUsername.desc': '在游戏中显示的用户名', 'settings.fields.gameUsername.desc': '在游戏中显示的用户名',
'settings.fields.optOutOfLeaderboard.name': '不参与排行榜', 'settings.fields.optOutOfLeaderboard.name': '不参与排行榜',
'settings.fields.optOutOfLeaderboard.desc': '登录之后还是可以在排行榜上看到自己', 'settings.fields.optOutOfLeaderboard.desc': '登录之后还是可以在排行榜上看到自己',
'settings.fields.enableMusicRank.name': '在你的机台上启用“推荐乐曲排行榜”',
'settings.fields.enableMusicRank.desc': '如果你自己设计了排行榜的话,可以关闭这个。只会影响你自己的机器',
'settings.mai2.name': '玩家名字', 'settings.mai2.name': '玩家名字',
'settings.profile.picture': '头像', 'settings.profile.picture': '头像',
'settings.profile.upload-new': '上传', 'settings.profile.upload-new': '上传',

View File

@ -43,6 +43,9 @@ class AquaGameOptions(
@SettingField("chu3-matching") @SettingField("chu3-matching")
var chusanMatchingReflector: String = "", var chusanMatchingReflector: String = "",
@SettingField("mai2")
var enableMusicRank: Boolean = true,
) )
interface AquaGameOptionsRepo : JpaRepository<AquaGameOptions, Long> interface AquaGameOptionsRepo : JpaRepository<AquaGameOptions, Long>

View File

@ -3,6 +3,7 @@ package icu.samnyan.aqua.sega.maimai2.handler
import com.querydsl.jpa.impl.JPAQueryFactory import com.querydsl.jpa.impl.JPAQueryFactory
import ext.logger import ext.logger
import ext.thread import ext.thread
import icu.samnyan.aqua.sega.allnet.TokenChecker
import icu.samnyan.aqua.sega.general.BaseHandler import icu.samnyan.aqua.sega.general.BaseHandler
import icu.samnyan.aqua.sega.maimai2.model.userdata.QMai2UserPlaylog import icu.samnyan.aqua.sega.maimai2.model.userdata.QMai2UserPlaylog
import org.springframework.scheduling.annotation.Scheduled import org.springframework.scheduling.annotation.Scheduled
@ -55,7 +56,13 @@ class GetGameRankingHandler(
override fun handle(request: Map<String, Any>): Any = mapOf( override fun handle(request: Map<String, Any>): Any = mapOf(
"type" to request["type"], "type" to request["type"],
"gameRankingList" to when(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 (opts?.enableMusicRank != true)
emptyList()
else
musicRankingCache.map { mapOf("id" to it.musicId, "point" to it.weight, "userName" to "") }
}
else -> emptyList() else -> emptyList()
} }
) )

View File

@ -0,0 +1 @@
ALTER TABLE aqua_game_options ADD enable_music_rank BIT(1) NOT NULL DEFAULT 1;