@lf_maple/koishi-plugin-phi-plugin-full 0.1.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/core/.github/ISSUE_TEMPLATE/bug.yaml +133 -0
- package/core/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/core/.github/ISSUE_TEMPLATE/enhancement.yml +44 -0
- package/core/.vscode/c_cpp_properties.json +18 -0
- package/core/.vscode/launch.json +24 -0
- package/core/.vscode/settings.json +59 -0
- package/core/CHANGELOG.md +184 -0
- package/core/LICENSE +674 -0
- package/core/README.md +330 -0
- package/core/README_en.md +285 -0
- package/core/apps/Dan.js +129 -0
- package/core/apps/RankList.js +322 -0
- package/core/apps/aliasProposal.js +223 -0
- package/core/apps/apiSetting.js +592 -0
- package/core/apps/b19.js +1329 -0
- package/core/apps/botClient.js +64 -0
- package/core/apps/chart.js +692 -0
- package/core/apps/guessGame/guessIll.js +821 -0
- package/core/apps/guessGame/guessLetter.js +831 -0
- package/core/apps/guessGame/guessTips.js +254 -0
- package/core/apps/guessGame/letterGameUtils.js +74 -0
- package/core/apps/guessGame.js +214 -0
- package/core/apps/help.js +117 -0
- package/core/apps/manage.js +288 -0
- package/core/apps/market.js +243 -0
- package/core/apps/money.js +1064 -0
- package/core/apps/phisong.js +1418 -0
- package/core/apps/session.js +664 -0
- package/core/apps/setting.js +468 -0
- package/core/apps/update.js +541 -0
- package/core/apps/user.js +968 -0
- package/core/components/Config.js +249 -0
- package/core/components/Data.js +304 -0
- package/core/components/FileWatcherRegistry.js +102 -0
- package/core/components/Logger.js +11 -0
- package/core/components/ProcessCleanup.js +113 -0
- package/core/components/Version.js +56 -0
- package/core/components/YamlReader.js +157 -0
- package/core/components/baseClass.js +287 -0
- package/core/components/common.js +47 -0
- package/core/components/index.js +13 -0
- package/core/components/platform/index.js +79 -0
- package/core/components/platform/koishi.js +800 -0
- package/core/components/platform/koishiDatabaseRedis.js +391 -0
- package/core/components/platform/memoryRedis.js +209 -0
- package/core/components/platform/types.d.ts +272 -0
- package/core/components/platform/yunzai.js +604 -0
- package/core/components/segment.js +4 -0
- package/core/config/config//350/277/231/351/207/214/346/230/257/351/205/215/347/275/256/346/226/207/344/273/266/347/233/256/345/275/225.txt +0 -0
- package/core/config/default_config/banGroup.yaml +14 -0
- package/core/config/default_config/config.yaml +159 -0
- package/core/config/default_config/nickconfig.yaml +6 -0
- package/core/config/default_config/otherinfo.yaml +51 -0
- package/core/guoba.support.js +597 -0
- package/core/index.js +85 -0
- package/core/lib/AES.js +40 -0
- package/core/lib/Base64.js +22 -0
- package/core/lib/ByteReader.js +168 -0
- package/core/lib/GameProgress.js +37 -0
- package/core/lib/GameRecord.js +47 -0
- package/core/lib/GameSettings.js +24 -0
- package/core/lib/GameUser.js +19 -0
- package/core/lib/Level.js +6 -0
- package/core/lib/LevelRecord.js +9 -0
- package/core/lib/PhigrosUser.js +135 -0
- package/core/lib/SaveManager.js +117 -0
- package/core/lib/Summary.js +47 -0
- package/core/lib/TapTap/CompleteQRCodeData.js +27 -0
- package/core/lib/TapTap/LCHelper.js +81 -0
- package/core/lib/TapTap/TapTapHelper.js +170 -0
- package/core/lib/TapTap/getQRcode.js +61 -0
- package/core/lib/Util.js +30 -0
- package/core/lib/getQRcode.js +73 -0
- package/core/lib/http.js +105 -0
- package/core/model/README.md +3 -0
- package/core/model/api/aliasProposalService.js +151 -0
- package/core/model/api/apiVersion.js +67 -0
- package/core/model/api/autoSeekApi.js +165 -0
- package/core/model/api/botApiAuth.js +208 -0
- package/core/model/api/botSyncService.js +78 -0
- package/core/model/api/gameRecordPayload.js +24 -0
- package/core/model/api/makeRequest.js +1004 -0
- package/core/model/api/makeRequestFnc.js +17 -0
- package/core/model/api/phiApiClient.js +53 -0
- package/core/model/api/phiApiErrors.js +121 -0
- package/core/model/filesystem/getFile.js +256 -0
- package/core/model/filesystem/path.js +84 -0
- package/core/model/game/Chart.js +57 -0
- package/core/model/game/LevelRecordInfo.js +109 -0
- package/core/model/game/SongsInfo.js +46 -0
- package/core/model/game/b30Analysis.js +93 -0
- package/core/model/game/chartParser/Chart.js +23 -0
- package/core/model/game/chartParser/JudgeLine.js +38 -0
- package/core/model/game/chartParser/base/JudgeLineEvent.js +99 -0
- package/core/model/game/chartParser/base/Note.js +44 -0
- package/core/model/game/chartParser/base/SpeedEvent.js +25 -0
- package/core/model/game/chartParser/base/baseType.js +2 -0
- package/core/model/game/constNum.js +215 -0
- package/core/model/game/fCompute.js +711 -0
- package/core/model/game/getChartTag.js +140 -0
- package/core/model/game/getComment.js +132 -0
- package/core/model/game/getInfo.js +1069 -0
- package/core/model/game/getRksRank.js +77 -0
- package/core/model/game/markdown.js +77 -0
- package/core/model/integrations/Vika.js +103 -0
- package/core/model/integrations/getInfoFromTap.js +80 -0
- package/core/model/render/getPic.js +79 -0
- package/core/model/render/picmodle.js +496 -0
- package/core/model/render/progress-bar.js +44 -0
- package/core/model/render/puppeteer.js +431 -0
- package/core/model/render/renderPressureHistory.js +71 -0
- package/core/model/render/send.js +94 -0
- package/core/model/save/Save.js +953 -0
- package/core/model/save/analyzeSaveHistory.js +413 -0
- package/core/model/save/getBackup.js +328 -0
- package/core/model/save/getSave.js +90 -0
- package/core/model/save/getSaveFromApi.js +46 -0
- package/core/model/save/saveHistory.js +586 -0
- package/core/model/save/scoreHistory.js +101 -0
- package/core/model/theme/catalog.js +192 -0
- package/core/model/theme/installGuard.js +275 -0
- package/core/model/theme/installLock.js +174 -0
- package/core/model/theme/installer.js +398 -0
- package/core/model/theme/manager.js +408 -0
- package/core/model/theme/marketClient.js +294 -0
- package/core/model/theme/paths.js +42 -0
- package/core/model/theme/policy.js +54 -0
- package/core/model/theme/recovery.js +167 -0
- package/core/model/theme/useService.js +187 -0
- package/core/model/type/aliasProposal.d.ts +45 -0
- package/core/model/type/type.js +420 -0
- package/core/model/user/apiPermission.js +62 -0
- package/core/model/user/getBanGroup.js +120 -0
- package/core/model/user/getNotes.js +48 -0
- package/core/model/user/pluginData.js +101 -0
- package/core/model/user/userCredentialStore.js +154 -0
- package/core/model/user/userCredentials.js +860 -0
- package/core/package.json +60 -0
- package/core/resources/0608badSave/save.json +1 -0
- package/core/resources/LICENSE +201 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.art +220 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.css +345 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.html +434 -0
- package/core/resources/html/arcgrosB19/arcgros.png +0 -0
- package/core/resources/html/arcgrosB19/arcgrosB19-orz.html +276 -0
- package/core/resources/html/arcgrosB19/arcgrosB19.art +168 -0
- package/core/resources/html/arcgrosB19/arcgrosB19.css +637 -0
- package/core/resources/html/atlas/atlas-orz.html +313 -0
- package/core/resources/html/atlas/atlas.art +194 -0
- package/core/resources/html/atlas/atlas.css +695 -0
- package/core/resources/html/avatar/-SURREALISM-.png +0 -0
- package/core/resources/html/avatar/Alkaid.png +0 -0
- package/core/resources/html/avatar/Aphasia.png +0 -0
- package/core/resources/html/avatar/Artificial Existence.png +0 -0
- package/core/resources/html/avatar/Bonus Time.png +0 -0
- package/core/resources/html/avatar/Burn.png +0 -0
- package/core/resources/html/avatar/Cereris1.png +0 -0
- package/core/resources/html/avatar/Cereris2.png +0 -0
- package/core/resources/html/avatar/Cereris3.png +0 -0
- package/core/resources/html/avatar/Christmas -2019.png +0 -0
- package/core/resources/html/avatar/Cipher1.png +0 -0
- package/core/resources/html/avatar/Class Memories.png +0 -0
- package/core/resources/html/avatar/Credits.png +0 -0
- package/core/resources/html/avatar/Dash.png +0 -0
- package/core/resources/html/avatar/Dlyrotz.png +0 -0
- package/core/resources/html/avatar/Doppelganger1.png +0 -0
- package/core/resources/html/avatar/Doppelganger2.png +0 -0
- package/core/resources/html/avatar/Drop it.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix1.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix2.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix3.png +0 -0
- package/core/resources/html/avatar/Engine x Start!! (melody mix).png +0 -0
- package/core/resources/html/avatar/Engine x Start!! extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Eradication Catastrophe.png +0 -0
- package/core/resources/html/avatar/FULi AUTO SHOOTER extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/FULi AUTO SHOOTER.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special1.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special2.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2641.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2642.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2643.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2644.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2645.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2646.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2647.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2648.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2649.png +0 -0
- package/core/resources/html/avatar/Find_Me.png +0 -0
- package/core/resources/html/avatar/Geopelia 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Geopelia 2 -by cycats.png +0 -0
- package/core/resources/html/avatar/Geopelia 3 -by /344/275/225/345/221/265.png +0 -0
- package/core/resources/html/avatar/Geopelia in WEPLAY -by /346/265/267/344/272/247.png +0 -0
- package/core/resources/html/avatar/Gino-AprilFool.png +0 -0
- package/core/resources/html/avatar/Glaciaxion.png +0 -0
- package/core/resources/html/avatar/HumaN.png +0 -0
- package/core/resources/html/avatar/Indelible Scar.png +0 -0
- package/core/resources/html/avatar/Introduction.png +0 -0
- package/core/resources/html/avatar/Khronostasis Katharsis.png +0 -0
- package/core/resources/html/avatar/MARENOL.png +0 -0
- package/core/resources/html/avatar/Marenol extra 1 -by /345/226/265n/350/221/265.png +0 -0
- package/core/resources/html/avatar/Non-Melodic Ragez (MUG Edit).png +0 -0
- package/core/resources/html/avatar/Non-Melodic Ragez extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Oblivion +0 -0
- package/core/resources/html/avatar/OblivionPHIN.png +0 -0
- package/core/resources/html/avatar/Para.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz1.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz2.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz3.png +0 -0
- package/core/resources/html/avatar/RIPPER extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/RIPPER extra 2 -by /344/275/225/345/221/265.png +0 -0
- package/core/resources/html/avatar/Sein.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special2.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/231/256/351/200/232.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/233/262/347/273/230Ver.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-Special.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/231/256/351/200/232.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/233/262/347/273/230Ver.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240/345/222/214/346/260/264/351/235/222-Special.png +0 -0
- package/core/resources/html/avatar/Snow Desert.png +0 -0
- package/core/resources/html/avatar/Sparkle New Life.png +0 -0
- package/core/resources/html/avatar/Sultan Rage.png +0 -0
- package/core/resources/html/avatar/Winter /342/206/221cube/342/206/223.png +0 -0
- package/core/resources/html/avatar/Xenolith.png +0 -0
- package/core/resources/html/avatar/[PRAW].png +0 -0
- package/core/resources/html/avatar/dB doll.png +0 -0
- package/core/resources/html/avatar/ripper.png +0 -0
- package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2721.png +0 -0
- package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2722.png +0 -0
- package/core/resources/html/avatar//344/270/207/345/220/250/345/214/277/345/220/215/344/277/241.png +0 -0
- package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251 extra 1 -by /345/276/241/345/235/202/346/236/234/345/255/220.png +0 -0
- package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251.png +0 -0
- package/core/resources/html/avatar//345/205/211.png +0 -0
- package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2051.png +0 -0
- package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2052.png +0 -0
- package/core/resources/html/avatar//346/260/264/351/235/222-/344/270/200/345/221/250/345/271/264/347/233/270/350/201/232.png +0 -0
- package/core/resources/html/avatar//346/267/267/344/271/261-Confusion.png +0 -0
- package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2361.png +0 -0
- package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2362.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/201-Special.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2011.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2012.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2013.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2014.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2015.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2016.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2017.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/227-Special.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2271.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2272.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2273.png +0 -0
- package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2611.png +0 -0
- package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2612.png +0 -0
- package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2501.png +0 -0
- package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2502.png +0 -0
- package/core/resources/html/avatar//351/235/222/350/212/275-Special.png +0 -0
- package/core/resources/html/avatar//351/235/222/350/212/275.png +0 -0
- package/core/resources/html/avatar//351/243/216/345/261/277.png +0 -0
- package/core/resources/html/avatar//351/270/240-AprilFool.png +0 -0
- package/core/resources/html/avatar//351/270/240-/344/270/200/345/221/250/345/271/264/347/233/270/350/201/232.png +0 -0
- package/core/resources/html/b19/b19.art +490 -0
- package/core/resources/html/b19/b19.css +1261 -0
- package/core/resources/html/b19/b19666.art +350 -0
- package/core/resources/html/b19/b19666.css +1409 -0
- package/core/resources/html/b19/b19666.html +481 -0
- package/core/resources/html/b19/b19title.css +120 -0
- package/core/resources/html/b19/best19.html +853 -0
- package/core/resources/html/b19/dss2-orz.html +428 -0
- package/core/resources/html/b19/dss2.art +298 -0
- package/core/resources/html/b19/dss2.css +776 -0
- package/core/resources/html/b19/res/666.jpeg +0 -0
- package/core/resources/html/chap/chap-orz.html +93 -0
- package/core/resources/html/chap/chap.art +87 -0
- package/core/resources/html/chap/chap.css +365 -0
- package/core/resources/html/chartImg/chartImg.art +169 -0
- package/core/resources/html/chartImg/chartImg.css +439 -0
- package/core/resources/html/chartImg/echarts-wordcloud.min.js +3 -0
- package/core/resources/html/chartImg/echarts.js +85796 -0
- package/core/resources/html/chartImg/img/Drag.png +0 -0
- package/core/resources/html/chartImg/img/DragHL.png +0 -0
- package/core/resources/html/chartImg/img/Flick.png +0 -0
- package/core/resources/html/chartImg/img/FlickHL.png +0 -0
- package/core/resources/html/chartImg/img/Hold.png +0 -0
- package/core/resources/html/chartImg/img/HoldHL.png +0 -0
- package/core/resources/html/chartImg/img/Hold_End.png +0 -0
- package/core/resources/html/chartImg/img/Hold_Head.png +0 -0
- package/core/resources/html/chartImg/img/Hold_HeadHL.png +0 -0
- package/core/resources/html/chartImg/img/Tap.png +0 -0
- package/core/resources/html/chartImg/img/TapHL.png +0 -0
- package/core/resources/html/chartInfo/chartInfo-orz.html +250 -0
- package/core/resources/html/chartInfo/chartInfo.art +222 -0
- package/core/resources/html/chartInfo/chartInfo.css +265 -0
- package/core/resources/html/chartInfo/echarts-wordcloud.min.js +3 -0
- package/core/resources/html/chartInfo/echarts.js +85796 -0
- package/core/resources/html/clg/clg-orz.html +218 -0
- package/core/resources/html/clg/clg.art +88 -0
- package/core/resources/html/clg/clg.css +230 -0
- package/core/resources/html/clg/demo.jpg +0 -0
- package/core/resources/html/common/common.css +319 -0
- package/core/resources/html/common/css/playerInfo.css +136 -0
- package/core/resources/html/common/font/Aldrich-Regular.ttf +0 -0
- package/core/resources/html/common/font/HIMALAYA.TTF +0 -0
- package/core/resources/html/common/font/NotoColorEmoji-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSans-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSansArabic.ttf +0 -0
- package/core/resources/html/common/font/NotoSansCanadianAboriginal.ttf +0 -0
- package/core/resources/html/common/font/NotoSansJP.ttf +0 -0
- package/core/resources/html/common/font/NotoSansKannada.ttf +0 -0
- package/core/resources/html/common/font/NotoSansMath-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSansSymbols2.ttf +0 -0
- package/core/resources/html/common/font/phi.ttf +0 -0
- package/core/resources/html/common/font//345/220/236/345/274/245/346/201/260/344/277/212.ttf +0 -0
- package/core/resources/html/common/layout/default.art +324 -0
- package/core/resources/html/common/layout/elem.art +21 -0
- package/core/resources/html/common/theme/snow/snow.css +17 -0
- package/core/resources/html/common/theme/snow/snow.js +19 -0
- package/core/resources/html/common/theme/star/star.js +201 -0
- package/core/resources/html/common/theme/topText/topText.css +15 -0
- package/core/resources/html/common/theme/topText/topText.js +30 -0
- package/core/resources/html/difficultyHistory/difficultyHistory-orz.html +361 -0
- package/core/resources/html/difficultyHistory/difficultyHistory.art +102 -0
- package/core/resources/html/difficultyHistory/difficultyHistory.css +205 -0
- package/core/resources/html/guess/guess-orz.html +50 -0
- package/core/resources/html/guess/guess.art +51 -0
- package/core/resources/html/guess/guess.css +33 -0
- package/core/resources/html/help/help-orz.html +73 -0
- package/core/resources/html/help/help.art +84 -0
- package/core/resources/html/help/help.css +266 -0
- package/core/resources/html/historyB30/historyB30-orz.html +168 -0
- package/core/resources/html/historyB30/historyB30.art +143 -0
- package/core/resources/html/historyB30/historyB30.css +270 -0
- package/core/resources/html/ill/ill-orz.html +21 -0
- package/core/resources/html/ill/ill.art +23 -0
- package/core/resources/html/ill/ill.css +79 -0
- package/core/resources/html/jrrp/ShineAfter.removebg.png +0 -0
- package/core/resources/html/jrrp/jrrp-orz.html +68 -0
- package/core/resources/html/jrrp/jrrp.art +58 -0
- package/core/resources/html/jrrp/jrrp.css +251 -0
- package/core/resources/html/list/list-orz.html +35 -0
- package/core/resources/html/list/list.art +67 -0
- package/core/resources/html/list/list.css +259 -0
- package/core/resources/html/lvsco/demo.jpg +0 -0
- package/core/resources/html/lvsco/lvsco-orz.html +334 -0
- package/core/resources/html/lvsco/lvsco.art +314 -0
- package/core/resources/html/lvsco/lvsco.css +706 -0
- package/core/resources/html/market/detail.art +44 -0
- package/core/resources/html/market/market.art +86 -0
- package/core/resources/html/market/market.css +64 -0
- package/core/resources/html/newSong/newSong.art +34 -0
- package/core/resources/html/newSong/newSong.css +48 -0
- package/core/resources/html/newSong/newSong.html +23 -0
- package/core/resources/html/newnotice/newnotice.art +47 -0
- package/core/resources/html/newnotice/newnotice.css +83 -0
- package/core/resources/html/otherimg/0.png +0 -0
- package/core/resources/html/otherimg/1.png +0 -0
- package/core/resources/html/otherimg/2.png +0 -0
- package/core/resources/html/otherimg/3.png +0 -0
- package/core/resources/html/otherimg/4.png +0 -0
- package/core/resources/html/otherimg/5.png +0 -0
- package/core/resources/html/otherimg/A.png +0 -0
- package/core/resources/html/otherimg/B.png +0 -0
- package/core/resources/html/otherimg/C.png +0 -0
- package/core/resources/html/otherimg/F.png +0 -0
- package/core/resources/html/otherimg/FC.png +0 -0
- package/core/resources/html/otherimg/NEW.png +0 -0
- package/core/resources/html/otherimg/Phigros_Icon_3.0.0.png +0 -0
- package/core/resources/html/otherimg/S.png +0 -0
- package/core/resources/html/otherimg/Star1.png +0 -0
- package/core/resources/html/otherimg/Star2.png +0 -0
- package/core/resources/html/otherimg/V.png +0 -0
- package/core/resources/html/otherimg/callback.png +0 -0
- package/core/resources/html/otherimg/chapHelp.png +0 -0
- package/core/resources/html/otherimg/dan_code.png +0 -0
- package/core/resources/html/otherimg/data.png +0 -0
- package/core/resources/html/otherimg/helpDoc.png +0 -0
- package/core/resources/html/otherimg/nickSuggest.png +0 -0
- package/core/resources/html/otherimg/phi.png +0 -0
- package/core/resources/html/otherimg/phigros.png +0 -0
- package/core/resources/html/otherimg/snow1.png +0 -0
- package/core/resources/html/otherimg/snow2.png +0 -0
- package/core/resources/html/otherimg/snow3.png +0 -0
- package/core/resources/html/otherimg/snow4.png +0 -0
- package/core/resources/html/otherimg/title.png +0 -0
- package/core/resources/html/rand/rand-orz.html +62 -0
- package/core/resources/html/rand/rand.art +59 -0
- package/core/resources/html/rand/rand.css +257 -0
- package/core/resources/html/rankingList/rankingList-orz.html +456 -0
- package/core/resources/html/rankingList/rankingList.art +171 -0
- package/core/resources/html/rankingList/rankingList.css +570 -0
- package/core/resources/html/rankingList-old/rankingList-orz.html +300 -0
- package/core/resources/html/rankingList-old/rankingList.art +89 -0
- package/core/resources/html/rankingList-old/rankingList.css +265 -0
- package/core/resources/html/score/score-orz.html +625 -0
- package/core/resources/html/score/score.art +249 -0
- package/core/resources/html/score/score.css +435 -0
- package/core/resources/html/score/scoreOld-orz.html +128 -0
- package/core/resources/html/score/scoreOld.art +230 -0
- package/core/resources/html/score/scoreOld.css +475 -0
- package/core/resources/html/score/scoreRankList-orz.html +613 -0
- package/core/resources/html/score/scoreRankList.art +231 -0
- package/core/resources/html/score/scoreRankList.css +197 -0
- package/core/resources/html/setting/setting-orz.html +123 -0
- package/core/resources/html/setting/setting.art +72 -0
- package/core/resources/html/setting/setting.css +170 -0
- package/core/resources/html/setting/userSetting-orz.html +132 -0
- package/core/resources/html/setting/userSetting.art +48 -0
- package/core/resources/html/setting/userSetting.css +160 -0
- package/core/resources/html/sign/sign-orz.html +262 -0
- package/core/resources/html/sign/sign.art +163 -0
- package/core/resources/html/sign/sign.css +706 -0
- package/core/resources/html/suggest/suggest.art +271 -0
- package/core/resources/html/suggest/suggest.css +300 -0
- package/core/resources/html/table/table-orz.html +228 -0
- package/core/resources/html/table/table.art +163 -0
- package/core/resources/html/table/table.css +401 -0
- package/core/resources/html/tasks/tasks-orz.html +83 -0
- package/core/resources/html/tasks/tasks.art +118 -0
- package/core/resources/html/tasks/tasks.css +334 -0
- package/core/resources/html/update/update-orz.html +735 -0
- package/core/resources/html/update/update.art +259 -0
- package/core/resources/html/update/update.css +676 -0
- package/core/resources/html/userinfo/userinfo-old-orz.html +408 -0
- package/core/resources/html/userinfo/userinfo-old.art +233 -0
- package/core/resources/html/userinfo/userinfo-old.css +466 -0
- package/core/resources/html/userinfo/userinfo-orz.html +543 -0
- package/core/resources/html/userinfo/userinfo.art +288 -0
- package/core/resources/html/userinfo/userinfo.css +757 -0
- package/core/resources/info/DLC/arc.json +412 -0
- package/core/resources/info/DLC/chunithm.json +1172 -0
- package/core/resources/info/DLC/dynamix.json +455 -0
- package/core/resources/info/DLC/fanshi.json +132 -0
- package/core/resources/info/DLC/lanota.json +412 -0
- package/core/resources/info/DLC/maimai.json +1110 -0
- package/core/resources/info/DLC/orz.json +158 -0
- package/core/resources/info/DLC/rizline.json +40 -0
- package/core/resources/info/DLC/rotaeno.json +159 -0
- package/core/resources/info/DLC/ryceam.json +53 -0
- package/core/resources/info/avatar.txt +109 -0
- package/core/resources/info/chaplist.yaml +102 -0
- package/core/resources/info/help/api.json +83 -0
- package/core/resources/info/help.json +436 -0
- package/core/resources/info/info.csv +315 -0
- package/core/resources/info/infolist.json +1758 -0
- package/core/resources/info/jrrp.json +92 -0
- package/core/resources/info/nicklist.yaml +2373 -0
- package/core/resources/info/notesInfo.json +1 -0
- package/core/resources/info/notice.json +11 -0
- package/core/resources/info/oldInfo/100/change.csv +218 -0
- package/core/resources/info/oldInfo/100/info.json +7 -0
- package/core/resources/info/oldInfo/101/change.csv +218 -0
- package/core/resources/info/oldInfo/101/info.json +7 -0
- package/core/resources/info/oldInfo/102/change.csv +223 -0
- package/core/resources/info/oldInfo/102/info.json +7 -0
- package/core/resources/info/oldInfo/103/change.csv +224 -0
- package/core/resources/info/oldInfo/103/info.json +7 -0
- package/core/resources/info/oldInfo/104/change.csv +225 -0
- package/core/resources/info/oldInfo/104/info.json +7 -0
- package/core/resources/info/oldInfo/105/change.csv +228 -0
- package/core/resources/info/oldInfo/105/info.json +7 -0
- package/core/resources/info/oldInfo/106/change.csv +229 -0
- package/core/resources/info/oldInfo/106/info.json +7 -0
- package/core/resources/info/oldInfo/108/change.csv +233 -0
- package/core/resources/info/oldInfo/108/info.json +7 -0
- package/core/resources/info/oldInfo/109/change.csv +235 -0
- package/core/resources/info/oldInfo/109/info.json +7 -0
- package/core/resources/info/oldInfo/110/change.csv +235 -0
- package/core/resources/info/oldInfo/110/info.json +7 -0
- package/core/resources/info/oldInfo/111/change.csv +242 -0
- package/core/resources/info/oldInfo/111/info.json +7 -0
- package/core/resources/info/oldInfo/112/change.csv +242 -0
- package/core/resources/info/oldInfo/112/info.json +7 -0
- package/core/resources/info/oldInfo/113/change.csv +244 -0
- package/core/resources/info/oldInfo/113/info.json +7 -0
- package/core/resources/info/oldInfo/115/change.csv +247 -0
- package/core/resources/info/oldInfo/115/info.json +7 -0
- package/core/resources/info/oldInfo/116/change.csv +249 -0
- package/core/resources/info/oldInfo/116/info.json +7 -0
- package/core/resources/info/oldInfo/118/change.csv +252 -0
- package/core/resources/info/oldInfo/118/info.json +7 -0
- package/core/resources/info/oldInfo/119/change.csv +255 -0
- package/core/resources/info/oldInfo/119/info.json +7 -0
- package/core/resources/info/oldInfo/120/change.csv +255 -0
- package/core/resources/info/oldInfo/120/info.json +7 -0
- package/core/resources/info/oldInfo/121/change.csv +257 -0
- package/core/resources/info/oldInfo/121/info.json +7 -0
- package/core/resources/info/oldInfo/122/change.csv +260 -0
- package/core/resources/info/oldInfo/122/info.json +7 -0
- package/core/resources/info/oldInfo/123/change.csv +260 -0
- package/core/resources/info/oldInfo/123/info.json +7 -0
- package/core/resources/info/oldInfo/124/change.csv +262 -0
- package/core/resources/info/oldInfo/124/info.json +7 -0
- package/core/resources/info/oldInfo/125/change.csv +266 -0
- package/core/resources/info/oldInfo/125/info.json +7 -0
- package/core/resources/info/oldInfo/126/change.csv +269 -0
- package/core/resources/info/oldInfo/126/info.json +7 -0
- package/core/resources/info/oldInfo/127/change.csv +270 -0
- package/core/resources/info/oldInfo/127/info.json +7 -0
- package/core/resources/info/oldInfo/128/change.csv +273 -0
- package/core/resources/info/oldInfo/128/info.json +7 -0
- package/core/resources/info/oldInfo/129/change.csv +274 -0
- package/core/resources/info/oldInfo/129/info.json +7 -0
- package/core/resources/info/oldInfo/130/change.csv +275 -0
- package/core/resources/info/oldInfo/130/info.json +7 -0
- package/core/resources/info/oldInfo/131/change.csv +278 -0
- package/core/resources/info/oldInfo/131/info.json +7 -0
- package/core/resources/info/oldInfo/132/change.csv +280 -0
- package/core/resources/info/oldInfo/132/info.json +7 -0
- package/core/resources/info/oldInfo/133/change.csv +284 -0
- package/core/resources/info/oldInfo/133/info.json +7 -0
- package/core/resources/info/oldInfo/134/change.csv +286 -0
- package/core/resources/info/oldInfo/134/info.json +7 -0
- package/core/resources/info/oldInfo/135/change.csv +290 -0
- package/core/resources/info/oldInfo/135/info.json +7 -0
- package/core/resources/info/oldInfo/136/change.csv +290 -0
- package/core/resources/info/oldInfo/136/info.json +7 -0
- package/core/resources/info/oldInfo/137/change.csv +293 -0
- package/core/resources/info/oldInfo/137/info.json +7 -0
- package/core/resources/info/oldInfo/138/change.csv +295 -0
- package/core/resources/info/oldInfo/138/info.json +7 -0
- package/core/resources/info/oldInfo/139/change.csv +295 -0
- package/core/resources/info/oldInfo/139/info.json +7 -0
- package/core/resources/info/oldInfo/140/change.csv +298 -0
- package/core/resources/info/oldInfo/140/info.json +7 -0
- package/core/resources/info/oldInfo/141/change.csv +300 -0
- package/core/resources/info/oldInfo/141/info.json +7 -0
- package/core/resources/info/oldInfo/142/change.csv +302 -0
- package/core/resources/info/oldInfo/142/info.json +7 -0
- package/core/resources/info/oldInfo/143/change.csv +303 -0
- package/core/resources/info/oldInfo/143/info.json +7 -0
- package/core/resources/info/oldInfo/144/change.csv +303 -0
- package/core/resources/info/oldInfo/144/info.json +7 -0
- package/core/resources/info/oldInfo/145/change.csv +305 -0
- package/core/resources/info/oldInfo/145/info.json +7 -0
- package/core/resources/info/oldInfo/146/change.csv +305 -0
- package/core/resources/info/oldInfo/146/info.json +7 -0
- package/core/resources/info/oldInfo/148/change.csv +307 -0
- package/core/resources/info/oldInfo/148/info.json +7 -0
- package/core/resources/info/oldInfo/149/change.csv +307 -0
- package/core/resources/info/oldInfo/149/info.json +7 -0
- package/core/resources/info/oldInfo/151/change.csv +309 -0
- package/core/resources/info/oldInfo/151/info.json +7 -0
- package/core/resources/info/oldInfo/152/change.csv +312 -0
- package/core/resources/info/oldInfo/152/info.json +7 -0
- package/core/resources/info/oldInfo/153/change.csv +313 -0
- package/core/resources/info/oldInfo/153/info.json +7 -0
- package/core/resources/info/oldInfo/154/change.csv +315 -0
- package/core/resources/info/oldInfo/154/info.json +7 -0
- package/core/resources/info/oldInfo/92/change.csv +204 -0
- package/core/resources/info/oldInfo/92/info.json +7 -0
- package/core/resources/info/oldInfo/93/change.csv +206 -0
- package/core/resources/info/oldInfo/93/info.json +7 -0
- package/core/resources/info/oldInfo/94/change.csv +209 -0
- package/core/resources/info/oldInfo/94/info.json +7 -0
- package/core/resources/info/oldInfo/95/change.csv +211 -0
- package/core/resources/info/oldInfo/95/info.json +7 -0
- package/core/resources/info/oldInfo/96/change.csv +216 -0
- package/core/resources/info/oldInfo/96/info.json +7 -0
- package/core/resources/info/oldInfo/98/change.csv +216 -0
- package/core/resources/info/oldInfo/98/info.json +7 -0
- package/core/resources/info/oldInfo/99/change.csv +217 -0
- package/core/resources/info/oldInfo/99/info.json +7 -0
- package/core/resources/info/oldNotesInfo.json +1 -0
- package/core/resources/info/sentences.json +1 -0
- package/core/resources/info/spinfo.json +362 -0
- package/core/resources/info/tips.txt +278 -0
- package/core/resources/otherill//351/233/252/351/231/215SP.png +0 -0
- package/core/resources/song-select.html +535 -0
- package/core/resources/themes/README.md +24 -0
- package/core/resources/themes/milthm/A.png +0 -0
- package/core/resources/themes/milthm/B.png +0 -0
- package/core/resources/themes/milthm/C.png +0 -0
- package/core/resources/themes/milthm/F.png +0 -0
- package/core/resources/themes/milthm/FC.png +0 -0
- package/core/resources/themes/milthm/S.png +0 -0
- package/core/resources/themes/milthm/V.png +0 -0
- package/core/resources/themes/milthm/arcgrosB19.css +36 -0
- package/core/resources/themes/milthm/b19.art +464 -0
- package/core/resources/themes/milthm/b19.css +1314 -0
- package/core/resources/themes/milthm/bg.png +0 -0
- package/core/resources/themes/milthm/clg.css +37 -0
- package/core/resources/themes/milthm/difficultyHistory.css +42 -0
- package/core/resources/themes/milthm/font.ttf +0 -0
- package/core/resources/themes/milthm/help.css +36 -0
- package/core/resources/themes/milthm/historyB30.css +48 -0
- package/core/resources/themes/milthm/info.yaml +45 -0
- package/core/resources/themes/milthm/list.css +39 -0
- package/core/resources/themes/milthm/phi.png +0 -0
- package/core/resources/themes/milthm/setting.css +37 -0
- package/core/resources/themes/milthm/sign.css +81 -0
- package/core/resources/themes/milthm/suggest.css +40 -0
- package/core/resources/themes/milthm/table.css +54 -0
- package/core/resources/themes/milthm/update.css +68 -0
- package/core/tests/aliasProposalService.test.js +82 -0
- package/core/tests/apiAccountDeletion.test.js +125 -0
- package/core/tests/apiPermission.test.js +44 -0
- package/core/tests/apiVersion.test.js +55 -0
- package/core/tests/b30Analysis.test.js +38 -0
- package/core/tests/backgroundIllustration.test.js +21 -0
- package/core/tests/botApiAuthRecovery.test.js +148 -0
- package/core/tests/botSyncService.test.js +42 -0
- package/core/tests/fileWatcherRegistry.test.js +44 -0
- package/core/tests/gameRecordPayload.test.js +34 -0
- package/core/tests/guessLetter.test.js +79 -0
- package/core/tests/makeRequestHandling.test.js +118 -0
- package/core/tests/marketOverflow.test.js +31 -0
- package/core/tests/platformTemplateCache.test.js +92 -0
- package/core/tests/pluginDataThemePreference.test.js +36 -0
- package/core/tests/processCleanup.test.js +58 -0
- package/core/tests/puppeteerShutdown.test.js +17 -0
- package/core/tests/renderPressureHistory.test.js +59 -0
- package/core/tests/saveStats.test.js +26 -0
- package/core/tests/themeInstallGuard.test.js +289 -0
- package/core/tests/themeManager.test.js +625 -0
- package/core/tests/themeManagerInit.test.js +11 -0
- package/core/tests/themeMarket.test.js +855 -0
- package/core/tests/themePageRouting.test.js +431 -0
- package/core/tests/themePolicy.test.js +28 -0
- package/core/tests/themeStorageRecovery.test.js +192 -0
- package/core/tests/userCredentialModuleBoundaries.test.js +41 -0
- package/core/tests/userCredentials.test.js +285 -0
- package/core/tsconfig.json +32 -0
- package/core/types/vendor.d.ts +14 -0
- package/lib/index.cjs +358 -0
- package/lib/index.d.cts +182 -0
- package/lib/index.d.ts +182 -0
- package/lib/index.js +320 -0
- package/package.json +74 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
import Config from '../../components/Config.js'
|
|
2
|
+
import logger from '../../components/Logger.js'
|
|
3
|
+
import LevelRecordInfo from './LevelRecordInfo.js'
|
|
4
|
+
import { MAX_DIFFICULTY } from './constNum.js'
|
|
5
|
+
import getInfo from './getInfo.js'
|
|
6
|
+
import platform from '../../components/platform/index.js'
|
|
7
|
+
|
|
8
|
+
export default class fCompute {
|
|
9
|
+
/**
|
|
10
|
+
* 计算等效rks
|
|
11
|
+
* @param {number} acc
|
|
12
|
+
* @param {number} difficulty
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
static rks(acc, difficulty) {
|
|
16
|
+
if (acc == 100) {
|
|
17
|
+
/**满分原曲定数即为有效rks */
|
|
18
|
+
return Number(difficulty)
|
|
19
|
+
} else if (acc < 70) {
|
|
20
|
+
/**无效acc */
|
|
21
|
+
return 0
|
|
22
|
+
} else {
|
|
23
|
+
/**非满分计算公式 [(((acc - 55) / 45) ^ 2) * 原曲定数] */
|
|
24
|
+
return difficulty * (((acc - 55) / 45) * ((acc - 55) / 45))
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @overload
|
|
30
|
+
* @param {number} rks 目标rks
|
|
31
|
+
* @param {number} difficulty 定数
|
|
32
|
+
* @param {number} count 保留位数
|
|
33
|
+
* @returns {string}
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @overload
|
|
37
|
+
* @param {number} rks 目标rks
|
|
38
|
+
* @param {number} difficulty 定数
|
|
39
|
+
* @param {undefined} [count=undefined] 保留位数
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* 计算所需acc
|
|
44
|
+
* @param {number} rks 目标rks
|
|
45
|
+
* @param {number} difficulty 定数
|
|
46
|
+
* @param {number | undefined} [count=undefined] 保留位数
|
|
47
|
+
* @returns 所需acc
|
|
48
|
+
*/
|
|
49
|
+
static suggest(rks, difficulty, count = undefined) {
|
|
50
|
+
let ans = 45 * Math.sqrt(rks / difficulty) + 55
|
|
51
|
+
|
|
52
|
+
if (ans >= 100)
|
|
53
|
+
if (count != undefined) {
|
|
54
|
+
return "无法推分"
|
|
55
|
+
} else {
|
|
56
|
+
return -1;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (count != undefined) {
|
|
60
|
+
return `${ans.toFixed(count)}%`
|
|
61
|
+
} else {
|
|
62
|
+
return ans
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 发送文件
|
|
69
|
+
* @param {*} e
|
|
70
|
+
* @param {string | Buffer} file
|
|
71
|
+
* @param {string} filename
|
|
72
|
+
*/
|
|
73
|
+
static async sendFile(e, file, filename) {
|
|
74
|
+
try {
|
|
75
|
+
await platform.uploadFile(e, file, filename)
|
|
76
|
+
|
|
77
|
+
} catch (err) {
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
logger.error(`文件上传错误:${logger.red(err.stack)}`)
|
|
80
|
+
console.error(err)
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
await platform.reply(e, `文件上传错误:${err.stack}`)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 获取角色介绍背景曲绘
|
|
88
|
+
* @param {string} save_background
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
static getBackground(save_background) {
|
|
92
|
+
try {
|
|
93
|
+
return getInfo.getBackground(save_background)
|
|
94
|
+
} catch (err) {
|
|
95
|
+
logger.error(`获取背景曲绘错误`, err)
|
|
96
|
+
return false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 为数字添加前导零
|
|
102
|
+
* @param {number} num 原数字
|
|
103
|
+
* @param {number} cover 总位数
|
|
104
|
+
* @returns 前导零数字
|
|
105
|
+
*/
|
|
106
|
+
static ped(num, cover) {
|
|
107
|
+
return num.toString().padStart(cover, '0')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 标准化分数
|
|
112
|
+
* @param {number} score 分数
|
|
113
|
+
* @returns 标准化的分数 0'000'000
|
|
114
|
+
*/
|
|
115
|
+
static std_score(score) {
|
|
116
|
+
let s1 = Math.floor(score / 1e6)
|
|
117
|
+
let s2 = Math.floor(score / 1e3) % 1e3
|
|
118
|
+
let s3 = score % 1e3
|
|
119
|
+
return `${s1}'${this.ped(s2, 3)}'${this.ped(s3, 3)}`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 随机数,包含上下界
|
|
124
|
+
* @param {number} min 最小值
|
|
125
|
+
* @param {number} max 最大值
|
|
126
|
+
* @returns 随机数
|
|
127
|
+
*/
|
|
128
|
+
static randInt(min, max) {
|
|
129
|
+
return Math.floor(Math.random() * (max - min + 1) + min)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 随机数,不包含上界
|
|
134
|
+
* @param {number} min 最小值
|
|
135
|
+
* @param {number} max 最大值
|
|
136
|
+
* @param {number} [precision=4] 小数位数
|
|
137
|
+
* @returns 随机数
|
|
138
|
+
*/
|
|
139
|
+
static randFloatBetween(min, max, precision = 4) {
|
|
140
|
+
return Math.floor((Math.random() * (max - min) + min) * (10 ** precision)) / (10 ** precision)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 随机打乱数组
|
|
145
|
+
* @template T
|
|
146
|
+
* @param {T[]} arr 原数组
|
|
147
|
+
* @returns {T[]} 返回传入类型的数组
|
|
148
|
+
*/
|
|
149
|
+
static randArray(arr) {
|
|
150
|
+
const newArr = [...arr];
|
|
151
|
+
return newArr.sort(() => Math.random() - 0.5);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 转换时间格式
|
|
156
|
+
* @param {Date|string|number} [date] 时间
|
|
157
|
+
* @param {string} [formater='YYYY/MM/DD hh:mm:ss'] 格式
|
|
158
|
+
* @returns 2020/10/08 10:08:08
|
|
159
|
+
*/
|
|
160
|
+
static formatDate(date, formater = 'YYYY/MM/DD hh:mm:ss') {
|
|
161
|
+
if (!date) {
|
|
162
|
+
date = new Date()
|
|
163
|
+
}
|
|
164
|
+
date = new Date(date)
|
|
165
|
+
|
|
166
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
|
167
|
+
const day = date.getDate().toString().padStart(2, '0')
|
|
168
|
+
const hours = date.getHours().toString().padStart(2, '0')
|
|
169
|
+
const minutes = date.getMinutes().toString().padStart(2, '0')
|
|
170
|
+
const seconds = date.getSeconds().toString().padStart(2, '0')
|
|
171
|
+
|
|
172
|
+
return formater.replace('YYYY', `${date.getFullYear()}`)
|
|
173
|
+
.replace('MM', month)
|
|
174
|
+
.replace('DD', day)
|
|
175
|
+
.replace('hh', hours)
|
|
176
|
+
.replace('mm', minutes)
|
|
177
|
+
.replace('ss', seconds)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 转换时间格式
|
|
182
|
+
* @param {Date|string|number} date 时间
|
|
183
|
+
* @returns {string} -100d
|
|
184
|
+
*/
|
|
185
|
+
static formatDateToNow(date) {
|
|
186
|
+
return `-${((new Date().getTime() - new Date(date).getTime()) / (24 * 60 * 60 * 1000)).toFixed(0)}d`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 转换unity富文本
|
|
191
|
+
* @param {string} richText
|
|
192
|
+
* @param {boolean} [onlyText=false] 是否只返回文本
|
|
193
|
+
* @returns
|
|
194
|
+
*/
|
|
195
|
+
static convertRichText(richText, onlyText = false) {
|
|
196
|
+
if (!richText) {
|
|
197
|
+
return richText
|
|
198
|
+
}
|
|
199
|
+
richText = richText.replace(/</g, '<').replace(/>/g, '>');
|
|
200
|
+
let reg = [
|
|
201
|
+
/<color\s*=\s*.*?>(.*?)<\/color>/,
|
|
202
|
+
/<size\s*=\s*.*?>(.*?)<\/size>/,
|
|
203
|
+
/<i>(.*?)<\/i>/, /<b>(.*?)<\/b>/
|
|
204
|
+
]
|
|
205
|
+
while (1) {
|
|
206
|
+
let matched = richText.match(reg[0])
|
|
207
|
+
if (matched?.[1]) {
|
|
208
|
+
let txt = matched[1]
|
|
209
|
+
let colorTag = matched[0].match(/<color\s*=\s*(.*?)>/)
|
|
210
|
+
let color = colorTag?.[1].replace(/[\s\"]/g, '') || 'inherit'
|
|
211
|
+
richText = richText.replace(reg[0], onlyText ? txt : `<span style="color:${color}">${txt}</span>`)
|
|
212
|
+
continue
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
matched = richText.match(reg[2])
|
|
216
|
+
if (matched) {
|
|
217
|
+
let txt = matched[1]
|
|
218
|
+
richText = richText.replace(reg[2], onlyText ? txt : `<i>${txt}</i>`)
|
|
219
|
+
continue
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
matched = richText.match(reg[3])
|
|
223
|
+
if (matched) {
|
|
224
|
+
let txt = matched[1]
|
|
225
|
+
richText = richText.replace(reg[3], onlyText ? txt : `<b>${txt}</b>`)
|
|
226
|
+
continue
|
|
227
|
+
}
|
|
228
|
+
// if (richText.match(reg[1])) {
|
|
229
|
+
// let txt = richText.match(reg[1])[1]
|
|
230
|
+
// let size = richText.match(reg[1])[0].match(/size\s*=[^>]*?([^>]*)/)[1]o
|
|
231
|
+
// return this.convertRichText(richText.replace(reg[1], `<span style="font-size:${size}px">${txt}</span>`))
|
|
232
|
+
// }
|
|
233
|
+
if (richText.match(/\n\r?/)) {
|
|
234
|
+
richText.replace(/\n\r?/g, '<br>')
|
|
235
|
+
}
|
|
236
|
+
break
|
|
237
|
+
}
|
|
238
|
+
// if (onlyText) {
|
|
239
|
+
// richText = richText.replace(/</g, '<').replace(/>/g, '>');
|
|
240
|
+
// }
|
|
241
|
+
return richText
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* 是否是管理员
|
|
246
|
+
* @param {any} e
|
|
247
|
+
*/
|
|
248
|
+
static is_admin(e) {
|
|
249
|
+
//console.info(e)
|
|
250
|
+
if (e?.member?.is_admin) {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
if (!e?.member?.permissions) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
switch (e?.member?.permissions[1]) {
|
|
257
|
+
/**频道主 */
|
|
258
|
+
case 4:
|
|
259
|
+
/**超管 */
|
|
260
|
+
case 2:
|
|
261
|
+
/**分组管理 */
|
|
262
|
+
case 7:
|
|
263
|
+
/**子频道管理 */
|
|
264
|
+
case 5:
|
|
265
|
+
return true;
|
|
266
|
+
default:
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 捕获消息中的范围
|
|
273
|
+
* @param {string} msg 消息字符串
|
|
274
|
+
* @param {number[]} range 范围数组
|
|
275
|
+
*/
|
|
276
|
+
static match_range(msg, range) {
|
|
277
|
+
if (!range) {
|
|
278
|
+
range = [0, MAX_DIFFICULTY]
|
|
279
|
+
}
|
|
280
|
+
if (msg.match(/[0-9]+(\.[0-9]+)?\s*[-~~]\s*[0-9]+(\.[0-9]+)?/g)) {
|
|
281
|
+
/**0-16.9 */
|
|
282
|
+
let matched = msg.match(/[0-9]+(\.[0-9]+)?\s*[-~~]\s*[0-9]+(\.[0-9]+)?/g)?.[0]
|
|
283
|
+
if (!matched) return range;
|
|
284
|
+
let result = matched.split(/\s*[-~~]\s*/g)
|
|
285
|
+
range[0] = Number(result[0])
|
|
286
|
+
range[1] = Number(result[1])
|
|
287
|
+
if (range[0] > range[1]) {
|
|
288
|
+
let tem = range[1]
|
|
289
|
+
range[1] = range[0]
|
|
290
|
+
range[0] = tem
|
|
291
|
+
}
|
|
292
|
+
if (range[1] % 1 == 0 && !result.includes(".0")) range[1] += 0.9
|
|
293
|
+
} else if (msg.match(/[0-9]+(\.[0-9]+)?\s*[-+]/g)) {
|
|
294
|
+
/**16.9- 15+ */
|
|
295
|
+
let matched = msg.match(/[0-9]+(\.[0-9]+)?\s*[-+]/g)?.[0]
|
|
296
|
+
if (!matched) return range;
|
|
297
|
+
let result = matched.replace(/\s*[-+]/g, '')
|
|
298
|
+
if (matched.includes('+')) {
|
|
299
|
+
range[0] = Number(result)
|
|
300
|
+
} else {
|
|
301
|
+
range[1] = Number(result)
|
|
302
|
+
if (range[1] % 1 == 0 && !result.includes(".0")) range[1] += 0.9
|
|
303
|
+
}
|
|
304
|
+
} else if (msg.match(/[0-9]+(\.[0-9]+)?/g)) {
|
|
305
|
+
/**15 */
|
|
306
|
+
let matched = msg.match(/[0-9]+(\.[0-9]+)?/g)?.[0]
|
|
307
|
+
if (!matched) return range;
|
|
308
|
+
range[0] = range[1] = Number(matched)
|
|
309
|
+
if (!matched.includes('.')) {
|
|
310
|
+
range[1] += 0.9
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* 匹配消息中对成绩的筛选
|
|
318
|
+
* @param {string} e_msg
|
|
319
|
+
* @param {number} [max_range] 最大范围
|
|
320
|
+
* @returns
|
|
321
|
+
*/
|
|
322
|
+
static match_request(e_msg, max_range) {
|
|
323
|
+
let range = [0, max_range || MAX_DIFFICULTY]
|
|
324
|
+
|
|
325
|
+
let msg = e_msg.replace(/^[#/](.*?)(lvsco(re)?)(\s*)/, "")
|
|
326
|
+
|
|
327
|
+
/**EZ HD IN AT */
|
|
328
|
+
let isask = [true, true, true, true]
|
|
329
|
+
|
|
330
|
+
msg = msg.toUpperCase()
|
|
331
|
+
|
|
332
|
+
if (msg.includes('EZ') || msg.includes('HD') || msg.includes('IN') || msg.includes('AT')) {
|
|
333
|
+
isask = [false, false, false, false]
|
|
334
|
+
if (msg.includes('EZ')) { isask[0] = true }
|
|
335
|
+
if (msg.includes('HD')) { isask[1] = true }
|
|
336
|
+
if (msg.includes('IN')) { isask[2] = true }
|
|
337
|
+
if (msg.includes('AT')) { isask[3] = true }
|
|
338
|
+
}
|
|
339
|
+
msg = msg.replace(/(list|AT|IN|HD|EZ)*/g, "")
|
|
340
|
+
|
|
341
|
+
let scoreAsk = { NEW: true, F: true, C: true, B: true, A: true, S: true, V: true, FC: true, PHI: true }
|
|
342
|
+
|
|
343
|
+
if (msg.includes(' NEW') || msg.includes(' F') || msg.includes(' C') || msg.includes(' B') || msg.includes(' A') || msg.includes(' S') || msg.includes(' V') || msg.includes(' FC') || msg.includes(' PHI')) {
|
|
344
|
+
scoreAsk = { NEW: false, F: false, C: false, B: false, A: false, S: false, V: false, FC: false, PHI: false }
|
|
345
|
+
/** @type {(keyof typeof scoreAsk)[]}*/
|
|
346
|
+
let rating = /** @type {any}*/(Object.keys(scoreAsk))
|
|
347
|
+
for (let rate of rating) {
|
|
348
|
+
if (msg.includes(` ${rate}`)) { scoreAsk[rate] = true }
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (msg.includes(` AP`)) { scoreAsk.PHI = true }
|
|
352
|
+
msg = msg.replace(/(NEW|F|C|B|A|S|V|FC|PHI|AP)*/g, "")
|
|
353
|
+
|
|
354
|
+
this.match_range(e_msg, range)
|
|
355
|
+
return { range, isask, scoreAsk }
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
*
|
|
360
|
+
* @param {number} real_score 真实成绩
|
|
361
|
+
* @param {boolean | number} fc 是否fc
|
|
362
|
+
* @param {number} [tot_score=1000000]
|
|
363
|
+
* @returns {ratingKind} 评级
|
|
364
|
+
*/
|
|
365
|
+
static rate(real_score, fc, tot_score = 1000000) {
|
|
366
|
+
if (real_score == tot_score) {
|
|
367
|
+
return 'phi'
|
|
368
|
+
} else if (fc) {
|
|
369
|
+
return 'FC'
|
|
370
|
+
} else if (real_score >= tot_score * 0.96) {
|
|
371
|
+
return 'V'
|
|
372
|
+
} else if (real_score >= tot_score * 0.92) {
|
|
373
|
+
return 'S'
|
|
374
|
+
} else if (real_score >= tot_score * 0.88) {
|
|
375
|
+
return 'A'
|
|
376
|
+
} else if (real_score >= tot_score * 0.82) {
|
|
377
|
+
return 'B'
|
|
378
|
+
} else if (real_score >= tot_score * 0.70) {
|
|
379
|
+
return 'C'
|
|
380
|
+
} else if (real_score > 0) {
|
|
381
|
+
return 'F'
|
|
382
|
+
} else {
|
|
383
|
+
return 'NEW';
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* 计算百分比
|
|
389
|
+
* @param {Number} value 值
|
|
390
|
+
* @param {number[]} range 区间数组 (0,..,1),只考虑首尾
|
|
391
|
+
* @returns 百分数,单位%
|
|
392
|
+
*/
|
|
393
|
+
static range(value, range) {
|
|
394
|
+
if (range[0] == range[range.length - 1]) {
|
|
395
|
+
return 50
|
|
396
|
+
} else {
|
|
397
|
+
return Math.abs((value - range[0]) / (range[range.length - 1] - range[0]) * 100)
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* 根据百分比和区间获取对应的值
|
|
403
|
+
* @param {number} percent
|
|
404
|
+
* @param {[number,number]} range
|
|
405
|
+
* @returns
|
|
406
|
+
*/
|
|
407
|
+
static getValueFromRange(percent, range) {
|
|
408
|
+
if (range[0] == range[1]) {
|
|
409
|
+
return range[0]
|
|
410
|
+
}
|
|
411
|
+
return Math.round((range[1] - range[0]) * percent / 100 + range[0])
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* 模糊搜索,返回相似度大于0.8的结果
|
|
416
|
+
* @param {string} str 搜索字符串
|
|
417
|
+
* @param {Object<string, string[]>} data 搜索数组
|
|
418
|
+
* @returns {Array<{ key:string, score:number, value:string }>} 相似度大于0.8的结果
|
|
419
|
+
*/
|
|
420
|
+
static fuzzySearch(str, data) {
|
|
421
|
+
/**
|
|
422
|
+
* @type {{ key:string, score:number, value:string }[]}
|
|
423
|
+
*/
|
|
424
|
+
let result = []
|
|
425
|
+
for (let key in data) {
|
|
426
|
+
let score = this.jaroWinklerDistance(str, key)
|
|
427
|
+
if (score > 0.8) {
|
|
428
|
+
data[key].forEach((value) => {
|
|
429
|
+
result.push({ key, score, value })
|
|
430
|
+
})
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return result.sort((a, b) => b.score - a.score)
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* 采用Jaro-Winkler编辑距离算法来计算str间的相似度,复杂度为O(n)=>n为较长的那个字符出的长度
|
|
438
|
+
* @param {string} s1
|
|
439
|
+
* @param {string} s2
|
|
440
|
+
* @returns {number} 相似度 0-1
|
|
441
|
+
*/
|
|
442
|
+
static jaroWinklerDistance(s1, s2) {
|
|
443
|
+
s1 = s1.trim();
|
|
444
|
+
s2 = s2.trim();
|
|
445
|
+
if (s1 == s2) {
|
|
446
|
+
return 1
|
|
447
|
+
}
|
|
448
|
+
//首先第一次去除空格和其他符号,并转换为小写
|
|
449
|
+
const pattern = /[\s~`!@#$%^&*()\-=_+\[\]「」『』{}|;:'",<.>/?!¥…()—【】、;‘’:“”,《。》?↑↓←→]/g
|
|
450
|
+
s1 = s1.replace(pattern, '').toLowerCase()
|
|
451
|
+
s2 = s2.replace(pattern, '').toLowerCase()
|
|
452
|
+
let m = 0 //匹配的字符数量
|
|
453
|
+
|
|
454
|
+
//如果任任一字符串为空则距离为0
|
|
455
|
+
if (s1.length === 0 || s2.length === 0) {
|
|
456
|
+
return 0
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
//字符串完全匹配,距离为1
|
|
460
|
+
if (s1 === s2) {
|
|
461
|
+
return 1
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
let range = (Math.floor(Math.max(s1.length, s2.length) / 2)) - 1, //搜索范围
|
|
465
|
+
s1Matches = new Array(s1.length),
|
|
466
|
+
s2Matches = new Array(s2.length)
|
|
467
|
+
|
|
468
|
+
//查找匹配的字符
|
|
469
|
+
for (let i = 0; i < s1.length; i++) {
|
|
470
|
+
let low = (i >= range) ? i - range : 0,
|
|
471
|
+
high = (i + range <= (s2.length - 1)) ? (i + range) : (s2.length - 1)
|
|
472
|
+
|
|
473
|
+
for (let j = low; j <= high; j++) {
|
|
474
|
+
if (s1Matches[i] !== true && s2Matches[j] !== true && s1[i] === s2[j]) {
|
|
475
|
+
++m
|
|
476
|
+
s1Matches[i] = s2Matches[j] = true
|
|
477
|
+
break
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
//如果没有匹配的字符,那么捏Jaro距离为0
|
|
483
|
+
if (m === 0) {
|
|
484
|
+
return 0
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
//计算转置的数量
|
|
488
|
+
let k = 0, n_trans = 0
|
|
489
|
+
for (let i = 0; i < s1.length; i++) {
|
|
490
|
+
if (s1Matches[i] === true) {
|
|
491
|
+
let j
|
|
492
|
+
for (j = k; j < s2.length; j++) {
|
|
493
|
+
if (s2Matches[j] === true) {
|
|
494
|
+
k = j + 1
|
|
495
|
+
break
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (s1[i] !== s2[j]) {
|
|
500
|
+
++n_trans
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
//计算Jaro距离
|
|
506
|
+
let weight = (m / s1.length + m / s2.length + (m - (n_trans / 2)) / m) / 3,
|
|
507
|
+
l = 0,
|
|
508
|
+
p = 0.1
|
|
509
|
+
|
|
510
|
+
//如果Jaro距离大于0.7,计算Jaro-Winkler距离
|
|
511
|
+
if (weight > 0.7) {
|
|
512
|
+
while (s1[l] === s2[l] && l < 4) {
|
|
513
|
+
++l
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
weight = weight + l * p * (1 - weight)
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return weight
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* 获取BOT平台名称
|
|
524
|
+
* @param {any} e
|
|
525
|
+
* @returns
|
|
526
|
+
*/
|
|
527
|
+
static getAdapterName(e) {
|
|
528
|
+
return platform.getAdapterName(e)
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* 多别名的返回消息
|
|
533
|
+
* @param {idString[]} idArr
|
|
534
|
+
*/
|
|
535
|
+
static mutiNick(idArr) {
|
|
536
|
+
/**
|
|
537
|
+
* 筛选出重复的别名
|
|
538
|
+
* @type {Record<string, number>}
|
|
539
|
+
*/
|
|
540
|
+
const nickCnt = {};
|
|
541
|
+
idArr.forEach((id) => {
|
|
542
|
+
(getInfo?.nicklist?.[id] || []).forEach((nick) => {
|
|
543
|
+
if (!nickCnt[nick]) {
|
|
544
|
+
nickCnt[nick] = 1;
|
|
545
|
+
} else {
|
|
546
|
+
nickCnt[nick]++;
|
|
547
|
+
}
|
|
548
|
+
})
|
|
549
|
+
})
|
|
550
|
+
/**
|
|
551
|
+
* @type {string[]}
|
|
552
|
+
*/
|
|
553
|
+
const nickList = []
|
|
554
|
+
for (let nick in nickCnt) {
|
|
555
|
+
if (nickCnt[nick] > 1) {
|
|
556
|
+
nickList.push(nick);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
/**生成消息 */
|
|
560
|
+
let msg = '你要找的是不是:\n';
|
|
561
|
+
idArr.forEach((id, index) => {
|
|
562
|
+
let info = getInfo.info(id);
|
|
563
|
+
if (info) {
|
|
564
|
+
msg += `${index + 1}. ${info.song}\n-作者:${info.composer}\n`;
|
|
565
|
+
if (getInfo.nicklist?.[id]) {
|
|
566
|
+
for (let nick of getInfo.nicklist[id]) {
|
|
567
|
+
if (!nickList.includes(nick)) {
|
|
568
|
+
msg += `-其他别名:${nick}\n`;
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
} else {
|
|
573
|
+
msg += `-其他别名:${info.id.replace('.', ' . ')}\n`;
|
|
574
|
+
}
|
|
575
|
+
} else {
|
|
576
|
+
msg += `${index + 1}. ${id}\n暂无信息\n`;
|
|
577
|
+
}
|
|
578
|
+
})
|
|
579
|
+
msg += `请在${Config.getUserCfg('config', 'mutiNickWaitTimeOut')}秒内回复序号`;
|
|
580
|
+
return msg
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* 判断是不是1GOOD
|
|
585
|
+
* @param {number} score
|
|
586
|
+
* @param {number} maxc 总物量
|
|
587
|
+
* @returns
|
|
588
|
+
*/
|
|
589
|
+
static comJust1Good(score, maxc) {
|
|
590
|
+
const tar = 900000 * (1 - (0.35 / maxc)) + 100000;
|
|
591
|
+
return Math.abs(score - tar) <= 2;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* 从Record中获取key数组
|
|
596
|
+
* @template {Record<PropertyKey, unknown>} T
|
|
597
|
+
* @param {T} record
|
|
598
|
+
* @returns {(keyof T)[]} key数组
|
|
599
|
+
*/
|
|
600
|
+
static objectKeys(record) {
|
|
601
|
+
return /**@type {(keyof T)[]} */(Object.keys(record));
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
*
|
|
606
|
+
* @param {{phi: LevelRecordInfo[], b27: LevelRecordInfo[]}} b30List
|
|
607
|
+
* @param {LevelRecordInfo[]} newRecords
|
|
608
|
+
*/
|
|
609
|
+
static updateB30(b30List, newRecords) {
|
|
610
|
+
let phi = [...b30List.phi];
|
|
611
|
+
let b27 = [...b30List.b27];
|
|
612
|
+
newRecords = newRecords.sort((a, b) => b.rks - a.rks);
|
|
613
|
+
const newPhis = newRecords.filter(record => record.acc >= 100);
|
|
614
|
+
|
|
615
|
+
const newPhiKeys = newPhis.map(item => `${item.id}-${item.difficulty}`);
|
|
616
|
+
const newRecordKeys = newRecords.map(item => `${item.id}-${item.difficulty}`);
|
|
617
|
+
|
|
618
|
+
phi = phi.filter(item => !newPhiKeys.includes(`${item.id}-${item.difficulty}`));
|
|
619
|
+
b27 = b27.filter(item => !newRecordKeys.includes(`${item.id}-${item.difficulty}`));
|
|
620
|
+
|
|
621
|
+
phi.push(...newPhis);
|
|
622
|
+
phi = phi.sort((a, b) => b.rks - a.rks);
|
|
623
|
+
phi = phi.slice(0, 3);
|
|
624
|
+
b27.push(...newRecords);
|
|
625
|
+
b27 = b27.sort((a, b) => b.rks - a.rks);
|
|
626
|
+
b27 = b27.slice(0, 27);
|
|
627
|
+
return { phi, b27 };
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* 定义一个函数,接受一个整数参数,返回它的十六进制形式
|
|
632
|
+
* @param {number} num
|
|
633
|
+
* @returns
|
|
634
|
+
*/
|
|
635
|
+
static toHex(num) {
|
|
636
|
+
// 如果数字小于 16,就在前面补一个 0
|
|
637
|
+
if (num < 16) {
|
|
638
|
+
return "0" + num.toString(16);
|
|
639
|
+
} else {
|
|
640
|
+
return num.toString(16);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// 定义一个函数,不接受参数,返回一个随机的背景色
|
|
645
|
+
static getRandomBgColor() {
|
|
646
|
+
// 生成三个 0 到 200 之间的随机整数,分别代表红、绿、蓝分量
|
|
647
|
+
let red = Math.floor(Math.random() * 201);
|
|
648
|
+
let green = Math.floor(Math.random() * 201);
|
|
649
|
+
let blue = Math.floor(Math.random() * 201);
|
|
650
|
+
// 将三个分量转换为十六进制形式,然后拼接成一个 RGB 颜色代码
|
|
651
|
+
let hexColor = "#" + this.toHex(red) + this.toHex(green) + this.toHex(blue);
|
|
652
|
+
// 返回生成的颜色代码
|
|
653
|
+
return hexColor;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* 将 rgba 字符串转换为难度条渐变 CSS 值,与 atlas.css 中常规难度渐变模式一致
|
|
658
|
+
* @param {string} [rgba] - 逗号分隔的 R,G,B,A 字符串,如 "183,0,253,1"
|
|
659
|
+
* @returns {string|undefined} linear-gradient CSS 值,rgba 无效时返回 undefined
|
|
660
|
+
*/
|
|
661
|
+
static rgbaToGradient(rgba) {
|
|
662
|
+
if (!rgba) return undefined;
|
|
663
|
+
const parts = rgba.split(',');
|
|
664
|
+
if (parts.length < 3) return undefined;
|
|
665
|
+
const r = parts[0].trim();
|
|
666
|
+
const g = parts[1].trim();
|
|
667
|
+
const b = parts[2].trim();
|
|
668
|
+
return `linear-gradient(90deg, rgb(${r},${g},${b}) 95px, transparent 95px, rgba(${r},${g},${b},0.53) 105px, rgba(${r},${g},${b},0.53) 50%, transparent 100%)`;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
*
|
|
673
|
+
* @param {ratingKind} a
|
|
674
|
+
* @param {ratingKind} b
|
|
675
|
+
* @returns
|
|
676
|
+
*/
|
|
677
|
+
static cmpRat(a, b) {
|
|
678
|
+
/**@type {ratingKind[]} */
|
|
679
|
+
const rankOrder = ['NEW', 'F', 'C', 'B', 'A', 'S', 'V', 'FC', 'phi']
|
|
680
|
+
return rankOrder.indexOf(a) - rankOrder.indexOf(b);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* 从数组中随机选择一个元素,数组元素为[值,权重],权重越大被选中的概率越大
|
|
685
|
+
* @template T
|
|
686
|
+
* @param {[T,number][]} arr
|
|
687
|
+
* @return {T} 选中的元素
|
|
688
|
+
*/
|
|
689
|
+
static randFromArray(arr) {
|
|
690
|
+
let sum = arr.reduce((acc, cur) => acc + cur[1], 0);
|
|
691
|
+
let rand = Math.random() * sum;
|
|
692
|
+
for (let i = 0; i < arr.length; i++) {
|
|
693
|
+
if (rand < arr[i][1]) {
|
|
694
|
+
return arr[i][0];
|
|
695
|
+
}
|
|
696
|
+
rand -= arr[i][1];
|
|
697
|
+
}
|
|
698
|
+
// 如果没有找到,返回最后一个元素
|
|
699
|
+
return arr[arr.length - 1][0];
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
*
|
|
704
|
+
* @param {string} content
|
|
705
|
+
*/
|
|
706
|
+
static getRexWithCmdHead(content) {
|
|
707
|
+
let rex = new RegExp(`^[#/]\\s*${Config.getUserCfg('config', 'cmdhead')}\\s*(${content})\\s*`, 'i')
|
|
708
|
+
return rex;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
}
|