@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,1064 @@
|
|
|
1
|
+
import common from '../components/common.js'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import Config from '../components/Config.js'
|
|
4
|
+
import send from '../model/render/send.js'
|
|
5
|
+
import getNotes from '../model/user/getNotes.js'
|
|
6
|
+
import getBanGroup from '../model/user/getBanGroup.js';
|
|
7
|
+
import getInfo from '../model/game/getInfo.js'
|
|
8
|
+
import readFile from '../model/filesystem/getFile.js'
|
|
9
|
+
import { infoPath } from '../model/filesystem/path.js'
|
|
10
|
+
import phiPluginBase from '../components/baseClass.js'
|
|
11
|
+
import fCompute from '../model/game/fCompute.js'
|
|
12
|
+
import picmodle from '../model/render/picmodle.js'
|
|
13
|
+
import Save from '../model/save/Save.js'
|
|
14
|
+
import { Level, LevelNum, redisPath } from '../model/game/constNum.js'
|
|
15
|
+
import PluginData, { themeList } from '../model/user/pluginData.js'
|
|
16
|
+
import themeManager from '../model/theme/manager.js'
|
|
17
|
+
import makeRequest from '../model/api/makeRequest.js'
|
|
18
|
+
import logger from '../components/Logger.js'
|
|
19
|
+
import { canUseApi } from '../model/user/apiPermission.js'
|
|
20
|
+
import platform, { redis } from '../components/platform/index.js'
|
|
21
|
+
import themeUseService, { marketThemeErrorMessage } from '../model/theme/useService.js'
|
|
22
|
+
import { getThemeInstallRequesterId } from '../model/theme/installGuard.js'
|
|
23
|
+
|
|
24
|
+
/**@import {botEvent} from '../components/baseClass.js' */
|
|
25
|
+
|
|
26
|
+
const illlist = getInfo.illlist
|
|
27
|
+
/** 主题列表(内置 + 自定义,实时获取以支持热更新) */
|
|
28
|
+
const getThemeList = () => themeManager.getThemeList()
|
|
29
|
+
|
|
30
|
+
const commonSP = {
|
|
31
|
+
note_num: [750],
|
|
32
|
+
tips: ["高考加油喵,祝26届考生金榜题名w!"],
|
|
33
|
+
jrrp: {
|
|
34
|
+
/**@type {[number, number]} */
|
|
35
|
+
lucky: [100, 100],
|
|
36
|
+
good: undefined,
|
|
37
|
+
bad: undefined,
|
|
38
|
+
common: undefined,
|
|
39
|
+
sentence: [{
|
|
40
|
+
hitokoto: "愿你合上笔盖的那一刻,有侠客收剑入鞘的从容,无论江湖多远,此刻已是英雄。",
|
|
41
|
+
from: "phi-plugin全体维护成员"
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const spData = [{
|
|
47
|
+
month: '06',
|
|
48
|
+
date: '06',
|
|
49
|
+
...commonSP,
|
|
50
|
+
}, {
|
|
51
|
+
month: '06',
|
|
52
|
+
date: '07',
|
|
53
|
+
...commonSP,
|
|
54
|
+
}, {
|
|
55
|
+
month: '06',
|
|
56
|
+
date: '08',
|
|
57
|
+
...commonSP,
|
|
58
|
+
}, {
|
|
59
|
+
month: '06',
|
|
60
|
+
date: '09',
|
|
61
|
+
...commonSP,
|
|
62
|
+
}, {
|
|
63
|
+
month: '06',
|
|
64
|
+
date: '10',
|
|
65
|
+
...commonSP,
|
|
66
|
+
}]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 一言
|
|
71
|
+
* @type {Record<"hitokoto" | "from", string>[]}
|
|
72
|
+
*/
|
|
73
|
+
let sentence = await readFile.FileReader(path.join(infoPath, 'sentences.json'))
|
|
74
|
+
|
|
75
|
+
export class phimoney extends phiPluginBase {
|
|
76
|
+
constructor() {
|
|
77
|
+
super({
|
|
78
|
+
name: 'phi-money',
|
|
79
|
+
dsc: 'phi-plugin货币系统',
|
|
80
|
+
event: 'message',
|
|
81
|
+
priority: 1000,
|
|
82
|
+
rule: [
|
|
83
|
+
{
|
|
84
|
+
reg: `^[#/]?(${Config.getUserCfg('config', 'cmdhead')})(\\s*)(sign|sign in|签到|打卡)$`,
|
|
85
|
+
fnc: 'sign'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
reg: `^[#/]?(${Config.getUserCfg('config', 'cmdhead')})(\\s*)(task|我的任务)$`,
|
|
89
|
+
fnc: 'tasks'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
reg: `^[#/]?(${Config.getUserCfg('config', 'cmdhead')})(\\s*)(retask|刷新任务)$`,
|
|
93
|
+
fnc: 'retask'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
reg: `^[#/](${Config.getUserCfg('config', 'cmdhead')})(\\s*)(send|送|转)(.*)$`,
|
|
97
|
+
fnc: 'send'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
reg: `^[#/]?(${Config.getUserCfg('config', 'cmdhead')})(\\s*)(theme)(\\s*)[0-9]+$`,
|
|
101
|
+
fnc: 'theme'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
reg: `^[#/](${Config.getUserCfg('config', 'cmdhead')})(\\s*)(jrrp|今日人品)$`,
|
|
105
|
+
fnc: 'jrrp'
|
|
106
|
+
},
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 签到
|
|
114
|
+
* @param {botEvent} e
|
|
115
|
+
*/
|
|
116
|
+
async sign(e) {
|
|
117
|
+
|
|
118
|
+
if (await getBanGroup.get(e, 'sign')) {
|
|
119
|
+
send.send_with_At(e, '这里被管理员禁止使用这个功能了呐QAQ!')
|
|
120
|
+
return false
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let data = await getNotes.getNotesData(e.user_id)
|
|
124
|
+
let last_sign = new Date(data.sign_in)
|
|
125
|
+
let now_time = new Date()
|
|
126
|
+
let request_time = getDayZeroTimestamp(now_time) //每天0点
|
|
127
|
+
let todayKey = formatDateKey(now_time)
|
|
128
|
+
|
|
129
|
+
// 特殊日期处理
|
|
130
|
+
let spDateIndex = checkSpDateIndex(now_time);
|
|
131
|
+
|
|
132
|
+
let signedJustNow = false
|
|
133
|
+
let getnum = 0
|
|
134
|
+
|
|
135
|
+
if (request_time > last_sign) {
|
|
136
|
+
signedJustNow = true
|
|
137
|
+
getnum = randint(20, 5)
|
|
138
|
+
if (spDateIndex !== -1) {
|
|
139
|
+
getnum = spData[spDateIndex].note_num[randint(spData[spDateIndex].note_num.length - 1)]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
data.money += getnum
|
|
143
|
+
data.sign_in = now_time.toISOString();
|
|
144
|
+
|
|
145
|
+
if (!Array.isArray(data.sign_history)) data.sign_history = []
|
|
146
|
+
if (!data.sign_history.includes(todayKey)) data.sign_history.push(todayKey)
|
|
147
|
+
|
|
148
|
+
getNotes.putNotesData(e.user_id, data)
|
|
149
|
+
} else {
|
|
150
|
+
// 兼容旧数据:已签但历史缺失时补一条,保证日历正确
|
|
151
|
+
if (!Array.isArray(data.sign_history)) data.sign_history = []
|
|
152
|
+
if (!data.sign_history.includes(todayKey)) {
|
|
153
|
+
data.sign_history.push(todayKey)
|
|
154
|
+
getNotes.putNotesData(e.user_id, data)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** 尝试拿存档(无存档也照样渲染) */
|
|
159
|
+
let save = await send.getsave_result(e, undefined, false)
|
|
160
|
+
|
|
161
|
+
/** 今日任务:有存档且今日未刷新时,静默刷新一次并写回 */
|
|
162
|
+
if (save) {
|
|
163
|
+
let last_task = new Date(data.task_time)
|
|
164
|
+
if (last_task < request_time) {
|
|
165
|
+
data.task_time = now_time.toISOString()
|
|
166
|
+
data.task = await randtask(e, save, [])
|
|
167
|
+
getNotes.putNotesData(e.user_id, data)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
const img = await picmodle.common(e, 'sign', await picData(save, data, e));
|
|
173
|
+
if (signedJustNow) {
|
|
174
|
+
const tips = spDateIndex !== -1
|
|
175
|
+
? spData[spDateIndex].tips[randint(spData[spDateIndex].tips.length - 1)]
|
|
176
|
+
: `签到成功!${helloMsg(now_time, 0)}`
|
|
177
|
+
send.send_with_At(e, [img, `${tips}\n恭喜您获得了${getnum}个Note!当前 Note:${data.money}`])
|
|
178
|
+
} else {
|
|
179
|
+
send.send_with_At(e, [img, `你在今天${fCompute.formatDate(last_sign, 'hh:mm:ss')}的时候已经签过到了哦!\n你现在的Note数量: ${data.money}`])
|
|
180
|
+
}
|
|
181
|
+
return true
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* 刷新任务并发送图片
|
|
186
|
+
* @param {botEvent} e
|
|
187
|
+
*/
|
|
188
|
+
async retask(e) {
|
|
189
|
+
|
|
190
|
+
if (await getBanGroup.get(e, 'retask')) {
|
|
191
|
+
send.send_with_At(e, '这里被管理员禁止使用这个功能了呐QAQ!')
|
|
192
|
+
return false
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let save = await send.getsave_result(e)
|
|
196
|
+
|
|
197
|
+
if (!save) {
|
|
198
|
+
return false
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
let data = await getNotes.getNotesData(e.user_id)
|
|
202
|
+
let last_task = new Date(data.task_time)
|
|
203
|
+
let now_time = new Date()
|
|
204
|
+
let request_time = getDayZeroTimestamp(now_time) //每天0点
|
|
205
|
+
/**@type {import('../model/user/pluginData.js').taskObj[]} */
|
|
206
|
+
let oldtask = []
|
|
207
|
+
|
|
208
|
+
/**note变化 */
|
|
209
|
+
let change_note = 0
|
|
210
|
+
|
|
211
|
+
if (request_time > last_task) {
|
|
212
|
+
/**每天一次免费刷新任务 */
|
|
213
|
+
} else {
|
|
214
|
+
/**花费20Notes刷新 */
|
|
215
|
+
if (data.money >= 20) {
|
|
216
|
+
data.money -= 20
|
|
217
|
+
change_note -= 20
|
|
218
|
+
oldtask = data.task
|
|
219
|
+
} else {
|
|
220
|
+
send.send_with_At(e, `刷新任务需要 20 Notes,咱没有那么多Note哇QAQ!\n你当前的 Note 数目为:${data.money}`)
|
|
221
|
+
return false
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
data.task_time = now_time.toISOString();
|
|
226
|
+
data.task = await randtask(e, save, oldtask)
|
|
227
|
+
|
|
228
|
+
let vis = false
|
|
229
|
+
for (let i in data.task) {
|
|
230
|
+
if (data.task) {
|
|
231
|
+
vis = true
|
|
232
|
+
break
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!vis) {
|
|
237
|
+
send.send_with_At(e, `哇塞,您已经把所有曲目全部满分了呢!没有办法为您布置任务了呢!敬请期待其他玩法哦!`)
|
|
238
|
+
return true
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
getNotes.putNotesData(e.user_id, data)
|
|
242
|
+
|
|
243
|
+
const img = await picmodle.common(e, 'sign', await picData(save, data, e));
|
|
244
|
+
send.send_with_At(e, img);
|
|
245
|
+
|
|
246
|
+
return true
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
*
|
|
253
|
+
* @param {botEvent} e
|
|
254
|
+
* @returns
|
|
255
|
+
*/
|
|
256
|
+
async tasks(e) {
|
|
257
|
+
|
|
258
|
+
if (await getBanGroup.get(e, 'tasks')) {
|
|
259
|
+
send.send_with_At(e, '这里被管理员禁止使用这个功能了呐QAQ!')
|
|
260
|
+
return false
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
let save = await send.getsave_result(e)
|
|
264
|
+
|
|
265
|
+
if (!save) {
|
|
266
|
+
return false
|
|
267
|
+
}
|
|
268
|
+
let now_time = new Date()
|
|
269
|
+
/**判断时间段 */
|
|
270
|
+
const Remsg = helloMsg(now_time, 1)
|
|
271
|
+
|
|
272
|
+
let data = await getNotes.getNotesData(e.user_id)
|
|
273
|
+
|
|
274
|
+
const img = await picmodle.common(e, 'sign', await picData(save, data, e));
|
|
275
|
+
|
|
276
|
+
send.send_with_At(e, img)
|
|
277
|
+
|
|
278
|
+
return true
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* 转账
|
|
283
|
+
* @param {botEvent} e
|
|
284
|
+
*/
|
|
285
|
+
async send(e) {
|
|
286
|
+
|
|
287
|
+
if (await getBanGroup.get(e, 'send')) {
|
|
288
|
+
send.send_with_At(e, '这里被管理员禁止使用这个功能了呐QAQ!')
|
|
289
|
+
return false
|
|
290
|
+
}
|
|
291
|
+
const tmp = `\n格式:/${Config.getUserCfg('config', 'cmdhead')} send <@ or id> <数量>`;
|
|
292
|
+
let msg = e.msg.replace(/[#/](.*?)(send|送|转)(\s*)/g, "")
|
|
293
|
+
msg = msg.replace(/[\<\>]/g, "")
|
|
294
|
+
let target = e.at
|
|
295
|
+
let num
|
|
296
|
+
if (!e.at) {
|
|
297
|
+
if (msg.includes(' ')) {
|
|
298
|
+
const parts = msg.split(' ')
|
|
299
|
+
target = parts[0]
|
|
300
|
+
num = Number(parts[1])
|
|
301
|
+
} else {
|
|
302
|
+
send.send_with_At(e, `格式错误!请指定目标${tmp}`, true)
|
|
303
|
+
return true
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
num = Number(msg)
|
|
307
|
+
}
|
|
308
|
+
if (isNaN(num)) {
|
|
309
|
+
send.send_with_At(e, `非法数字:${msg}${tmp}`, true)
|
|
310
|
+
return true
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (!target) {
|
|
314
|
+
send.send_with_At(e, `格式错误!请指定目标${tmp}`, true);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
const tar = await platform.pickMember(e, target);
|
|
319
|
+
if (!tar) throw new Error("not found");
|
|
320
|
+
} catch (err) {
|
|
321
|
+
send.send_with_At(e, `这个QQ号……好像没有见过呢……`);
|
|
322
|
+
return true
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
let target_data = await getNotes.getNotesData(target)
|
|
327
|
+
|
|
328
|
+
let sender_data = await getNotes.getNotesData(e.user_id)
|
|
329
|
+
|
|
330
|
+
if (target == e.user_id) {
|
|
331
|
+
await send.send_with_At(e, `转账成……欸?这个目标……在拿我寻开心嘛!`)
|
|
332
|
+
await common.sleep(1000)
|
|
333
|
+
await send.send_with_At(e, `转账失败!扣除 20 Notes!`)
|
|
334
|
+
if (sender_data.money < 20) {
|
|
335
|
+
await send.send_with_At(e, `a,你怎么连20 Note都没有哇`)
|
|
336
|
+
await send.send_with_At(e, `www,算了,我今天心情好,不和你计较了,哼!`)
|
|
337
|
+
} else {
|
|
338
|
+
sender_data.money -= 20
|
|
339
|
+
}
|
|
340
|
+
getNotes.putNotesData(e.user_id, sender_data)
|
|
341
|
+
return true
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
if (sender_data.money < num) {
|
|
346
|
+
send.send_with_At(e, `你当前的Note数量不够哦!\n当前Note: ${sender_data.money}`)
|
|
347
|
+
return true
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (!isFinite(num) || num < 0) {
|
|
351
|
+
send.send_with_At(e, "你看看你输入的是正常数字嘛!");
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
target_data.money += Math.ceil(num * 0.8)
|
|
356
|
+
|
|
357
|
+
let sender_old = sender_data.money
|
|
358
|
+
let target_old = target_data.money
|
|
359
|
+
|
|
360
|
+
sender_data.money -= num
|
|
361
|
+
getNotes.putNotesData(e.user_id, sender_data)
|
|
362
|
+
|
|
363
|
+
getNotes.putNotesData(target, target_data)
|
|
364
|
+
let target_card = await platform.pickMember(e, target)
|
|
365
|
+
const targetName = target_card?.nickname || target_card?.card || target
|
|
366
|
+
send.send_with_At(e, `转账成功!\n你当前的Note: ${sender_old} - ${num} = ${sender_data.money}\n${targetName}的Note: ${target_old} + ${Math.ceil(num * 0.8)} = ${target_data.money}`)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* 主题相关
|
|
371
|
+
* @param {botEvent} e
|
|
372
|
+
*/
|
|
373
|
+
async theme(e) {
|
|
374
|
+
|
|
375
|
+
if (await getBanGroup.get(e, 'theme')) {
|
|
376
|
+
send.send_with_At(e, '这里被管理员禁止使用这个功能了呐QAQ!')
|
|
377
|
+
return false
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const themeList = getThemeList()
|
|
381
|
+
let msg = e.msg.replace(/.*?theme\s*/g, '')
|
|
382
|
+
let aim = Number(msg)
|
|
383
|
+
if (!Number.isInteger(aim) || aim < 0 || aim > themeList.length - 1) {
|
|
384
|
+
send.send_with_At(e, `请输入主题数字嗷!\n格式/${Config.getUserCfg('config', 'cmdhead')} theme 0-${themeList.length - 1}`)
|
|
385
|
+
return false
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const selectedTheme = themeList[aim]
|
|
389
|
+
if (themeManager.getTheme(selectedTheme.id)?.marketInstalled) {
|
|
390
|
+
send.send_with_At(e, `正在校验并准备主题 ${selectedTheme.id},请稍候。`)
|
|
391
|
+
try {
|
|
392
|
+
await themeUseService.use(selectedTheme.id, { requesterId: getThemeInstallRequesterId(e) })
|
|
393
|
+
} catch (error) {
|
|
394
|
+
send.send_with_At(e, marketThemeErrorMessage(error))
|
|
395
|
+
return true
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// 主题准备期间用户数据可能已被其他命令更新,保存前重新读取。
|
|
400
|
+
const plugin_data = await getNotes.getNotesData(e.user_id)
|
|
401
|
+
if (typeof plugin_data.setThemePreference === 'function') {
|
|
402
|
+
plugin_data.setThemePreference(selectedTheme.id)
|
|
403
|
+
} else {
|
|
404
|
+
// @ts-ignore
|
|
405
|
+
plugin_data.theme = selectedTheme.id
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (!getNotes.putNotesData(e.user_id, plugin_data)) {
|
|
409
|
+
send.send_with_At(e, '主题已准备完成,但你的主题设置保存失败,请稍后重试。')
|
|
410
|
+
return true
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
send.send_with_At(e, `设置成功!\n你当前的主题是:${selectedTheme.src}`)
|
|
414
|
+
return true
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* 今日人品
|
|
420
|
+
* @param {botEvent} e
|
|
421
|
+
* @returns
|
|
422
|
+
*/
|
|
423
|
+
async jrrp(e) {
|
|
424
|
+
|
|
425
|
+
if (await getBanGroup.get(e, 'jrrp')) {
|
|
426
|
+
send.send_with_At(e, '这里被管理员禁止使用这个功能了呐QAQ!')
|
|
427
|
+
return false
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
let jrrp = (await createJrrp(e)).oriData;
|
|
431
|
+
let data = {
|
|
432
|
+
bkg: getInfo.getill(/**@type {any} */("ShineAfter.ADeanJocularACE.0")),
|
|
433
|
+
lucky: jrrp[0],
|
|
434
|
+
luckRank: jrrp[0] == 100 ? 5 : (jrrp[0] >= 80 ? 4 : (jrrp[0] >= 60 ? 3 : (jrrp[0] >= 40 ? 2 : (jrrp[0] >= 20 ? 1 : 0)))),
|
|
435
|
+
year: new Date().getFullYear(),
|
|
436
|
+
month: fCompute.ped(new Date().getMonth() + 1, 2),
|
|
437
|
+
day: fCompute.ped(new Date().getDate(), 2),
|
|
438
|
+
sentence: Number(jrrp[1]) ? sentence[jrrp[1]] : jrrp[1],
|
|
439
|
+
good: jrrp.slice(2, 6),
|
|
440
|
+
bad: jrrp.slice(6, 10),
|
|
441
|
+
}
|
|
442
|
+
send.send_with_At(e, await picmodle.common(e, 'jrrp', data))
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
*
|
|
449
|
+
* @param {botEvent} e
|
|
450
|
+
* @param {Save} save
|
|
451
|
+
* @param {import('../model/user/pluginData.js').taskObj[]} task
|
|
452
|
+
* @returns
|
|
453
|
+
*/
|
|
454
|
+
async function randtask(e, save, task = []) {
|
|
455
|
+
let rks = save.saveInfo.summary.rankingScore
|
|
456
|
+
let gameRecord = save.gameRecord
|
|
457
|
+
for (let id of fCompute.objectKeys(gameRecord)) {
|
|
458
|
+
gameRecord[id] = gameRecord[id]
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
let info = getInfo.ori_info
|
|
462
|
+
|
|
463
|
+
const { com_rks } = await save.getB19(e, 1000, { avgType: "none" });
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* @typedef {{ id: idString; level: levelKind; type: string; value: number; diff: number; oldAcc: number; }} taskObj
|
|
467
|
+
* @type {taskObj[]}
|
|
468
|
+
*/
|
|
469
|
+
let allTaskList = [];
|
|
470
|
+
|
|
471
|
+
if (await canUseApi(e, 'scoreStatistics')) {
|
|
472
|
+
|
|
473
|
+
const res = await makeRequest.getAllSongAccAvgB30({
|
|
474
|
+
songIds: getInfo.idList,
|
|
475
|
+
minRks: Math.floor((com_rks - 0.05) / 0.05) * 0.05,
|
|
476
|
+
maxRks: Math.floor((com_rks + 0.05) / 0.05) * 0.05
|
|
477
|
+
}, { event: e })
|
|
478
|
+
if (res) {
|
|
479
|
+
const ids = fCompute.objectKeys(res)
|
|
480
|
+
ids.forEach(id => {
|
|
481
|
+
if (!getInfo.ori_info[id]) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
Level.forEach(lv => {
|
|
485
|
+
if (!getInfo.ori_info[id]?.chart?.[lv]) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const avg = res[id][lv].accAvg || 0;
|
|
489
|
+
if (avg > (save.gameRecord?.[id]?.[LevelNum[lv]]?.acc || 0)) {
|
|
490
|
+
allTaskList.push({
|
|
491
|
+
id,
|
|
492
|
+
level: lv,
|
|
493
|
+
type: 'acc',
|
|
494
|
+
value: avg,
|
|
495
|
+
diff: getInfo.ori_info[id].chart[lv].difficulty,
|
|
496
|
+
oldAcc: save.gameRecord?.[id]?.[LevelNum[lv]]?.acc || 0
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
})
|
|
500
|
+
})
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
allTaskList.sort((a, b) => b.value - a.value)
|
|
505
|
+
/** @type {taskObj[]} */
|
|
506
|
+
let cmdTask = [];
|
|
507
|
+
/** @type {taskObj[]} */
|
|
508
|
+
let phiTask = [];
|
|
509
|
+
for (let i = 0, j = 0; i < allTaskList.length; i++) {
|
|
510
|
+
if (allTaskList[i].value >= 100) {
|
|
511
|
+
j = i;
|
|
512
|
+
}
|
|
513
|
+
if (allTaskList[i].value < 95) {
|
|
514
|
+
phiTask = allTaskList.slice(0, j + 1);
|
|
515
|
+
cmdTask = allTaskList.slice(j + 1, i);
|
|
516
|
+
allTaskList = allTaskList.slice(i);
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
if (i == allTaskList.length - 1) {
|
|
520
|
+
phiTask = allTaskList.slice(0, j + 1);
|
|
521
|
+
cmdTask = allTaskList.slice(j + 1, i);
|
|
522
|
+
allTaskList = allTaskList.slice(i);
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
/**@type {{song: idString, level: levelKind}[][]} */
|
|
529
|
+
let ranked_songs = [[], [], [], [], []] //任务难度分级后的曲目列表
|
|
530
|
+
|
|
531
|
+
if (allTaskList.length < 5) {
|
|
532
|
+
const rank_line = [];
|
|
533
|
+
if (rks < 15) {
|
|
534
|
+
rank_line.push(rks - 1)
|
|
535
|
+
rank_line.push(rks - 0.5)
|
|
536
|
+
rank_line.push(rks + 0)
|
|
537
|
+
rank_line.push(rks + 1)
|
|
538
|
+
} else if (rks < 16) {
|
|
539
|
+
rank_line.push(rks - 1.5)
|
|
540
|
+
rank_line.push(rks - 0.3)
|
|
541
|
+
rank_line.push(rks + 0)
|
|
542
|
+
rank_line.push(rks + 0.5)
|
|
543
|
+
} else {
|
|
544
|
+
rank_line.push(rks - 2)
|
|
545
|
+
rank_line.push(rks - 1)
|
|
546
|
+
rank_line.push(rks - 0.5)
|
|
547
|
+
rank_line.push(rks + 0)
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
rank_line.push(18)
|
|
551
|
+
|
|
552
|
+
/**将曲目分级并处理 */
|
|
553
|
+
for (let id of fCompute.objectKeys(info)) {
|
|
554
|
+
if (!info[id]?.chart) continue
|
|
555
|
+
for (let level of Level) {
|
|
556
|
+
if (info[id].chart[level]) {
|
|
557
|
+
if (!gameRecord[id] || !gameRecord[id][LevelNum[level]] || gameRecord[id][LevelNum[level]]?.acc != 100) {
|
|
558
|
+
let dif = info[id].chart[level].difficulty
|
|
559
|
+
for (let i in rank_line) {
|
|
560
|
+
if (dif < rank_line[i]) {
|
|
561
|
+
ranked_songs[i].push({ song: id, level })
|
|
562
|
+
break
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
for (let i in ranked_songs) {
|
|
573
|
+
if (task[i] && task[i].finished == true) {
|
|
574
|
+
continue
|
|
575
|
+
}
|
|
576
|
+
if (cmdTask.length || phiTask.length) {
|
|
577
|
+
/**@type {taskObj[]} */
|
|
578
|
+
let crtTaskList = [];
|
|
579
|
+
if (!phiTask.length || randint(100) < 80) {
|
|
580
|
+
crtTaskList = cmdTask;
|
|
581
|
+
} else {
|
|
582
|
+
crtTaskList = phiTask;
|
|
583
|
+
}
|
|
584
|
+
const randIndex = randint(crtTaskList.length - 1);
|
|
585
|
+
let aim = crtTaskList.splice(randIndex, 1)[0];
|
|
586
|
+
task[i] = {
|
|
587
|
+
song: aim.id,
|
|
588
|
+
reward: comReward(com_rks, aim.diff, aim.value, aim.oldAcc),
|
|
589
|
+
finished: false,
|
|
590
|
+
request: {
|
|
591
|
+
rank: aim.level,
|
|
592
|
+
type: aim.type,
|
|
593
|
+
value: Number(aim.value.toFixed(2)),
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
} else if (ranked_songs[i].length) {
|
|
597
|
+
const randIndex = randint(ranked_songs[i].length - 1);
|
|
598
|
+
let aim = ranked_songs[i][randIndex];
|
|
599
|
+
if (!aim) {
|
|
600
|
+
continue
|
|
601
|
+
}
|
|
602
|
+
let id = aim.song
|
|
603
|
+
let levelN = LevelNum[aim.level]
|
|
604
|
+
let diff = info?.[id]?.chart?.[aim.level]?.difficulty || 0
|
|
605
|
+
let value
|
|
606
|
+
let old_acc = 0
|
|
607
|
+
let old_score = 0
|
|
608
|
+
if (gameRecord[id] && gameRecord[id][levelN]) {
|
|
609
|
+
old_acc = gameRecord[id][levelN].acc
|
|
610
|
+
old_score = gameRecord[id][levelN].score
|
|
611
|
+
}
|
|
612
|
+
value = Math.min(Number(easeInSine(Math.random(), Math.min(old_acc + 0.01, 100), 100 - Math.min(old_acc + 0.01, 100), 1).toFixed(2)), 100)
|
|
613
|
+
|
|
614
|
+
task[i] = {
|
|
615
|
+
song: aim.song,
|
|
616
|
+
reward: comReward(com_rks, diff, value, old_acc),
|
|
617
|
+
finished: false,
|
|
618
|
+
request: {
|
|
619
|
+
rank: aim.level,
|
|
620
|
+
type: 'acc',
|
|
621
|
+
value,
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
return task
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
*
|
|
635
|
+
* @param {Save | false} save
|
|
636
|
+
* @param {PluginData} plugin_data
|
|
637
|
+
* @param {botEvent} e
|
|
638
|
+
*/
|
|
639
|
+
async function picData(save, plugin_data, e) {
|
|
640
|
+
let now_time = new Date()
|
|
641
|
+
let todayKey = formatDateKey(now_time)
|
|
642
|
+
|
|
643
|
+
/** 今日人品(复用 jrrp 的 redis 数据,保证一致) */
|
|
644
|
+
let fortune = await createJrrp(e)
|
|
645
|
+
|
|
646
|
+
/** 进度条(解锁/FC/PHI 三层叠加) */
|
|
647
|
+
let edgeRate = {
|
|
648
|
+
EZ: { unlock: '0%', fc: '0%', phi: '0%' },
|
|
649
|
+
HD: { unlock: '0%', fc: '0%', phi: '0%' },
|
|
650
|
+
IN: { unlock: '0%', fc: '0%', phi: '0%' },
|
|
651
|
+
AT: { unlock: '0%', fc: '0%', phi: '0%' },
|
|
652
|
+
}
|
|
653
|
+
if (save) {
|
|
654
|
+
try {
|
|
655
|
+
let stats = await save.getStats()
|
|
656
|
+
edgeRate.EZ.unlock = percent(stats?.[0]?.unlock, stats?.[0]?.tot)
|
|
657
|
+
edgeRate.EZ.fc = percent(stats?.[0]?.fc, stats?.[0]?.tot)
|
|
658
|
+
edgeRate.EZ.phi = percent(stats?.[0]?.phi, stats?.[0]?.tot)
|
|
659
|
+
|
|
660
|
+
edgeRate.HD.unlock = percent(stats?.[1]?.unlock, stats?.[1]?.tot)
|
|
661
|
+
edgeRate.HD.fc = percent(stats?.[1]?.fc, stats?.[1]?.tot)
|
|
662
|
+
edgeRate.HD.phi = percent(stats?.[1]?.phi, stats?.[1]?.tot)
|
|
663
|
+
|
|
664
|
+
edgeRate.IN.unlock = percent(stats?.[2]?.unlock, stats?.[2]?.tot)
|
|
665
|
+
edgeRate.IN.fc = percent(stats?.[2]?.fc, stats?.[2]?.tot)
|
|
666
|
+
edgeRate.IN.phi = percent(stats?.[2]?.phi, stats?.[2]?.tot)
|
|
667
|
+
|
|
668
|
+
edgeRate.AT.unlock = percent(stats?.[3]?.unlock, stats?.[3]?.tot)
|
|
669
|
+
edgeRate.AT.fc = percent(stats?.[3]?.fc, stats?.[3]?.tot)
|
|
670
|
+
edgeRate.AT.phi = percent(stats?.[3]?.phi, stats?.[3]?.tot)
|
|
671
|
+
} catch { }
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/** 日历(当月) */
|
|
675
|
+
let calendar = buildCalendar(now_time.getFullYear(), now_time.getMonth() + 1, new Set(plugin_data.sign_history || []), todayKey)
|
|
676
|
+
|
|
677
|
+
/** 公告 */
|
|
678
|
+
let notice = null;
|
|
679
|
+
|
|
680
|
+
if (plugin_data.noticeCode < getInfo.noticeJson.code) {
|
|
681
|
+
notice = getInfo.noticeJson
|
|
682
|
+
plugin_data.noticeCode = getInfo.noticeJson.code
|
|
683
|
+
getNotes.putNotesData(e.user_id, plugin_data)
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/** 任务列表(展示前 5 条) */
|
|
687
|
+
/**@type {{index: string, song: string, illustration: string, meta: string, finished: boolean}[]} */
|
|
688
|
+
let dailyTasks = []
|
|
689
|
+
if (save && Array.isArray(plugin_data.task)) {
|
|
690
|
+
for (let i = 0; i < Math.min(5, plugin_data.task.length); i++) {
|
|
691
|
+
let t = plugin_data.task[i]
|
|
692
|
+
if (!t) continue
|
|
693
|
+
const songInfo = getInfo.ori_info?.[t.song];
|
|
694
|
+
let ill = getInfo.getill(t.song)
|
|
695
|
+
let songName = songInfo?.song || t.song
|
|
696
|
+
let meta = `${t.request?.rank || ''} ${songInfo?.chart?.[t.request.rank]?.difficulty || ''} · ${(t.request?.type || '').toUpperCase()} ${t.request?.value ?? ''} · +${t.reward || 0} Notes`
|
|
697
|
+
dailyTasks.push({
|
|
698
|
+
index: fCompute.ped(i + 1, 2),
|
|
699
|
+
song: songName,
|
|
700
|
+
illustration: ill,
|
|
701
|
+
meta,
|
|
702
|
+
finished: Boolean(t.finished),
|
|
703
|
+
})
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return {
|
|
708
|
+
PlayerId: save ? save.saveInfo.PlayerId : '游客玩家',
|
|
709
|
+
Rks: save ? Number(save.saveInfo.summary.rankingScore).toFixed(4) : '0.0000',
|
|
710
|
+
Date: fCompute.formatDate(now_time),
|
|
711
|
+
ChallengeMode: save ? Math.floor(save.saveInfo.summary.challengeModeRank / 100) : 0,
|
|
712
|
+
ChallengeModeRank: save ? (save.saveInfo.summary.challengeModeRank % 100) : 0,
|
|
713
|
+
avatar: save ? getInfo.idgetavatar(save.gameuser.avatar) : 'Introduction',
|
|
714
|
+
background: getInfo.getill(illlist[Math.floor(Math.random() * (illlist.length - 1))]),
|
|
715
|
+
Notes: plugin_data.money,
|
|
716
|
+
signDays: Array.isArray(plugin_data.sign_history) ? plugin_data.sign_history.length : 0,
|
|
717
|
+
lucky: fortune.lucky,
|
|
718
|
+
good: fortune.good,
|
|
719
|
+
bad: fortune.bad,
|
|
720
|
+
quote: fortune.quote,
|
|
721
|
+
edgeRate,
|
|
722
|
+
dailyTasks,
|
|
723
|
+
calendar,
|
|
724
|
+
notice,
|
|
725
|
+
theme: plugin_data?.theme || 'default',
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* 计算任务奖励
|
|
731
|
+
* @param {number} rks
|
|
732
|
+
* @param {number} diff
|
|
733
|
+
* @param {number} value
|
|
734
|
+
* @param {number} oldAcc
|
|
735
|
+
* @returns
|
|
736
|
+
*/
|
|
737
|
+
function comReward(rks, diff, value, oldAcc) {
|
|
738
|
+
const p1 = pCeil(pmin(pmax(diff - rks, 0) * 20, 50))
|
|
739
|
+
const p2 = pCeil(pmin(pmax(value - oldAcc, 0) * 5, 20))
|
|
740
|
+
const p3 = pCeil((pmax(value - 95, 0) / 5) ** 3 * 30)
|
|
741
|
+
return p1 + p2 + p3;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* 定义生成指定区间整数随机数的函数
|
|
746
|
+
* @param {Number} max
|
|
747
|
+
* @param {Number} min 默认为0
|
|
748
|
+
* @returns
|
|
749
|
+
*/
|
|
750
|
+
function randint(max, min = 0) {
|
|
751
|
+
const range = max - min + 1
|
|
752
|
+
const randomOffset = Math.floor(Math.random() * range)
|
|
753
|
+
return (randomOffset + min) % range + min
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
*
|
|
758
|
+
* @param {Number} t 时间
|
|
759
|
+
* @param {Number} b 最小值
|
|
760
|
+
* @param {Number} c 跨度
|
|
761
|
+
* @param {Number} d 总时间长度
|
|
762
|
+
* @returns Number
|
|
763
|
+
*/
|
|
764
|
+
function easeInSine(t, b, c, d) {
|
|
765
|
+
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
*
|
|
770
|
+
* @param {Date|string|number} t
|
|
771
|
+
* @returns {Date} 当天零点时间
|
|
772
|
+
*/
|
|
773
|
+
function getDayZeroTimestamp(t) {
|
|
774
|
+
const date = new Date(t);
|
|
775
|
+
const year = date.getFullYear();
|
|
776
|
+
const month = date.getMonth();
|
|
777
|
+
const day = date.getDate();
|
|
778
|
+
const zeroDate = new Date(year, month, day, 0, 0, 0);
|
|
779
|
+
return zeroDate;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* @overload
|
|
784
|
+
* @param {Date} now_time
|
|
785
|
+
* @param {0} type 是否分开
|
|
786
|
+
* @returns {string}
|
|
787
|
+
*/
|
|
788
|
+
/**
|
|
789
|
+
* @overload
|
|
790
|
+
* @param {Date} now_time
|
|
791
|
+
* @param {1} type 是否分开
|
|
792
|
+
* @returns {string[]}
|
|
793
|
+
*/
|
|
794
|
+
/**
|
|
795
|
+
* @param {Date} now_time
|
|
796
|
+
* @param {number} [type=0] 是否分开
|
|
797
|
+
* @returns {string|string[]}
|
|
798
|
+
*/
|
|
799
|
+
function helloMsg(now_time, type = 0) {
|
|
800
|
+
|
|
801
|
+
/**判断时间段 */
|
|
802
|
+
const now_time_str = now_time.toString();
|
|
803
|
+
let time1 = new Date(now_time_str.replace(/([0-9])+:([0-9])+:([0-9])+/, '06:00:00')).getTime()
|
|
804
|
+
let time2 = new Date(now_time_str.replace(/([0-9])+:([0-9])+:([0-9])+/, '11:30:00')).getTime()
|
|
805
|
+
let time3 = new Date(now_time_str.replace(/([0-9])+:([0-9])+:([0-9])+/, '13:00:00')).getTime()
|
|
806
|
+
let time4 = new Date(now_time_str.replace(/([0-9])+:([0-9])+:([0-9])+/, '18:30:00')).getTime()
|
|
807
|
+
let time5 = new Date(now_time_str.replace(/([0-9])+:([0-9])+:([0-9])+/, '23:00:00')).getTime()
|
|
808
|
+
let Remsg = []
|
|
809
|
+
|
|
810
|
+
const now_time_ms = new Date().getTime()
|
|
811
|
+
|
|
812
|
+
const h_m_s = fCompute.formatDate(now_time, 'hh:mm:ss')
|
|
813
|
+
let ans = []
|
|
814
|
+
if (now_time_ms < time1) {
|
|
815
|
+
ans = [`现在是${h_m_s},夜深了,注意休息哦!`, `(∪.∪ )...zzz`]
|
|
816
|
+
} else if (now_time_ms < time2) {
|
|
817
|
+
ans = [`现在是${h_m_s},早安呐!`, `ヾ(≧▽≦*)o`]
|
|
818
|
+
} else if (now_time_ms < time3) {
|
|
819
|
+
ans = [`现在是${h_m_s},午好嗷!`, `(╹ڡ╹ )`]
|
|
820
|
+
} else if (now_time_ms < time4) {
|
|
821
|
+
ans = [`现在是${h_m_s},下午好哇!`, `(≧∀≦)ゞ`]
|
|
822
|
+
} else if (now_time_ms < time5) {
|
|
823
|
+
ans = [`现在是${h_m_s},晚上好!`, `( •̀ ω •́ )✧`]
|
|
824
|
+
} else {
|
|
825
|
+
ans = [`现在是${h_m_s},夜深了,注意休息哦!`, `(∪.∪ )...zzz`]
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return type ? ans : ans.join('');
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* 特殊日期处理
|
|
834
|
+
* @param {Date} now_time
|
|
835
|
+
*/
|
|
836
|
+
function checkSpDateIndex(now_time) {
|
|
837
|
+
// 特殊日期处理
|
|
838
|
+
let spDateIndex = -1;
|
|
839
|
+
for (let i = 0; i < spData.length; i++) {
|
|
840
|
+
const spDate = new Date(`${now_time.getFullYear()}/${spData[i].month}/${spData[i].date}`);
|
|
841
|
+
if (now_time.getMonth() === spDate.getMonth() && now_time.getDate() === spDate.getDate()) {
|
|
842
|
+
spDateIndex = i;
|
|
843
|
+
break;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return spDateIndex;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* 生成 YYYY-MM-DD(按本地日期)
|
|
851
|
+
* @param {Date} date
|
|
852
|
+
*/
|
|
853
|
+
function formatDateKey(date) {
|
|
854
|
+
const y = date.getFullYear()
|
|
855
|
+
const m = String(date.getMonth() + 1).padStart(2, '0')
|
|
856
|
+
const d = String(date.getDate()).padStart(2, '0')
|
|
857
|
+
return `${y}-${m}-${d}`
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* @param {number} a
|
|
862
|
+
* @param {number} b
|
|
863
|
+
*/
|
|
864
|
+
function percent(a, b) {
|
|
865
|
+
const aa = Number(a) || 0
|
|
866
|
+
const bb = Number(b) || 0
|
|
867
|
+
if (!bb) return '0%'
|
|
868
|
+
return `${Math.max(0, Math.min(100, Math.round((aa / bb) * 100)))}%`
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* 构建当月日历(周一为起始)
|
|
873
|
+
* @param {number} year
|
|
874
|
+
* @param {number} month 1-12
|
|
875
|
+
* @param {Set<string>} signHistory YYYY-MM-DD
|
|
876
|
+
* @param {string} todayKey YYYY-MM-DD
|
|
877
|
+
*/
|
|
878
|
+
function buildCalendar(year, month, signHistory, todayKey) {
|
|
879
|
+
const weekdays = ['一', '二', '三', '四', '五', '六', '日']
|
|
880
|
+
const daysInMonth = new Date(year, month, 0).getDate()
|
|
881
|
+
const first = new Date(year, month - 1, 1)
|
|
882
|
+
const firstIndex = (first.getDay() + 6) % 7 // Monday=0 ... Sunday=6
|
|
883
|
+
|
|
884
|
+
/**@type {Array<Array<{empty: boolean, day?: number, signed?: boolean, today?: boolean}>>} */
|
|
885
|
+
const weeks = []
|
|
886
|
+
let day = 1
|
|
887
|
+
|
|
888
|
+
for (let w = 0; w < 6; w++) {
|
|
889
|
+
/**@type {Array<{empty: boolean, day?: number, signed?: boolean, today?: boolean}>} */
|
|
890
|
+
const week = []
|
|
891
|
+
for (let i = 0; i < 7; i++) {
|
|
892
|
+
if ((w === 0 && i < firstIndex) || day > daysInMonth) {
|
|
893
|
+
week.push({ empty: true })
|
|
894
|
+
continue
|
|
895
|
+
}
|
|
896
|
+
const key = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`
|
|
897
|
+
week.push({
|
|
898
|
+
empty: false,
|
|
899
|
+
day,
|
|
900
|
+
signed: signHistory.has(key),
|
|
901
|
+
today: key === todayKey,
|
|
902
|
+
})
|
|
903
|
+
day++
|
|
904
|
+
}
|
|
905
|
+
weeks.push(week)
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
return {
|
|
909
|
+
title: `${year} 年 ${month} 月`,
|
|
910
|
+
weekdays,
|
|
911
|
+
weeks,
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* 复用 jrrp 的 redis 数据,保证同一用户同一天 fortune 一致
|
|
917
|
+
* @param {botEvent} e
|
|
918
|
+
*/
|
|
919
|
+
async function createJrrp(e) {
|
|
920
|
+
try {
|
|
921
|
+
// @ts-ignore
|
|
922
|
+
let cacheText = await redis.get(`${redisPath}:jrrp:${e.user_id}`)
|
|
923
|
+
if (cacheText) {
|
|
924
|
+
try {
|
|
925
|
+
const arr = JSON.parse(cacheText)
|
|
926
|
+
const quote = await pickSentenceText(arr?.[1])
|
|
927
|
+
return {
|
|
928
|
+
lucky: Number(arr?.[0]) || 0,
|
|
929
|
+
good: Array.isArray(arr) ? arr.slice(2, 6) : [],
|
|
930
|
+
bad: Array.isArray(arr) ? arr.slice(6, 10) : [],
|
|
931
|
+
quote,
|
|
932
|
+
oriData: arr,
|
|
933
|
+
}
|
|
934
|
+
} catch { }
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
if (!getInfo.word) {
|
|
938
|
+
send.send_with_At(e, '发生未知错误QAQ,请联系管理员处理!');
|
|
939
|
+
logger.error('jrrp获取词库失败,getInfo.word未定义!');
|
|
940
|
+
throw new Error('jrrp word undefined');
|
|
941
|
+
}
|
|
942
|
+
/**@type {[number, number]} */
|
|
943
|
+
let luckyRange = [0, 100];
|
|
944
|
+
let good = [...getInfo.word.good]
|
|
945
|
+
let bad = [...getInfo.word.bad]
|
|
946
|
+
let common = [...getInfo.word.common]
|
|
947
|
+
let local_sentence = sentence;
|
|
948
|
+
|
|
949
|
+
let now_time = new Date()
|
|
950
|
+
// 特殊日期处理
|
|
951
|
+
let spDateIndex = checkSpDateIndex(now_time);
|
|
952
|
+
if (spDateIndex !== -1 && spData[spDateIndex].jrrp) {
|
|
953
|
+
luckyRange = spData[spDateIndex].jrrp.lucky ?? luckyRange
|
|
954
|
+
good = spData[spDateIndex].jrrp.good ?? good
|
|
955
|
+
bad = spData[spDateIndex].jrrp.bad ?? bad
|
|
956
|
+
common = spData[spDateIndex].jrrp.common ?? common
|
|
957
|
+
local_sentence = spData[spDateIndex].jrrp.sentence ?? local_sentence
|
|
958
|
+
}
|
|
959
|
+
const luckyNum = Math.round(fCompute.getValueFromRange(easeOutCubic(Math.random()) * 100, luckyRange));
|
|
960
|
+
/**@type {any} */
|
|
961
|
+
let sentenceIndex = Math.floor(Math.random() * local_sentence.length);
|
|
962
|
+
if (local_sentence.length !== sentence?.length) {
|
|
963
|
+
sentenceIndex = local_sentence[sentenceIndex];
|
|
964
|
+
}
|
|
965
|
+
/** @type {any[]} */
|
|
966
|
+
const data = [luckyNum, sentenceIndex];
|
|
967
|
+
if (luckyNum == 100) {
|
|
968
|
+
data.push(..."诸事皆宜诸事皆宜".split(""));
|
|
969
|
+
} else if (luckyNum == 0) {
|
|
970
|
+
data.push(..."诸事不宜诸事不宜".split(""));
|
|
971
|
+
} else {
|
|
972
|
+
for (let i = 0; i < 4; i++) {
|
|
973
|
+
let id = Math.floor(Math.random() * (good.length + common.length))
|
|
974
|
+
if (id < good.length) {
|
|
975
|
+
data.push(good[id])
|
|
976
|
+
good.splice(id, 1)
|
|
977
|
+
} else {
|
|
978
|
+
data.push(common[id - good.length])
|
|
979
|
+
common.splice(id - good.length, 1)
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
for (let i = 0; i < 4; i++) {
|
|
983
|
+
let id = Math.floor(Math.random() * (bad.length + common.length))
|
|
984
|
+
if (id < bad.length) {
|
|
985
|
+
data.push(bad[id])
|
|
986
|
+
bad.splice(id, 1)
|
|
987
|
+
} else {
|
|
988
|
+
data.push(common[id - bad.length])
|
|
989
|
+
common.splice(id - bad.length, 1)
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
// @ts-ignore 有效期到第二天 8 点
|
|
995
|
+
redis.set(`${redisPath}:jrrp:${e.user_id}`, JSON.stringify(data), {
|
|
996
|
+
PX: 86400000 - ((new Date().valueOf() + 28800000) % 86400000)
|
|
997
|
+
})
|
|
998
|
+
|
|
999
|
+
const quote = await pickSentenceText(sentenceIndex)
|
|
1000
|
+
return {
|
|
1001
|
+
lucky: data[0],
|
|
1002
|
+
good: data.slice(2, 6),
|
|
1003
|
+
bad: data.slice(6, 10),
|
|
1004
|
+
quote,
|
|
1005
|
+
oriData: data,
|
|
1006
|
+
}
|
|
1007
|
+
} catch (e) {
|
|
1008
|
+
return { lucky: 0, good: [], bad: [], quote: '', oriData: [] }
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* @param {number} x
|
|
1014
|
+
*/
|
|
1015
|
+
function easeOutCubic(x) {
|
|
1016
|
+
return 1 - Math.pow(1 - x, 3)
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* @param {number | Record<"hitokoto", string>} idx
|
|
1021
|
+
*/
|
|
1022
|
+
async function pickSentenceText(idx) {
|
|
1023
|
+
if (typeof idx === 'object') {
|
|
1024
|
+
return idx.hitokoto || ''
|
|
1025
|
+
}
|
|
1026
|
+
const list = sentence ?? []
|
|
1027
|
+
const item = list?.[idx]
|
|
1028
|
+
if (!item) return ''
|
|
1029
|
+
if (typeof item === 'string') return item
|
|
1030
|
+
return item.hitokoto || ''
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* max
|
|
1035
|
+
* @param {number} a
|
|
1036
|
+
* @param {number} b
|
|
1037
|
+
* @returns {number}
|
|
1038
|
+
*/
|
|
1039
|
+
function pmax(a, b) {
|
|
1040
|
+
if (a === undefined) return b
|
|
1041
|
+
if (b === undefined) return a
|
|
1042
|
+
return Math.max(a, b)
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/** min
|
|
1046
|
+
* @param {number} a
|
|
1047
|
+
* @param {number} b
|
|
1048
|
+
* @returns {number}
|
|
1049
|
+
*/
|
|
1050
|
+
function pmin(a, b) {
|
|
1051
|
+
if (a === undefined) return b
|
|
1052
|
+
if (b === undefined) return a
|
|
1053
|
+
return Math.min(a, b)
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* ceil
|
|
1058
|
+
* @param {number} num
|
|
1059
|
+
* @return {number}
|
|
1060
|
+
*/
|
|
1061
|
+
function pCeil(num) {
|
|
1062
|
+
if (num === undefined) return 0
|
|
1063
|
+
return Math.ceil(num)
|
|
1064
|
+
}
|