@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.
Files changed (629) hide show
  1. package/LICENSE +22 -0
  2. package/core/.github/ISSUE_TEMPLATE/bug.yaml +133 -0
  3. package/core/.github/ISSUE_TEMPLATE/config.yml +1 -0
  4. package/core/.github/ISSUE_TEMPLATE/enhancement.yml +44 -0
  5. package/core/.vscode/c_cpp_properties.json +18 -0
  6. package/core/.vscode/launch.json +24 -0
  7. package/core/.vscode/settings.json +59 -0
  8. package/core/CHANGELOG.md +184 -0
  9. package/core/LICENSE +674 -0
  10. package/core/README.md +330 -0
  11. package/core/README_en.md +285 -0
  12. package/core/apps/Dan.js +129 -0
  13. package/core/apps/RankList.js +322 -0
  14. package/core/apps/aliasProposal.js +223 -0
  15. package/core/apps/apiSetting.js +592 -0
  16. package/core/apps/b19.js +1329 -0
  17. package/core/apps/botClient.js +64 -0
  18. package/core/apps/chart.js +692 -0
  19. package/core/apps/guessGame/guessIll.js +821 -0
  20. package/core/apps/guessGame/guessLetter.js +831 -0
  21. package/core/apps/guessGame/guessTips.js +254 -0
  22. package/core/apps/guessGame/letterGameUtils.js +74 -0
  23. package/core/apps/guessGame.js +214 -0
  24. package/core/apps/help.js +117 -0
  25. package/core/apps/manage.js +288 -0
  26. package/core/apps/market.js +243 -0
  27. package/core/apps/money.js +1064 -0
  28. package/core/apps/phisong.js +1418 -0
  29. package/core/apps/session.js +664 -0
  30. package/core/apps/setting.js +468 -0
  31. package/core/apps/update.js +541 -0
  32. package/core/apps/user.js +968 -0
  33. package/core/components/Config.js +249 -0
  34. package/core/components/Data.js +304 -0
  35. package/core/components/FileWatcherRegistry.js +102 -0
  36. package/core/components/Logger.js +11 -0
  37. package/core/components/ProcessCleanup.js +113 -0
  38. package/core/components/Version.js +56 -0
  39. package/core/components/YamlReader.js +157 -0
  40. package/core/components/baseClass.js +287 -0
  41. package/core/components/common.js +47 -0
  42. package/core/components/index.js +13 -0
  43. package/core/components/platform/index.js +79 -0
  44. package/core/components/platform/koishi.js +800 -0
  45. package/core/components/platform/koishiDatabaseRedis.js +391 -0
  46. package/core/components/platform/memoryRedis.js +209 -0
  47. package/core/components/platform/types.d.ts +272 -0
  48. package/core/components/platform/yunzai.js +604 -0
  49. package/core/components/segment.js +4 -0
  50. 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
  51. package/core/config/default_config/banGroup.yaml +14 -0
  52. package/core/config/default_config/config.yaml +159 -0
  53. package/core/config/default_config/nickconfig.yaml +6 -0
  54. package/core/config/default_config/otherinfo.yaml +51 -0
  55. package/core/guoba.support.js +597 -0
  56. package/core/index.js +85 -0
  57. package/core/lib/AES.js +40 -0
  58. package/core/lib/Base64.js +22 -0
  59. package/core/lib/ByteReader.js +168 -0
  60. package/core/lib/GameProgress.js +37 -0
  61. package/core/lib/GameRecord.js +47 -0
  62. package/core/lib/GameSettings.js +24 -0
  63. package/core/lib/GameUser.js +19 -0
  64. package/core/lib/Level.js +6 -0
  65. package/core/lib/LevelRecord.js +9 -0
  66. package/core/lib/PhigrosUser.js +135 -0
  67. package/core/lib/SaveManager.js +117 -0
  68. package/core/lib/Summary.js +47 -0
  69. package/core/lib/TapTap/CompleteQRCodeData.js +27 -0
  70. package/core/lib/TapTap/LCHelper.js +81 -0
  71. package/core/lib/TapTap/TapTapHelper.js +170 -0
  72. package/core/lib/TapTap/getQRcode.js +61 -0
  73. package/core/lib/Util.js +30 -0
  74. package/core/lib/getQRcode.js +73 -0
  75. package/core/lib/http.js +105 -0
  76. package/core/model/README.md +3 -0
  77. package/core/model/api/aliasProposalService.js +151 -0
  78. package/core/model/api/apiVersion.js +67 -0
  79. package/core/model/api/autoSeekApi.js +165 -0
  80. package/core/model/api/botApiAuth.js +208 -0
  81. package/core/model/api/botSyncService.js +78 -0
  82. package/core/model/api/gameRecordPayload.js +24 -0
  83. package/core/model/api/makeRequest.js +1004 -0
  84. package/core/model/api/makeRequestFnc.js +17 -0
  85. package/core/model/api/phiApiClient.js +53 -0
  86. package/core/model/api/phiApiErrors.js +121 -0
  87. package/core/model/filesystem/getFile.js +256 -0
  88. package/core/model/filesystem/path.js +84 -0
  89. package/core/model/game/Chart.js +57 -0
  90. package/core/model/game/LevelRecordInfo.js +109 -0
  91. package/core/model/game/SongsInfo.js +46 -0
  92. package/core/model/game/b30Analysis.js +93 -0
  93. package/core/model/game/chartParser/Chart.js +23 -0
  94. package/core/model/game/chartParser/JudgeLine.js +38 -0
  95. package/core/model/game/chartParser/base/JudgeLineEvent.js +99 -0
  96. package/core/model/game/chartParser/base/Note.js +44 -0
  97. package/core/model/game/chartParser/base/SpeedEvent.js +25 -0
  98. package/core/model/game/chartParser/base/baseType.js +2 -0
  99. package/core/model/game/constNum.js +215 -0
  100. package/core/model/game/fCompute.js +711 -0
  101. package/core/model/game/getChartTag.js +140 -0
  102. package/core/model/game/getComment.js +132 -0
  103. package/core/model/game/getInfo.js +1069 -0
  104. package/core/model/game/getRksRank.js +77 -0
  105. package/core/model/game/markdown.js +77 -0
  106. package/core/model/integrations/Vika.js +103 -0
  107. package/core/model/integrations/getInfoFromTap.js +80 -0
  108. package/core/model/render/getPic.js +79 -0
  109. package/core/model/render/picmodle.js +496 -0
  110. package/core/model/render/progress-bar.js +44 -0
  111. package/core/model/render/puppeteer.js +431 -0
  112. package/core/model/render/renderPressureHistory.js +71 -0
  113. package/core/model/render/send.js +94 -0
  114. package/core/model/save/Save.js +953 -0
  115. package/core/model/save/analyzeSaveHistory.js +413 -0
  116. package/core/model/save/getBackup.js +328 -0
  117. package/core/model/save/getSave.js +90 -0
  118. package/core/model/save/getSaveFromApi.js +46 -0
  119. package/core/model/save/saveHistory.js +586 -0
  120. package/core/model/save/scoreHistory.js +101 -0
  121. package/core/model/theme/catalog.js +192 -0
  122. package/core/model/theme/installGuard.js +275 -0
  123. package/core/model/theme/installLock.js +174 -0
  124. package/core/model/theme/installer.js +398 -0
  125. package/core/model/theme/manager.js +408 -0
  126. package/core/model/theme/marketClient.js +294 -0
  127. package/core/model/theme/paths.js +42 -0
  128. package/core/model/theme/policy.js +54 -0
  129. package/core/model/theme/recovery.js +167 -0
  130. package/core/model/theme/useService.js +187 -0
  131. package/core/model/type/aliasProposal.d.ts +45 -0
  132. package/core/model/type/type.js +420 -0
  133. package/core/model/user/apiPermission.js +62 -0
  134. package/core/model/user/getBanGroup.js +120 -0
  135. package/core/model/user/getNotes.js +48 -0
  136. package/core/model/user/pluginData.js +101 -0
  137. package/core/model/user/userCredentialStore.js +154 -0
  138. package/core/model/user/userCredentials.js +860 -0
  139. package/core/package.json +60 -0
  140. package/core/resources/0608badSave/save.json +1 -0
  141. package/core/resources/LICENSE +201 -0
  142. package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.art +220 -0
  143. package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.css +345 -0
  144. package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.html +434 -0
  145. package/core/resources/html/arcgrosB19/arcgros.png +0 -0
  146. package/core/resources/html/arcgrosB19/arcgrosB19-orz.html +276 -0
  147. package/core/resources/html/arcgrosB19/arcgrosB19.art +168 -0
  148. package/core/resources/html/arcgrosB19/arcgrosB19.css +637 -0
  149. package/core/resources/html/atlas/atlas-orz.html +313 -0
  150. package/core/resources/html/atlas/atlas.art +194 -0
  151. package/core/resources/html/atlas/atlas.css +695 -0
  152. package/core/resources/html/avatar/-SURREALISM-.png +0 -0
  153. package/core/resources/html/avatar/Alkaid.png +0 -0
  154. package/core/resources/html/avatar/Aphasia.png +0 -0
  155. package/core/resources/html/avatar/Artificial Existence.png +0 -0
  156. package/core/resources/html/avatar/Bonus Time.png +0 -0
  157. package/core/resources/html/avatar/Burn.png +0 -0
  158. package/core/resources/html/avatar/Cereris1.png +0 -0
  159. package/core/resources/html/avatar/Cereris2.png +0 -0
  160. package/core/resources/html/avatar/Cereris3.png +0 -0
  161. package/core/resources/html/avatar/Christmas -2019.png +0 -0
  162. package/core/resources/html/avatar/Cipher1.png +0 -0
  163. package/core/resources/html/avatar/Class Memories.png +0 -0
  164. package/core/resources/html/avatar/Credits.png +0 -0
  165. package/core/resources/html/avatar/Dash.png +0 -0
  166. package/core/resources/html/avatar/Dlyrotz.png +0 -0
  167. package/core/resources/html/avatar/Doppelganger1.png +0 -0
  168. package/core/resources/html/avatar/Doppelganger2.png +0 -0
  169. package/core/resources/html/avatar/Drop it.png +0 -0
  170. package/core/resources/html/avatar/Energy Synergy Matrix1.png +0 -0
  171. package/core/resources/html/avatar/Energy Synergy Matrix2.png +0 -0
  172. package/core/resources/html/avatar/Energy Synergy Matrix3.png +0 -0
  173. package/core/resources/html/avatar/Engine x Start!! (melody mix).png +0 -0
  174. package/core/resources/html/avatar/Engine x Start!! extra 1 -by cycats.png +0 -0
  175. package/core/resources/html/avatar/Eradication Catastrophe.png +0 -0
  176. package/core/resources/html/avatar/FULi AUTO SHOOTER extra 1 -by cycats.png +0 -0
  177. package/core/resources/html/avatar/FULi AUTO SHOOTER.png +0 -0
  178. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special1.png +0 -0
  179. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special2.png +0 -0
  180. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2641.png +0 -0
  181. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2642.png +0 -0
  182. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2643.png +0 -0
  183. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2644.png +0 -0
  184. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2645.png +0 -0
  185. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2646.png +0 -0
  186. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2647.png +0 -0
  187. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2648.png +0 -0
  188. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2649.png +0 -0
  189. package/core/resources/html/avatar/Find_Me.png +0 -0
  190. package/core/resources/html/avatar/Geopelia 1 -by cycats.png +0 -0
  191. package/core/resources/html/avatar/Geopelia 2 -by cycats.png +0 -0
  192. package/core/resources/html/avatar/Geopelia 3 -by /344/275/225/345/221/265.png +0 -0
  193. package/core/resources/html/avatar/Geopelia in WEPLAY -by /346/265/267/344/272/247.png +0 -0
  194. package/core/resources/html/avatar/Gino-AprilFool.png +0 -0
  195. package/core/resources/html/avatar/Glaciaxion.png +0 -0
  196. package/core/resources/html/avatar/HumaN.png +0 -0
  197. package/core/resources/html/avatar/Indelible Scar.png +0 -0
  198. package/core/resources/html/avatar/Introduction.png +0 -0
  199. package/core/resources/html/avatar/Khronostasis Katharsis.png +0 -0
  200. package/core/resources/html/avatar/MARENOL.png +0 -0
  201. package/core/resources/html/avatar/Marenol extra 1 -by /345/226/265n/350/221/265.png +0 -0
  202. package/core/resources/html/avatar/Non-Melodic Ragez (MUG Edit).png +0 -0
  203. package/core/resources/html/avatar/Non-Melodic Ragez extra 1 -by cycats.png +0 -0
  204. package/core/resources/html/avatar/Oblivion +0 -0
  205. package/core/resources/html/avatar/OblivionPHIN.png +0 -0
  206. package/core/resources/html/avatar/Para.png +0 -0
  207. package/core/resources/html/avatar/Pixel Rebelz1.png +0 -0
  208. package/core/resources/html/avatar/Pixel Rebelz2.png +0 -0
  209. package/core/resources/html/avatar/Pixel Rebelz3.png +0 -0
  210. package/core/resources/html/avatar/RIPPER extra 1 -by cycats.png +0 -0
  211. package/core/resources/html/avatar/RIPPER extra 2 -by /344/275/225/345/221/265.png +0 -0
  212. package/core/resources/html/avatar/Sein.png +0 -0
  213. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special.png +0 -0
  214. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special2.png +0 -0
  215. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/231/256/351/200/232.png +0 -0
  216. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/233/262/347/273/230Ver.png +0 -0
  217. package/core/resources/html/avatar/ShineAfter-/351/270/240-Special.png +0 -0
  218. package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/231/256/351/200/232.png +0 -0
  219. package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/233/262/347/273/230Ver.png +0 -0
  220. package/core/resources/html/avatar/ShineAfter-/351/270/240/345/222/214/346/260/264/351/235/222-Special.png +0 -0
  221. package/core/resources/html/avatar/Snow Desert.png +0 -0
  222. package/core/resources/html/avatar/Sparkle New Life.png +0 -0
  223. package/core/resources/html/avatar/Sultan Rage.png +0 -0
  224. package/core/resources/html/avatar/Winter /342/206/221cube/342/206/223.png +0 -0
  225. package/core/resources/html/avatar/Xenolith.png +0 -0
  226. package/core/resources/html/avatar/[PRAW].png +0 -0
  227. package/core/resources/html/avatar/dB doll.png +0 -0
  228. package/core/resources/html/avatar/ripper.png +0 -0
  229. package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2721.png +0 -0
  230. package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2722.png +0 -0
  231. package/core/resources/html/avatar//344/270/207/345/220/250/345/214/277/345/220/215/344/277/241.png +0 -0
  232. 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
  233. package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251.png +0 -0
  234. package/core/resources/html/avatar//345/205/211.png +0 -0
  235. package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2051.png +0 -0
  236. package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2052.png +0 -0
  237. 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
  238. package/core/resources/html/avatar//346/267/267/344/271/261-Confusion.png +0 -0
  239. package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2361.png +0 -0
  240. package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2362.png +0 -0
  241. package/core/resources/html/avatar//347/223/267/345/262/201-Special.png +0 -0
  242. package/core/resources/html/avatar//347/223/267/345/262/2011.png +0 -0
  243. package/core/resources/html/avatar//347/223/267/345/262/2012.png +0 -0
  244. package/core/resources/html/avatar//347/223/267/345/262/2013.png +0 -0
  245. package/core/resources/html/avatar//347/223/267/345/262/2014.png +0 -0
  246. package/core/resources/html/avatar//347/223/267/345/262/2015.png +0 -0
  247. package/core/resources/html/avatar//347/223/267/345/262/2016.png +0 -0
  248. package/core/resources/html/avatar//347/223/267/345/262/2017.png +0 -0
  249. package/core/resources/html/avatar//347/233/217/350/214/227-Special.png +0 -0
  250. package/core/resources/html/avatar//347/233/217/350/214/2271.png +0 -0
  251. package/core/resources/html/avatar//347/233/217/350/214/2272.png +0 -0
  252. package/core/resources/html/avatar//347/233/217/350/214/2273.png +0 -0
  253. package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2611.png +0 -0
  254. package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2612.png +0 -0
  255. package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2501.png +0 -0
  256. package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2502.png +0 -0
  257. package/core/resources/html/avatar//351/235/222/350/212/275-Special.png +0 -0
  258. package/core/resources/html/avatar//351/235/222/350/212/275.png +0 -0
  259. package/core/resources/html/avatar//351/243/216/345/261/277.png +0 -0
  260. package/core/resources/html/avatar//351/270/240-AprilFool.png +0 -0
  261. 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
  262. package/core/resources/html/b19/b19.art +490 -0
  263. package/core/resources/html/b19/b19.css +1261 -0
  264. package/core/resources/html/b19/b19666.art +350 -0
  265. package/core/resources/html/b19/b19666.css +1409 -0
  266. package/core/resources/html/b19/b19666.html +481 -0
  267. package/core/resources/html/b19/b19title.css +120 -0
  268. package/core/resources/html/b19/best19.html +853 -0
  269. package/core/resources/html/b19/dss2-orz.html +428 -0
  270. package/core/resources/html/b19/dss2.art +298 -0
  271. package/core/resources/html/b19/dss2.css +776 -0
  272. package/core/resources/html/b19/res/666.jpeg +0 -0
  273. package/core/resources/html/chap/chap-orz.html +93 -0
  274. package/core/resources/html/chap/chap.art +87 -0
  275. package/core/resources/html/chap/chap.css +365 -0
  276. package/core/resources/html/chartImg/chartImg.art +169 -0
  277. package/core/resources/html/chartImg/chartImg.css +439 -0
  278. package/core/resources/html/chartImg/echarts-wordcloud.min.js +3 -0
  279. package/core/resources/html/chartImg/echarts.js +85796 -0
  280. package/core/resources/html/chartImg/img/Drag.png +0 -0
  281. package/core/resources/html/chartImg/img/DragHL.png +0 -0
  282. package/core/resources/html/chartImg/img/Flick.png +0 -0
  283. package/core/resources/html/chartImg/img/FlickHL.png +0 -0
  284. package/core/resources/html/chartImg/img/Hold.png +0 -0
  285. package/core/resources/html/chartImg/img/HoldHL.png +0 -0
  286. package/core/resources/html/chartImg/img/Hold_End.png +0 -0
  287. package/core/resources/html/chartImg/img/Hold_Head.png +0 -0
  288. package/core/resources/html/chartImg/img/Hold_HeadHL.png +0 -0
  289. package/core/resources/html/chartImg/img/Tap.png +0 -0
  290. package/core/resources/html/chartImg/img/TapHL.png +0 -0
  291. package/core/resources/html/chartInfo/chartInfo-orz.html +250 -0
  292. package/core/resources/html/chartInfo/chartInfo.art +222 -0
  293. package/core/resources/html/chartInfo/chartInfo.css +265 -0
  294. package/core/resources/html/chartInfo/echarts-wordcloud.min.js +3 -0
  295. package/core/resources/html/chartInfo/echarts.js +85796 -0
  296. package/core/resources/html/clg/clg-orz.html +218 -0
  297. package/core/resources/html/clg/clg.art +88 -0
  298. package/core/resources/html/clg/clg.css +230 -0
  299. package/core/resources/html/clg/demo.jpg +0 -0
  300. package/core/resources/html/common/common.css +319 -0
  301. package/core/resources/html/common/css/playerInfo.css +136 -0
  302. package/core/resources/html/common/font/Aldrich-Regular.ttf +0 -0
  303. package/core/resources/html/common/font/HIMALAYA.TTF +0 -0
  304. package/core/resources/html/common/font/NotoColorEmoji-Regular.ttf +0 -0
  305. package/core/resources/html/common/font/NotoSans-Regular.ttf +0 -0
  306. package/core/resources/html/common/font/NotoSansArabic.ttf +0 -0
  307. package/core/resources/html/common/font/NotoSansCanadianAboriginal.ttf +0 -0
  308. package/core/resources/html/common/font/NotoSansJP.ttf +0 -0
  309. package/core/resources/html/common/font/NotoSansKannada.ttf +0 -0
  310. package/core/resources/html/common/font/NotoSansMath-Regular.ttf +0 -0
  311. package/core/resources/html/common/font/NotoSansSymbols2.ttf +0 -0
  312. package/core/resources/html/common/font/phi.ttf +0 -0
  313. package/core/resources/html/common/font//345/220/236/345/274/245/346/201/260/344/277/212.ttf +0 -0
  314. package/core/resources/html/common/layout/default.art +324 -0
  315. package/core/resources/html/common/layout/elem.art +21 -0
  316. package/core/resources/html/common/theme/snow/snow.css +17 -0
  317. package/core/resources/html/common/theme/snow/snow.js +19 -0
  318. package/core/resources/html/common/theme/star/star.js +201 -0
  319. package/core/resources/html/common/theme/topText/topText.css +15 -0
  320. package/core/resources/html/common/theme/topText/topText.js +30 -0
  321. package/core/resources/html/difficultyHistory/difficultyHistory-orz.html +361 -0
  322. package/core/resources/html/difficultyHistory/difficultyHistory.art +102 -0
  323. package/core/resources/html/difficultyHistory/difficultyHistory.css +205 -0
  324. package/core/resources/html/guess/guess-orz.html +50 -0
  325. package/core/resources/html/guess/guess.art +51 -0
  326. package/core/resources/html/guess/guess.css +33 -0
  327. package/core/resources/html/help/help-orz.html +73 -0
  328. package/core/resources/html/help/help.art +84 -0
  329. package/core/resources/html/help/help.css +266 -0
  330. package/core/resources/html/historyB30/historyB30-orz.html +168 -0
  331. package/core/resources/html/historyB30/historyB30.art +143 -0
  332. package/core/resources/html/historyB30/historyB30.css +270 -0
  333. package/core/resources/html/ill/ill-orz.html +21 -0
  334. package/core/resources/html/ill/ill.art +23 -0
  335. package/core/resources/html/ill/ill.css +79 -0
  336. package/core/resources/html/jrrp/ShineAfter.removebg.png +0 -0
  337. package/core/resources/html/jrrp/jrrp-orz.html +68 -0
  338. package/core/resources/html/jrrp/jrrp.art +58 -0
  339. package/core/resources/html/jrrp/jrrp.css +251 -0
  340. package/core/resources/html/list/list-orz.html +35 -0
  341. package/core/resources/html/list/list.art +67 -0
  342. package/core/resources/html/list/list.css +259 -0
  343. package/core/resources/html/lvsco/demo.jpg +0 -0
  344. package/core/resources/html/lvsco/lvsco-orz.html +334 -0
  345. package/core/resources/html/lvsco/lvsco.art +314 -0
  346. package/core/resources/html/lvsco/lvsco.css +706 -0
  347. package/core/resources/html/market/detail.art +44 -0
  348. package/core/resources/html/market/market.art +86 -0
  349. package/core/resources/html/market/market.css +64 -0
  350. package/core/resources/html/newSong/newSong.art +34 -0
  351. package/core/resources/html/newSong/newSong.css +48 -0
  352. package/core/resources/html/newSong/newSong.html +23 -0
  353. package/core/resources/html/newnotice/newnotice.art +47 -0
  354. package/core/resources/html/newnotice/newnotice.css +83 -0
  355. package/core/resources/html/otherimg/0.png +0 -0
  356. package/core/resources/html/otherimg/1.png +0 -0
  357. package/core/resources/html/otherimg/2.png +0 -0
  358. package/core/resources/html/otherimg/3.png +0 -0
  359. package/core/resources/html/otherimg/4.png +0 -0
  360. package/core/resources/html/otherimg/5.png +0 -0
  361. package/core/resources/html/otherimg/A.png +0 -0
  362. package/core/resources/html/otherimg/B.png +0 -0
  363. package/core/resources/html/otherimg/C.png +0 -0
  364. package/core/resources/html/otherimg/F.png +0 -0
  365. package/core/resources/html/otherimg/FC.png +0 -0
  366. package/core/resources/html/otherimg/NEW.png +0 -0
  367. package/core/resources/html/otherimg/Phigros_Icon_3.0.0.png +0 -0
  368. package/core/resources/html/otherimg/S.png +0 -0
  369. package/core/resources/html/otherimg/Star1.png +0 -0
  370. package/core/resources/html/otherimg/Star2.png +0 -0
  371. package/core/resources/html/otherimg/V.png +0 -0
  372. package/core/resources/html/otherimg/callback.png +0 -0
  373. package/core/resources/html/otherimg/chapHelp.png +0 -0
  374. package/core/resources/html/otherimg/dan_code.png +0 -0
  375. package/core/resources/html/otherimg/data.png +0 -0
  376. package/core/resources/html/otherimg/helpDoc.png +0 -0
  377. package/core/resources/html/otherimg/nickSuggest.png +0 -0
  378. package/core/resources/html/otherimg/phi.png +0 -0
  379. package/core/resources/html/otherimg/phigros.png +0 -0
  380. package/core/resources/html/otherimg/snow1.png +0 -0
  381. package/core/resources/html/otherimg/snow2.png +0 -0
  382. package/core/resources/html/otherimg/snow3.png +0 -0
  383. package/core/resources/html/otherimg/snow4.png +0 -0
  384. package/core/resources/html/otherimg/title.png +0 -0
  385. package/core/resources/html/rand/rand-orz.html +62 -0
  386. package/core/resources/html/rand/rand.art +59 -0
  387. package/core/resources/html/rand/rand.css +257 -0
  388. package/core/resources/html/rankingList/rankingList-orz.html +456 -0
  389. package/core/resources/html/rankingList/rankingList.art +171 -0
  390. package/core/resources/html/rankingList/rankingList.css +570 -0
  391. package/core/resources/html/rankingList-old/rankingList-orz.html +300 -0
  392. package/core/resources/html/rankingList-old/rankingList.art +89 -0
  393. package/core/resources/html/rankingList-old/rankingList.css +265 -0
  394. package/core/resources/html/score/score-orz.html +625 -0
  395. package/core/resources/html/score/score.art +249 -0
  396. package/core/resources/html/score/score.css +435 -0
  397. package/core/resources/html/score/scoreOld-orz.html +128 -0
  398. package/core/resources/html/score/scoreOld.art +230 -0
  399. package/core/resources/html/score/scoreOld.css +475 -0
  400. package/core/resources/html/score/scoreRankList-orz.html +613 -0
  401. package/core/resources/html/score/scoreRankList.art +231 -0
  402. package/core/resources/html/score/scoreRankList.css +197 -0
  403. package/core/resources/html/setting/setting-orz.html +123 -0
  404. package/core/resources/html/setting/setting.art +72 -0
  405. package/core/resources/html/setting/setting.css +170 -0
  406. package/core/resources/html/setting/userSetting-orz.html +132 -0
  407. package/core/resources/html/setting/userSetting.art +48 -0
  408. package/core/resources/html/setting/userSetting.css +160 -0
  409. package/core/resources/html/sign/sign-orz.html +262 -0
  410. package/core/resources/html/sign/sign.art +163 -0
  411. package/core/resources/html/sign/sign.css +706 -0
  412. package/core/resources/html/suggest/suggest.art +271 -0
  413. package/core/resources/html/suggest/suggest.css +300 -0
  414. package/core/resources/html/table/table-orz.html +228 -0
  415. package/core/resources/html/table/table.art +163 -0
  416. package/core/resources/html/table/table.css +401 -0
  417. package/core/resources/html/tasks/tasks-orz.html +83 -0
  418. package/core/resources/html/tasks/tasks.art +118 -0
  419. package/core/resources/html/tasks/tasks.css +334 -0
  420. package/core/resources/html/update/update-orz.html +735 -0
  421. package/core/resources/html/update/update.art +259 -0
  422. package/core/resources/html/update/update.css +676 -0
  423. package/core/resources/html/userinfo/userinfo-old-orz.html +408 -0
  424. package/core/resources/html/userinfo/userinfo-old.art +233 -0
  425. package/core/resources/html/userinfo/userinfo-old.css +466 -0
  426. package/core/resources/html/userinfo/userinfo-orz.html +543 -0
  427. package/core/resources/html/userinfo/userinfo.art +288 -0
  428. package/core/resources/html/userinfo/userinfo.css +757 -0
  429. package/core/resources/info/DLC/arc.json +412 -0
  430. package/core/resources/info/DLC/chunithm.json +1172 -0
  431. package/core/resources/info/DLC/dynamix.json +455 -0
  432. package/core/resources/info/DLC/fanshi.json +132 -0
  433. package/core/resources/info/DLC/lanota.json +412 -0
  434. package/core/resources/info/DLC/maimai.json +1110 -0
  435. package/core/resources/info/DLC/orz.json +158 -0
  436. package/core/resources/info/DLC/rizline.json +40 -0
  437. package/core/resources/info/DLC/rotaeno.json +159 -0
  438. package/core/resources/info/DLC/ryceam.json +53 -0
  439. package/core/resources/info/avatar.txt +109 -0
  440. package/core/resources/info/chaplist.yaml +102 -0
  441. package/core/resources/info/help/api.json +83 -0
  442. package/core/resources/info/help.json +436 -0
  443. package/core/resources/info/info.csv +315 -0
  444. package/core/resources/info/infolist.json +1758 -0
  445. package/core/resources/info/jrrp.json +92 -0
  446. package/core/resources/info/nicklist.yaml +2373 -0
  447. package/core/resources/info/notesInfo.json +1 -0
  448. package/core/resources/info/notice.json +11 -0
  449. package/core/resources/info/oldInfo/100/change.csv +218 -0
  450. package/core/resources/info/oldInfo/100/info.json +7 -0
  451. package/core/resources/info/oldInfo/101/change.csv +218 -0
  452. package/core/resources/info/oldInfo/101/info.json +7 -0
  453. package/core/resources/info/oldInfo/102/change.csv +223 -0
  454. package/core/resources/info/oldInfo/102/info.json +7 -0
  455. package/core/resources/info/oldInfo/103/change.csv +224 -0
  456. package/core/resources/info/oldInfo/103/info.json +7 -0
  457. package/core/resources/info/oldInfo/104/change.csv +225 -0
  458. package/core/resources/info/oldInfo/104/info.json +7 -0
  459. package/core/resources/info/oldInfo/105/change.csv +228 -0
  460. package/core/resources/info/oldInfo/105/info.json +7 -0
  461. package/core/resources/info/oldInfo/106/change.csv +229 -0
  462. package/core/resources/info/oldInfo/106/info.json +7 -0
  463. package/core/resources/info/oldInfo/108/change.csv +233 -0
  464. package/core/resources/info/oldInfo/108/info.json +7 -0
  465. package/core/resources/info/oldInfo/109/change.csv +235 -0
  466. package/core/resources/info/oldInfo/109/info.json +7 -0
  467. package/core/resources/info/oldInfo/110/change.csv +235 -0
  468. package/core/resources/info/oldInfo/110/info.json +7 -0
  469. package/core/resources/info/oldInfo/111/change.csv +242 -0
  470. package/core/resources/info/oldInfo/111/info.json +7 -0
  471. package/core/resources/info/oldInfo/112/change.csv +242 -0
  472. package/core/resources/info/oldInfo/112/info.json +7 -0
  473. package/core/resources/info/oldInfo/113/change.csv +244 -0
  474. package/core/resources/info/oldInfo/113/info.json +7 -0
  475. package/core/resources/info/oldInfo/115/change.csv +247 -0
  476. package/core/resources/info/oldInfo/115/info.json +7 -0
  477. package/core/resources/info/oldInfo/116/change.csv +249 -0
  478. package/core/resources/info/oldInfo/116/info.json +7 -0
  479. package/core/resources/info/oldInfo/118/change.csv +252 -0
  480. package/core/resources/info/oldInfo/118/info.json +7 -0
  481. package/core/resources/info/oldInfo/119/change.csv +255 -0
  482. package/core/resources/info/oldInfo/119/info.json +7 -0
  483. package/core/resources/info/oldInfo/120/change.csv +255 -0
  484. package/core/resources/info/oldInfo/120/info.json +7 -0
  485. package/core/resources/info/oldInfo/121/change.csv +257 -0
  486. package/core/resources/info/oldInfo/121/info.json +7 -0
  487. package/core/resources/info/oldInfo/122/change.csv +260 -0
  488. package/core/resources/info/oldInfo/122/info.json +7 -0
  489. package/core/resources/info/oldInfo/123/change.csv +260 -0
  490. package/core/resources/info/oldInfo/123/info.json +7 -0
  491. package/core/resources/info/oldInfo/124/change.csv +262 -0
  492. package/core/resources/info/oldInfo/124/info.json +7 -0
  493. package/core/resources/info/oldInfo/125/change.csv +266 -0
  494. package/core/resources/info/oldInfo/125/info.json +7 -0
  495. package/core/resources/info/oldInfo/126/change.csv +269 -0
  496. package/core/resources/info/oldInfo/126/info.json +7 -0
  497. package/core/resources/info/oldInfo/127/change.csv +270 -0
  498. package/core/resources/info/oldInfo/127/info.json +7 -0
  499. package/core/resources/info/oldInfo/128/change.csv +273 -0
  500. package/core/resources/info/oldInfo/128/info.json +7 -0
  501. package/core/resources/info/oldInfo/129/change.csv +274 -0
  502. package/core/resources/info/oldInfo/129/info.json +7 -0
  503. package/core/resources/info/oldInfo/130/change.csv +275 -0
  504. package/core/resources/info/oldInfo/130/info.json +7 -0
  505. package/core/resources/info/oldInfo/131/change.csv +278 -0
  506. package/core/resources/info/oldInfo/131/info.json +7 -0
  507. package/core/resources/info/oldInfo/132/change.csv +280 -0
  508. package/core/resources/info/oldInfo/132/info.json +7 -0
  509. package/core/resources/info/oldInfo/133/change.csv +284 -0
  510. package/core/resources/info/oldInfo/133/info.json +7 -0
  511. package/core/resources/info/oldInfo/134/change.csv +286 -0
  512. package/core/resources/info/oldInfo/134/info.json +7 -0
  513. package/core/resources/info/oldInfo/135/change.csv +290 -0
  514. package/core/resources/info/oldInfo/135/info.json +7 -0
  515. package/core/resources/info/oldInfo/136/change.csv +290 -0
  516. package/core/resources/info/oldInfo/136/info.json +7 -0
  517. package/core/resources/info/oldInfo/137/change.csv +293 -0
  518. package/core/resources/info/oldInfo/137/info.json +7 -0
  519. package/core/resources/info/oldInfo/138/change.csv +295 -0
  520. package/core/resources/info/oldInfo/138/info.json +7 -0
  521. package/core/resources/info/oldInfo/139/change.csv +295 -0
  522. package/core/resources/info/oldInfo/139/info.json +7 -0
  523. package/core/resources/info/oldInfo/140/change.csv +298 -0
  524. package/core/resources/info/oldInfo/140/info.json +7 -0
  525. package/core/resources/info/oldInfo/141/change.csv +300 -0
  526. package/core/resources/info/oldInfo/141/info.json +7 -0
  527. package/core/resources/info/oldInfo/142/change.csv +302 -0
  528. package/core/resources/info/oldInfo/142/info.json +7 -0
  529. package/core/resources/info/oldInfo/143/change.csv +303 -0
  530. package/core/resources/info/oldInfo/143/info.json +7 -0
  531. package/core/resources/info/oldInfo/144/change.csv +303 -0
  532. package/core/resources/info/oldInfo/144/info.json +7 -0
  533. package/core/resources/info/oldInfo/145/change.csv +305 -0
  534. package/core/resources/info/oldInfo/145/info.json +7 -0
  535. package/core/resources/info/oldInfo/146/change.csv +305 -0
  536. package/core/resources/info/oldInfo/146/info.json +7 -0
  537. package/core/resources/info/oldInfo/148/change.csv +307 -0
  538. package/core/resources/info/oldInfo/148/info.json +7 -0
  539. package/core/resources/info/oldInfo/149/change.csv +307 -0
  540. package/core/resources/info/oldInfo/149/info.json +7 -0
  541. package/core/resources/info/oldInfo/151/change.csv +309 -0
  542. package/core/resources/info/oldInfo/151/info.json +7 -0
  543. package/core/resources/info/oldInfo/152/change.csv +312 -0
  544. package/core/resources/info/oldInfo/152/info.json +7 -0
  545. package/core/resources/info/oldInfo/153/change.csv +313 -0
  546. package/core/resources/info/oldInfo/153/info.json +7 -0
  547. package/core/resources/info/oldInfo/154/change.csv +315 -0
  548. package/core/resources/info/oldInfo/154/info.json +7 -0
  549. package/core/resources/info/oldInfo/92/change.csv +204 -0
  550. package/core/resources/info/oldInfo/92/info.json +7 -0
  551. package/core/resources/info/oldInfo/93/change.csv +206 -0
  552. package/core/resources/info/oldInfo/93/info.json +7 -0
  553. package/core/resources/info/oldInfo/94/change.csv +209 -0
  554. package/core/resources/info/oldInfo/94/info.json +7 -0
  555. package/core/resources/info/oldInfo/95/change.csv +211 -0
  556. package/core/resources/info/oldInfo/95/info.json +7 -0
  557. package/core/resources/info/oldInfo/96/change.csv +216 -0
  558. package/core/resources/info/oldInfo/96/info.json +7 -0
  559. package/core/resources/info/oldInfo/98/change.csv +216 -0
  560. package/core/resources/info/oldInfo/98/info.json +7 -0
  561. package/core/resources/info/oldInfo/99/change.csv +217 -0
  562. package/core/resources/info/oldInfo/99/info.json +7 -0
  563. package/core/resources/info/oldNotesInfo.json +1 -0
  564. package/core/resources/info/sentences.json +1 -0
  565. package/core/resources/info/spinfo.json +362 -0
  566. package/core/resources/info/tips.txt +278 -0
  567. package/core/resources/otherill//351/233/252/351/231/215SP.png +0 -0
  568. package/core/resources/song-select.html +535 -0
  569. package/core/resources/themes/README.md +24 -0
  570. package/core/resources/themes/milthm/A.png +0 -0
  571. package/core/resources/themes/milthm/B.png +0 -0
  572. package/core/resources/themes/milthm/C.png +0 -0
  573. package/core/resources/themes/milthm/F.png +0 -0
  574. package/core/resources/themes/milthm/FC.png +0 -0
  575. package/core/resources/themes/milthm/S.png +0 -0
  576. package/core/resources/themes/milthm/V.png +0 -0
  577. package/core/resources/themes/milthm/arcgrosB19.css +36 -0
  578. package/core/resources/themes/milthm/b19.art +464 -0
  579. package/core/resources/themes/milthm/b19.css +1314 -0
  580. package/core/resources/themes/milthm/bg.png +0 -0
  581. package/core/resources/themes/milthm/clg.css +37 -0
  582. package/core/resources/themes/milthm/difficultyHistory.css +42 -0
  583. package/core/resources/themes/milthm/font.ttf +0 -0
  584. package/core/resources/themes/milthm/help.css +36 -0
  585. package/core/resources/themes/milthm/historyB30.css +48 -0
  586. package/core/resources/themes/milthm/info.yaml +45 -0
  587. package/core/resources/themes/milthm/list.css +39 -0
  588. package/core/resources/themes/milthm/phi.png +0 -0
  589. package/core/resources/themes/milthm/setting.css +37 -0
  590. package/core/resources/themes/milthm/sign.css +81 -0
  591. package/core/resources/themes/milthm/suggest.css +40 -0
  592. package/core/resources/themes/milthm/table.css +54 -0
  593. package/core/resources/themes/milthm/update.css +68 -0
  594. package/core/tests/aliasProposalService.test.js +82 -0
  595. package/core/tests/apiAccountDeletion.test.js +125 -0
  596. package/core/tests/apiPermission.test.js +44 -0
  597. package/core/tests/apiVersion.test.js +55 -0
  598. package/core/tests/b30Analysis.test.js +38 -0
  599. package/core/tests/backgroundIllustration.test.js +21 -0
  600. package/core/tests/botApiAuthRecovery.test.js +148 -0
  601. package/core/tests/botSyncService.test.js +42 -0
  602. package/core/tests/fileWatcherRegistry.test.js +44 -0
  603. package/core/tests/gameRecordPayload.test.js +34 -0
  604. package/core/tests/guessLetter.test.js +79 -0
  605. package/core/tests/makeRequestHandling.test.js +118 -0
  606. package/core/tests/marketOverflow.test.js +31 -0
  607. package/core/tests/platformTemplateCache.test.js +92 -0
  608. package/core/tests/pluginDataThemePreference.test.js +36 -0
  609. package/core/tests/processCleanup.test.js +58 -0
  610. package/core/tests/puppeteerShutdown.test.js +17 -0
  611. package/core/tests/renderPressureHistory.test.js +59 -0
  612. package/core/tests/saveStats.test.js +26 -0
  613. package/core/tests/themeInstallGuard.test.js +289 -0
  614. package/core/tests/themeManager.test.js +625 -0
  615. package/core/tests/themeManagerInit.test.js +11 -0
  616. package/core/tests/themeMarket.test.js +855 -0
  617. package/core/tests/themePageRouting.test.js +431 -0
  618. package/core/tests/themePolicy.test.js +28 -0
  619. package/core/tests/themeStorageRecovery.test.js +192 -0
  620. package/core/tests/userCredentialModuleBoundaries.test.js +41 -0
  621. package/core/tests/userCredentials.test.js +285 -0
  622. package/core/tsconfig.json +32 -0
  623. package/core/types/vendor.d.ts +14 -0
  624. package/lib/index.cjs +358 -0
  625. package/lib/index.d.cts +182 -0
  626. package/lib/index.d.ts +182 -0
  627. package/lib/index.js +320 -0
  628. package/package.json +74 -0
  629. package/readme.md +3 -0
@@ -0,0 +1,1069 @@
1
+ import readFile from '../filesystem/getFile.js'
2
+ import { DlcInfoPath, configPath, dataPath, imgPath, infoPath, originalIllPath, ortherIllPath, oldInfoPath, pluginResources } from '../filesystem/path.js'
3
+ import path from 'path'
4
+ import Config from '../../components/Config.js'
5
+ import SongsInfo from './SongsInfo.js'
6
+ import fs from 'fs'
7
+ import { allLevel, Level, MAX_DIFFICULTY } from './constNum.js'
8
+ import fCompute from './fCompute.js'
9
+ import logger from '../../components/Logger.js'
10
+ import fileWatcherRegistry from '../../components/FileWatcherRegistry.js'
11
+ import Chart from './Chart.js'
12
+ import Save from '../save/Save.js'
13
+
14
+
15
+ export default new class getInfo {
16
+
17
+
18
+
19
+ /**
20
+ * @typedef csvDifObject
21
+ * @property {idStringWithout0} id 曲目id
22
+ * @property {string} EZ EZ难度
23
+ * @property {string} HD HD难度
24
+ * @property {string} IN IN难度
25
+ * @property {string} [AT] AT难度
26
+ */
27
+
28
+ /**
29
+ * @typedef {Object} updatedChartObject
30
+ * @property {number|number[]|undefined} tap
31
+ * @property {number|number[]|undefined} drag
32
+ * @property {number|number[]|undefined} hold
33
+ * @property {number|number[]|undefined} flick
34
+ * @property {number|number[]|undefined} difficulty
35
+ * @property {number|number[]|undefined} combo
36
+ * @property {boolean|undefined} isNew
37
+ */
38
+
39
+ /**
40
+ * @typedef {object} versionInfoObject
41
+ * @property {string} version_label 版本号
42
+ * @property {number} update_date 版本更新时间戳(秒)
43
+ * @property {string} whatsnew 版本更新内容
44
+ * @property {number} version_code 版本号(整数)
45
+ * @property {string} version 版本号(整数)字符版
46
+ *
47
+ */
48
+
49
+ /**
50
+ * @typedef {{[versionCode: string]: Record<idString, csvDifObject>}} historyDifficultyByVersionObject
51
+ */
52
+
53
+ /**
54
+ * @typedef {Record<idString, {[versionCode: string]: Record<levelKind, number>}>} historyDifficultyBySongIdObject
55
+ */
56
+
57
+ /**
58
+ * @typedef {string & { readonly brand: unique symbol }} kongYouId 空游的id
59
+ *
60
+ * @typedef {Object} kongYouSongListObject
61
+ * @property {idString} id 曲目id
62
+ * @property {kongYouId} kyId 空游id
63
+ * @property {object} videoLink 攻略链接
64
+ * @property {string} videoLink.ez EZ难度攻略链接
65
+ * @property {string} videoLink.hd HD难度攻略链接
66
+ * @property {string} videoLink.in IN难度攻略链接
67
+ * @property {string} videoLink.at AT难度攻略链接
68
+ */
69
+
70
+ constructor() {
71
+ /**
72
+ * 难度映射
73
+ * @type {allLevelKind[]}
74
+ */
75
+ this.allLevel = allLevel
76
+
77
+ /**
78
+ * 难度映射
79
+ * @type {levelKind[]}
80
+ */
81
+ this.Level = Level
82
+
83
+ /**
84
+ * @type {string[]}
85
+ * @description Tips
86
+ */
87
+ this.tips = []
88
+
89
+
90
+ /**
91
+ * @type {{[key:idString]:Partial<SongsInfo> | undefined}}
92
+ * @description 原版信息
93
+ */
94
+ this.ori_info = {}
95
+ /**
96
+ * @type {{[key:idString]:songString}}
97
+ * @description 通过id获取曲名
98
+ */
99
+ this.songsid = {}
100
+ /**
101
+ * @type {{[key:songString]:idString}}
102
+ * @description 原曲名称获取id
103
+ */
104
+ this.idssong = {}
105
+ /**
106
+ * @type {idString[]}
107
+ * @description 含有曲绘的曲目列表,id名称
108
+ */
109
+ this.illlist = []
110
+
111
+ /**
112
+ * @type {{[key:string]: string[]}}
113
+ * @description 章节别名,以别名为key,内容为章节名
114
+ */
115
+ this.chapNick = {}
116
+
117
+ /**
118
+ * 按dif分的info
119
+ * @type {Record<string, Chart[]>}
120
+ */
121
+ this.info_by_difficulty = {}
122
+
123
+
124
+ /**
125
+ * @type {idString[]}
126
+ */
127
+ this.updatedSong = []
128
+
129
+
130
+ /**
131
+ * @type {Record<idString, Partial<Record<levelKind, updatedChartObject>>>}
132
+ */
133
+ this.updatedChart = {}
134
+
135
+ /** @type {{[versionLabel: string]: versionInfoObject}} */
136
+ this.versionInfoByLabel = {}
137
+
138
+ /** @type {{[versionCode: string]: versionInfoObject}} */
139
+ this.versionInfoByCode = {}
140
+
141
+ /** @type {historyDifficultyByVersionObject} */
142
+ this.historyDifficultyByVersion = {}
143
+
144
+ /** @type {historyDifficultyBySongIdObject} */
145
+ this.historyDifficultyBySongId = {}
146
+
147
+ /** @type {Record<string, Record<string, {id: idString, rank: levelKind, difficulty: number}[]>>} */
148
+ this.historyDifficultyByVerDifficulty = {}
149
+
150
+ /**@type {{title: string, code: number, content: string[]}} */
151
+ this.noticeJson = { title: '', code: 0, content: [] }
152
+
153
+ /**@type {Save | null} */
154
+ this.badSave = null;
155
+
156
+
157
+ this.kongYouData = {
158
+ timeStamp: 0,
159
+ songList: [],
160
+ tagsTree: [],
161
+ tagsTop: {},
162
+ }
163
+
164
+ this.initIng = false
165
+ this.reinitRequested = false
166
+
167
+ if (Config.getUserCfg('config', 'watchInfoPath')) {
168
+ this.infoWatcher = fileWatcherRegistry.watch('info:directory', infoPath, () => {
169
+ void this.init().catch(err => logger.error('[phi-plugin]热更新曲目信息失败', err))
170
+ });
171
+ } else {
172
+ void fileWatcherRegistry.close('info:directory')
173
+ }
174
+ }
175
+
176
+ async init() {
177
+ if (!fs.existsSync(path.join(originalIllPath, '.git'))) {
178
+ logger.error(`[phi-plugin] 未下载曲绘文件,建议使用 /phi downill 命令进行下载`)
179
+ }
180
+
181
+ if (this.initIng) {
182
+ this.reinitRequested = true
183
+ return
184
+ }
185
+ this.initIng = true
186
+ this.reinitRequested = false
187
+
188
+ try {
189
+ logger.info(`[phi-plugin]初始化曲目信息`)
190
+
191
+
192
+ this.allLevel = allLevel;
193
+ this.Level = Level;
194
+ this.tips = [];
195
+ this.ori_info = {};
196
+ this.songsid = {};
197
+ this.idssong = {};
198
+ this.illlist = [];
199
+ this.chapNick = {};
200
+ this.info_by_difficulty = {};
201
+ this.updatedSong = [];
202
+ this.updatedChart = {};
203
+ this.versionInfoByLabel = {};
204
+ this.versionInfoByCode = {};
205
+ this.historyDifficultyByVersion = {};
206
+ this.historyDifficultyBySongId = {};
207
+ this.noticeJson = readFile.FileReader(path.join(infoPath, 'notice.json'));
208
+ this.badSave = await readFile.FileReader(path.join(pluginResources, '0608badSave', 'save.json'));
209
+
210
+
211
+ /**
212
+ * @type {Record<string, string[]>}
213
+ * @description 扩增曲目信息
214
+ **/
215
+ this.DLC_Info = {}
216
+ let files = fs.readdirSync(DlcInfoPath).filter(file => file.endsWith('.json'))
217
+ for (const file of files) {
218
+ this.DLC_Info[path.basename(file, '.json')] = await readFile.FileReader(path.join(DlcInfoPath, file))
219
+ }
220
+
221
+ /**
222
+ * @type {string[]}
223
+ * @description 头像id
224
+ */
225
+ this.avatarid = readFile.FileReader(path.join(infoPath, 'avatar.txt')).replace(/\r/g, '').split('\n')
226
+
227
+ /**
228
+ * @type {string[]}
229
+ * @description Tips
230
+ */
231
+ this.tips = await readFile.FileReader(path.join(infoPath, 'tips.txt')).replace(/\r/g, '').split('\n')
232
+
233
+ /**自定义信息 */
234
+ let user_song = Config.getUserCfg('config', 'otherinfo')
235
+ if (Config.getUserCfg('config', 'otherinfo')) {
236
+ for (let i in user_song) {
237
+ if (user_song[i]['illustration_big']) {
238
+ this.illlist.push(user_song[i].song)
239
+ }
240
+ }
241
+ }
242
+
243
+ /**
244
+ * @type {Record<idString, SongsInfo>}
245
+ * @description SP信息
246
+ */
247
+ const sp_json = (await readFile.FileReader(path.join(infoPath, 'spinfo.json')))
248
+
249
+ /**
250
+ * @type {Record<idString, SongsInfo>}
251
+ * @description SP信息
252
+ */
253
+ this.sp_info = {}
254
+
255
+ for (let i of fCompute.objectKeys(sp_json)) {
256
+ const id = /** @type {idString} */(i + '.0');
257
+ this.sp_info[id] = { ...sp_json[i] }
258
+ this.sp_info[id].sp_vis = true
259
+ this.sp_info[id].id = id
260
+ this.idssong[/** @type {songString} */ (/** @type {unknown} */ (i))] = id
261
+ this.idssong[this.sp_info[id].song] = id
262
+ if (this.sp_info[id]?.illustration) {
263
+ this.illlist.push(this.sp_info[id].id)
264
+ }
265
+ }
266
+
267
+ /**最高定数 */
268
+ this.MAX_DIFFICULTY = 0
269
+
270
+ /**
271
+ * 所有曲目曲名列表
272
+ * @type {songString[]}
273
+ */
274
+ this.songlist = []
275
+
276
+ /**
277
+ * 曲目id列表
278
+ * @type {idString[]}
279
+ */
280
+ this.idList = []
281
+
282
+ /**
283
+ * @typedef {Object} notesInfoObject
284
+ * @property {number} m MaxTime
285
+ * @property {[tap: number, drag: number, hold: number, flick: number, tot: number][]} d note分布 [tap,drag,hold,flick,tot]
286
+ * @property {[number,number,number,number]} t note统计 [tap,drag,hold,flick]
287
+ */
288
+ /**
289
+ * note统计
290
+ * @type {{[x:idStringWithout0]:Record<levelKind, notesInfoObject>}}
291
+ */
292
+ let notesInfo = await readFile.FileReader(path.join(infoPath, 'notesInfo.json'))
293
+
294
+
295
+ const historyVersionList = fs.readdirSync(oldInfoPath)
296
+
297
+ /**@type {csvDifObject[]} */
298
+ let oldDif = /**@type {any} */({})
299
+
300
+ let versionCodes = historyVersionList.map(ver => Number(ver))
301
+
302
+ versionCodes = versionCodes.sort((a, b) => a - b)
303
+
304
+ let lastVersionCode = versionCodes[versionCodes.length - 2].toFixed(0)
305
+
306
+ for (let ver of historyVersionList) {
307
+ /**@type {versionInfoObject} */
308
+ const verInfo = await readFile.FileReader(path.join(oldInfoPath, ver, 'info.json'))
309
+ /**@type {csvDifObject[]} */
310
+ const csvDifInfo = await readFile.FileReader(path.join(oldInfoPath, ver, 'change.csv'))
311
+ /**@type {Record<idString, csvDifObject>} */
312
+ const difInfo = {}
313
+ const verCode = Number(ver)
314
+
315
+ if (ver == lastVersionCode) {
316
+ oldDif = csvDifInfo
317
+ }
318
+
319
+ csvDifInfo.forEach(item => {
320
+ difInfo[idWithout0ToIdWith0(item.id)] = item
321
+ })
322
+ this.versionInfoByCode[ver] = verInfo
323
+ this.versionInfoByLabel[verInfo.version_label] = verInfo
324
+
325
+ this.historyDifficultyByVersion[ver] = difInfo
326
+
327
+ this.historyDifficultyByVerDifficulty[ver] = {}
328
+
329
+ const ids = fCompute.objectKeys(difInfo)
330
+
331
+ for (let id of ids) {
332
+ /** @type {Record<levelKind, number>} */
333
+ const dif = /** @type {any} */ ({})
334
+ Level.forEach(level => {
335
+ if (!difInfo[id][level]) return;
336
+ const songDif = Number(difInfo[id][level]);
337
+ dif[level] = songDif;
338
+ if (!this.historyDifficultyByVerDifficulty[ver][songDif.toFixed(1)]) {
339
+ this.historyDifficultyByVerDifficulty[ver][songDif.toFixed(1)] = []
340
+ }
341
+ this.historyDifficultyByVerDifficulty[ver][songDif.toFixed(1)].push({
342
+ id: id,
343
+ rank: level,
344
+ difficulty: songDif
345
+ })
346
+ })
347
+ if (!this.historyDifficultyBySongId[id]) {
348
+ this.historyDifficultyBySongId[id] = {}
349
+ this.historyDifficultyBySongId[id][ver] = dif
350
+ } else {
351
+ this.historyDifficultyBySongId[id][ver] = dif
352
+ }
353
+ }
354
+
355
+ }
356
+
357
+ /**
358
+ * @typedef {Object} csvInfoObject
359
+ * @property {idStringWithout0} id 曲目id
360
+ * @property {songString} song 曲目名称
361
+ * @property {string} composer 作曲
362
+ * @property {string} illustrator 插画师
363
+ * @property {string} EZ EZ难度定数
364
+ * @property {string} HD HD难度定数
365
+ * @property {string} IN IN难度定数
366
+ * @property {string|undefined} AT AT难度定数
367
+ * @property {string} EZC EZ难度谱师
368
+ * @property {string} HDC HD难度谱师
369
+ * @property {string} INC IN难度谱师
370
+ * @property {string|undefined} ATC AT难度谱师
371
+ */
372
+ /**
373
+ * 信息文件
374
+ * @type {csvInfoObject[]}
375
+ */
376
+ let CsvInfo = await readFile.FileReader(path.join(infoPath, 'info.csv'))
377
+ let Jsoninfo = await readFile.FileReader(path.join(infoPath, 'infolist.json'))
378
+
379
+ /**
380
+ * note统计
381
+ * @type {{[x:idStringWithout0]:Record<levelKind, notesInfoObject>}}
382
+ */
383
+ let oldNotes = await readFile.FileReader(path.join(infoPath, 'oldNotesInfo.json'))
384
+ /**
385
+ * @type {Record<idStringWithout0, Partial<Record<levelKind, number>>>}
386
+ */
387
+ let OldDifList = {}
388
+ for (let i in oldDif) {
389
+ OldDifList[oldDif[i].id] = {}
390
+ for (let level of this.Level) {
391
+ if (oldDif[i][level]) {
392
+ OldDifList[oldDif[i].id][level] = Number(oldDif[i][level])
393
+ }
394
+ }
395
+ }
396
+
397
+
398
+ // console.info(CsvInfo, Csvdif, Jsoninfo)
399
+ for (let i = 0; i < CsvInfo.length; i++) {
400
+
401
+ const id = /**@type {idString} */(CsvInfo[i].id + '.0')
402
+ const idWithout0 = CsvInfo[i].id
403
+
404
+ /**比较新曲部分 */
405
+ if (!OldDifList[idWithout0]) {
406
+ this.updatedSong.push(id)
407
+ }
408
+
409
+ switch (idWithout0) {
410
+ case 'AnotherMe.DAAN': {
411
+ CsvInfo[i].song = /** @type {songString} */('Another Me (KALPA)');
412
+ break;
413
+ }
414
+ case 'AnotherMe.NeutralMoon': {
415
+ CsvInfo[i].song = /** @type {songString} */('Another Me (Rising Sun Traxx)');
416
+ break;
417
+ }
418
+ default: {
419
+ break;
420
+ }
421
+ }
422
+
423
+
424
+ this.songsid[id] = CsvInfo[i].song
425
+ this.idssong[CsvInfo[i].song] = id
426
+
427
+ this.ori_info[id] = { ...Jsoninfo[CsvInfo[i].id] }
428
+ if (!this.ori_info[id]) {
429
+ this.ori_info[id] = { chapter: '', bpm: '', length: '' }
430
+ logger.mark(`[phi-plugin]曲目详情未更新:${id}`)
431
+ }
432
+
433
+ this.ori_info[id].id = id
434
+ this.ori_info[id].song = CsvInfo[i].song
435
+ this.ori_info[id].composer = CsvInfo[i].composer
436
+ this.ori_info[id].illustrator = CsvInfo[i].illustrator
437
+ this.ori_info[id].chart = {}
438
+ for (let level of this.Level) {
439
+
440
+ if (CsvInfo[i][level]) {
441
+
442
+ if (!this.ori_info[id].chart) {
443
+ this.ori_info[id].chart = {}
444
+ }
445
+
446
+ this.ori_info[id].chart[level] = {
447
+ id: id,
448
+ rank: level,
449
+ charter: CsvInfo[i][/**@type {levelKind} */(level + "C")] || '',
450
+ difficulty: Number(CsvInfo[i][level]),
451
+ tap: notesInfo[idWithout0][level].t[0],
452
+ drag: notesInfo[idWithout0][level].t[1],
453
+ hold: notesInfo[idWithout0][level].t[2],
454
+ flick: notesInfo[idWithout0][level].t[3],
455
+ combo: notesInfo[idWithout0][level].t[0] + notesInfo[idWithout0][level].t[1] + notesInfo[idWithout0][level].t[2] + notesInfo[idWithout0][level].t[3],
456
+ maxTime: notesInfo[idWithout0][level].m,
457
+ distribution: notesInfo[idWithout0][level].d
458
+ }
459
+
460
+ /**比较新曲部分 */
461
+ if (OldDifList[idWithout0]) {
462
+ if (!OldDifList[idWithout0][level] || OldDifList[idWithout0][level] != this.ori_info[id].chart[level].difficulty || JSON.stringify(oldNotes[idWithout0][level].t) != JSON.stringify(notesInfo[idWithout0][level].t)) {
463
+ /**
464
+ * @type {updatedChartObject}
465
+ */
466
+ let tem = {
467
+ tap: undefined,
468
+ drag: undefined,
469
+ hold: undefined,
470
+ flick: undefined,
471
+ difficulty: undefined,
472
+ combo: undefined,
473
+ isNew: undefined
474
+ }
475
+ if (!OldDifList[CsvInfo[i].id][level]) {
476
+ Object.assign(tem, {
477
+ tap: notesInfo[idWithout0][level].t[0],
478
+ drag: notesInfo[idWithout0][level].t[1],
479
+ hold: notesInfo[idWithout0][level].t[2],
480
+ flick: notesInfo[idWithout0][level].t[3],
481
+ difficulty: this.ori_info[id].chart[level].difficulty,
482
+ combo: notesInfo[idWithout0][level].t[0] + notesInfo[idWithout0][level].t[1] + notesInfo[idWithout0][level].t[2] + notesInfo[idWithout0][level].t[3],
483
+ isNew: true
484
+ })
485
+ } else {
486
+ if (OldDifList[idWithout0][level] != this.ori_info[id].chart[level].difficulty) {
487
+ Object.assign(tem, { difficulty: [OldDifList[idWithout0][level], this.ori_info[id].chart[level].difficulty] })
488
+ }
489
+ if (oldNotes[idWithout0][level].t[0] != notesInfo[idWithout0][level].t[0]) {
490
+ Object.assign(tem, { tap: [oldNotes[idWithout0][level].t[0], notesInfo[idWithout0][level].t[0]] })
491
+ }
492
+ if (oldNotes[idWithout0][level].t[1] != notesInfo[idWithout0][level].t[1]) {
493
+ Object.assign(tem, { drag: [oldNotes[idWithout0][level].t[1], notesInfo[idWithout0][level].t[1]] })
494
+ }
495
+ if (oldNotes[idWithout0][level].t[2] != notesInfo[idWithout0][level].t[2]) {
496
+ Object.assign(tem, { hold: [oldNotes[idWithout0][level].t[2], notesInfo[idWithout0][level].t[2]] })
497
+ }
498
+ if (oldNotes[idWithout0][level].t[3] != notesInfo[idWithout0][level].t[3]) {
499
+ Object.assign(tem, { flick: [oldNotes[idWithout0][level].t[3], notesInfo[idWithout0][level].t[3]] })
500
+ }
501
+ let oldCombo = oldNotes[idWithout0][level].t[0] + oldNotes[idWithout0][level].t[1] + oldNotes[idWithout0][level].t[2] + oldNotes[idWithout0][level].t[3]
502
+ let newCombo = notesInfo[idWithout0][level].t[0] + notesInfo[idWithout0][level].t[1] + notesInfo[idWithout0][level].t[2] + notesInfo[idWithout0][level].t[3]
503
+ if (oldCombo != newCombo) {
504
+ Object.assign(tem, { combo: [oldCombo, newCombo] })
505
+ }
506
+ }
507
+ if (!this.updatedChart[id]) {
508
+ this.updatedChart[id] = {}
509
+ }
510
+ this.updatedChart[id][level] = tem
511
+ }
512
+ }
513
+
514
+
515
+ /**最高定数 */
516
+ this.MAX_DIFFICULTY = Math.max(this.MAX_DIFFICULTY, this.ori_info[id].chart[level].difficulty)
517
+ }
518
+ }
519
+ if (Jsoninfo[idWithout0]?.chart) {
520
+ this.ori_info[id].chart = { ...this.ori_info[id].chart, ...Jsoninfo[idWithout0].chart }
521
+ }
522
+ this.illlist.push(id)
523
+ this.songlist.push(this.ori_info[id].song)
524
+ this.idList.push(id)
525
+ }
526
+
527
+
528
+ if (this.MAX_DIFFICULTY != MAX_DIFFICULTY) {
529
+ console.error('[phi-plugin] MAX_DIFFICULTY 常量未更新,请回报作者!', MAX_DIFFICULTY, this.MAX_DIFFICULTY)
530
+ }
531
+
532
+ /**
533
+ * 曲目别名列表 (id不带.0)
534
+ * @type {Record<idStringWithout0, string[]>}
535
+ */
536
+ let nicklistTemp = await readFile.FileReader(path.join(infoPath, 'nicklist.yaml')) || {}
537
+ this.baseNicklist = /** @type {Record<idStringWithout0, string[]>} */ (structuredClone(nicklistTemp))
538
+ this.approvedNicklist = /** @type {Record<idStringWithout0, string[]>} */ (
539
+ await readFile.FileReader(path.join(dataPath, 'alias', 'approved-nicklist.yaml')) || {}
540
+ )
541
+ /**
542
+ * 默认别名,以id为key
543
+ * @type {Record<idString, string[]>}
544
+ **/
545
+ this.nicklist = {}
546
+ /**
547
+ * 以别名为key
548
+ * @type {Record<string, idString[]>}
549
+ */
550
+ this.songnick = {}
551
+
552
+
553
+ this.rebuildAliasIndex()
554
+
555
+ /**
556
+ * @type {{[key:string]: string[]}}
557
+ * @description 章节列表,以章节名为key,内容为别名
558
+ */
559
+ this.chapList = await readFile.FileReader(path.join(infoPath, 'chaplist.yaml'))
560
+
561
+ for (let i in this.chapList) {
562
+ for (let item of this.chapList[i]) {
563
+ if (this.chapNick[item]) {
564
+ this.chapNick[item].push(i)
565
+ } else {
566
+ this.chapNick[item] = [i]
567
+ }
568
+ }
569
+ }
570
+
571
+ /**
572
+ * jrrp
573
+ * @type {Record<'good'|'bad'|'common', string[]>}
574
+ */
575
+ this.word = await readFile.FileReader(path.join(infoPath, 'jrrp.json'))
576
+
577
+ for (let songId of this.idList) {
578
+ for (let level of this.allLevel) {
579
+ let info = this.ori_info[songId]
580
+ if (!info?.chart?.[level]?.difficulty) continue;
581
+ const difStr = info.chart[level].difficulty.toFixed(1);
582
+ if (this.info_by_difficulty[difStr]) {
583
+ this.info_by_difficulty[difStr].push({
584
+ ...info.chart[level],
585
+ })
586
+ } else {
587
+ this.info_by_difficulty[difStr] = [{
588
+ ...info.chart[level],
589
+ }]
590
+ }
591
+ }
592
+ }
593
+
594
+
595
+
596
+ logger.info(`[phi-plugin]初始化曲目信息完成`)
597
+ } finally {
598
+ this.initIng = false
599
+ if (this.reinitRequested) {
600
+ this.reinitRequested = false
601
+ queueMicrotask(() => {
602
+ void this.init().catch(err => logger.error('[phi-plugin]补跑曲目信息初始化失败', err))
603
+ })
604
+ }
605
+ }
606
+ }
607
+
608
+ /** 关闭曲库目录监听器。 */
609
+ async close() {
610
+ const watcherLease = this.infoWatcher
611
+ this.infoWatcher = undefined
612
+ if (watcherLease) await watcherLease.close()
613
+ }
614
+
615
+ /**
616
+ * 以“内置别名 + Approved 快照”的顺序重建运行时索引。
617
+ * 同一曲目的重复别名按不区分大小写去重,远端快照删除后不会残留。
618
+ * @returns {void}
619
+ */
620
+ rebuildAliasIndex() {
621
+ this.nicklist = {}
622
+ this.songnick = {}
623
+ /** @type {Array<Record<idStringWithout0, string[]>>} */
624
+ const layers = [this.baseNicklist || {}, this.approvedNicklist || {}]
625
+ for (const layer of layers) {
626
+ for (const rawId of Object.keys(layer)) {
627
+ const idWithout0 = /** @type {idStringWithout0} */ (rawId)
628
+ const id = idWithout0ToIdWith0(idWithout0)
629
+ const aliases = Array.isArray(layer[idWithout0]) ? layer[idWithout0] : []
630
+ this.nicklist[id] ||= []
631
+ for (const rawAlias of aliases) {
632
+ const alias = String(rawAlias).trim()
633
+ if (!alias) continue
634
+ if (!this.nicklist[id].some(item => item.toLowerCase() === alias.toLowerCase())) {
635
+ this.nicklist[id].push(alias)
636
+ }
637
+ this.songnick[alias] ||= []
638
+ if (!this.songnick[alias].includes(id)) this.songnick[alias].push(id)
639
+ }
640
+ }
641
+ }
642
+ }
643
+
644
+ /**
645
+ * 原子快照落盘成功后替换 Approved 内存层并立即重建索引。
646
+ * @param {Record<string, string[]>} snapshot 已严格校验的公开 YAML 数据
647
+ * @returns {void}
648
+ */
649
+ setApprovedAliasSnapshot(snapshot) {
650
+ this.approvedNicklist = /** @type {Record<idStringWithout0, string[]>} */ (structuredClone(snapshot || {}))
651
+ this.rebuildAliasIndex()
652
+ }
653
+
654
+ /**
655
+ *
656
+ * @param {idString} id 原曲曲名
657
+ * @param {boolean} [original=false] 仅使用原版
658
+ * @returns {SongsInfo | undefined} 曲目信息对象
659
+ */
660
+ info(id, original = false) {
661
+ let result
662
+ switch (original ? 0 : Config.getUserCfg('config', 'otherinfo')) {
663
+ case 0: {
664
+ result = { ...this.ori_info, ...this.sp_info }
665
+ break;
666
+ }
667
+ case 1: {
668
+ result = { ...this.ori_info, ...this.sp_info, ...Config.getUserCfg('otherinfo') }
669
+ break;
670
+ }
671
+ case 2: {
672
+ result = Config.getUserCfg('otherinfo')
673
+ break;
674
+ }
675
+ }
676
+ return result[id] ? new SongsInfo(result[id]) : undefined
677
+ }
678
+
679
+ /**
680
+ *
681
+ * @param {boolean} [original=false] 仅使用原版
682
+ * @returns {Record<idString, SongsInfo>} 所有曲目信息对象
683
+ */
684
+ all_info(original = false) {
685
+ switch (original ? 0 : Config.getUserCfg('config', 'otherinfo')) {
686
+ case 0: {
687
+ return { ...this.ori_info, ...this.sp_info }
688
+ }
689
+ case 1: {
690
+ return { ...this.ori_info, ...this.sp_info, ...Config.getUserCfg('otherinfo') }
691
+ }
692
+ case 2: {
693
+ return Config.getUserCfg('otherinfo')
694
+ }
695
+ default: {
696
+ return { ...this.ori_info, ...this.sp_info }
697
+ }
698
+ }
699
+ }
700
+
701
+ /**
702
+ * 根据参数模糊匹配返回原曲名称
703
+ * @param {string} mic 别名
704
+ * @param {number} [Distance=0.85] 阈值 猜词0.95
705
+ * @param {boolean} [original=false] 仅使用原版
706
+ * @returns {idString[]} 原曲id数组,按照匹配程度降序
707
+ */
708
+ fuzzysongsnick(mic, Distance = 0.85, original = false) {
709
+ /**为空返回空 */
710
+ if (!mic) return []
711
+ /**
712
+ * 按照匹配程度排序
713
+ * @type {{id: idString, dis: number}[]}
714
+ */
715
+ let result = []
716
+
717
+ const usernick = Config.getUserCfg('nickconfig')
718
+ const allinfo = this.all_info(original)
719
+
720
+ for (let std in this.songnick) {
721
+ let dis = fCompute.jaroWinklerDistance(mic, std)
722
+ if (dis >= Distance) {
723
+ for (let i in this.songnick[std]) {
724
+ result.push({ id: this.songnick[std][i], dis: dis })
725
+ }
726
+ }
727
+ }
728
+
729
+ const ids = fCompute.objectKeys(allinfo);
730
+ for (let std of ids) {
731
+ let dis = fCompute.jaroWinklerDistance(mic, std)
732
+ if (dis >= Distance) {
733
+ result.push({ id: allinfo[std].id, dis: dis })
734
+ }
735
+ if (!allinfo[std]?.id) continue
736
+ dis = fCompute.jaroWinklerDistance(mic, allinfo[std].song)
737
+ if (dis >= Distance) {
738
+ result.push({ id: allinfo[std].id, dis: dis })
739
+ }
740
+ }
741
+
742
+
743
+
744
+ for (let std in usernick) {
745
+ let dis = fCompute.jaroWinklerDistance(mic, std)
746
+ if (dis >= Distance) {
747
+ usernick[std].forEach((id, i) => {
748
+ if (this.info(id) == undefined) return; //过滤无效id
749
+ result.push({ id: usernick[std][i], dis: dis })
750
+ })
751
+ }
752
+ }
753
+
754
+
755
+ result = result.sort((a, b) => b.dis - a.dis)
756
+
757
+ /**
758
+ * @type {idString[]}
759
+ */
760
+ let all = []
761
+ for (let i of result) {
762
+
763
+ if (all.includes(i.id)) continue //去重
764
+ /**如果有完全匹配的曲目则放弃剩下的 */
765
+ if (result[0].dis == 1 && i.dis < 1) break
766
+
767
+
768
+ all.push(i.id)
769
+ }
770
+
771
+ return all
772
+ }
773
+
774
+ /**
775
+ * 设置别名
776
+ * @param {string} mic 原名
777
+ * @param {string} nick 别名
778
+ */
779
+ async setnick(mic, nick) {
780
+ if (!Config.getUserCfg('nickconfig', mic)) {
781
+ Config.modify('nickconfig', nick, [mic])
782
+ } else {
783
+ Config.modifyarr('nickconfig', nick, mic, 'add')
784
+ }
785
+ }
786
+
787
+ /**
788
+ * @typedef {'ill'|'illBlur'|'illLow'|'SP'|'chartimg'|'table'|'chap'} onlinePhiIllType
789
+ * @typedef {{baseUrl: string, dirs: Partial<Record<onlinePhiIllType, string>>}} onlinePhiIllSource
790
+ */
791
+
792
+ /** @type {onlinePhiIllSource & {dirs: Record<onlinePhiIllType, string>}} */
793
+ static defaultOnlinePhiIllSource = {
794
+ baseUrl: 'https://raw.githubusercontent.com/Catrong/phi-plugin-ill/main',
795
+ dirs: {
796
+ ill: 'ill',
797
+ illBlur: 'illBlur',
798
+ illLow: 'illLow',
799
+ SP: 'SP',
800
+ chartimg: 'chartimg',
801
+ table: 'table',
802
+ chap: 'chap'
803
+ }
804
+ }
805
+
806
+ static githubRawHosts = [
807
+ 'raw.githubusercontent.com'
808
+ ]
809
+
810
+ /** @type {Record<1 | 2 | 3 | 4, onlinePhiIllSource>} */
811
+ static onlinePhiIllSources = {
812
+ 1: getInfo.defaultOnlinePhiIllSource,
813
+ 2: {
814
+ baseUrl: 'https://gitee.com/Steveeee-e/phi-plugin-ill/raw/main',
815
+ dirs: {
816
+ ill: 'ill',
817
+ illBlur: 'illBlur',
818
+ illLow: 'illLow',
819
+ SP: 'SP',
820
+ chartimg: 'chartimg',
821
+ table: 'table',
822
+ chap: 'chap'
823
+ }
824
+ },
825
+ 3: {
826
+ baseUrl: 'https://r-0semi.xtower.site',
827
+ dirs: {
828
+ ill: 'illustration',
829
+ illBlur: 'illustrationBlur',
830
+ illLow: 'illustrationLowRes',
831
+ chap: 'chap'
832
+ }
833
+ },
834
+ 4: {
835
+ baseUrl: 'https://cnb.cool/r-0semi/asset-xtower/-/git/raw/master',
836
+ dirs: {
837
+ ill: 'illustration',
838
+ illBlur: 'illustrationBlur',
839
+ illLow: 'illustrationLowRes',
840
+ chap: 'chap'
841
+ }
842
+ }
843
+ }
844
+
845
+ /**
846
+ * @param {unknown} baseUrl
847
+ * @returns {string}
848
+ */
849
+ getOnlinePhiIllBaseUrl(baseUrl) {
850
+ const rawBaseUrl = String(baseUrl || getInfo.defaultOnlinePhiIllSource.baseUrl).replace(/\/$/, '')
851
+ let url
852
+ try {
853
+ url = new URL(rawBaseUrl)
854
+ } catch (err) {
855
+ return rawBaseUrl
856
+ }
857
+ if (!getInfo.githubRawHosts.includes(url.hostname)) {
858
+ return rawBaseUrl
859
+ }
860
+
861
+ const githubProxy = Config.getUserCfg('config', 'githubProxy')
862
+ if (githubProxy === false || githubProxy === 'false' || githubProxy === '') {
863
+ return rawBaseUrl
864
+ }
865
+ if (!githubProxy) {
866
+ return rawBaseUrl
867
+ }
868
+ return `${String(githubProxy).replace(/\/$/, '')}/${rawBaseUrl}`
869
+ }
870
+
871
+ /**
872
+ * @param {onlinePhiIllType} type
873
+ * @param {...string} paths
874
+ * @returns {string}
875
+ */
876
+ getOnlinePhiIllUrl(type, ...paths) {
877
+ const cfg = Config.getUserCfg('config', 'onLinePhiIllUrl')
878
+
879
+ let sourceKey = /**@type {1|2|3|4} */(Number(cfg))
880
+ if (![1, 2, 3, 4].includes(sourceKey)) {
881
+ logger.warn(`[phi-plugin] 无效的在线曲绘源配置:${cfg},将使用默认源`)
882
+ sourceKey = 1;
883
+ }
884
+ const source = getInfo.onlinePhiIllSources[sourceKey]
885
+ const baseSource = source || {
886
+ baseUrl: String(cfg || getInfo.defaultOnlinePhiIllSource.baseUrl),
887
+ dirs: getInfo.defaultOnlinePhiIllSource.dirs
888
+ }
889
+ const dir = baseSource.dirs[type] || getInfo.defaultOnlinePhiIllSource.dirs[type]
890
+ const baseUrl = this.getOnlinePhiIllBaseUrl(baseSource.dirs[type] ? baseSource.baseUrl : getInfo.defaultOnlinePhiIllSource.baseUrl)
891
+ return [baseUrl, dir, ...paths.map(i => encodeURIComponent(i))].join('/')
892
+ }
893
+
894
+
895
+ /**
896
+ * 获取曲绘,返回地址,曲目id
897
+ * @param {idString} id 曲目id,带.0
898
+ * @param {'common'|'blur'|'low'} [kind='common'] 清晰度
899
+ * @return {string} 网址或文件地址
900
+ */
901
+ getill(id, kind = 'common') {
902
+ const songsinfo = this.all_info()[id]
903
+ let ans = songsinfo?.illustration
904
+ let reg = /^(?:(http|https|ftp):\/\/)((?:[\w-]+\.)+[a-z0-9]+)((?:\/[^/?#]*)+)?(\?[^#]+)?(#.+)?$/i
905
+ if (ans && !reg.test(ans)) {
906
+ ans = path.join(ortherIllPath, ans)
907
+ } else if (this.ori_info?.[id] || this.sp_info?.[id]) {
908
+ if (this.ori_info?.[id]) {
909
+ if (fs.existsSync(path.join(originalIllPath, id.replace(/.0$/, '.png')))) {
910
+ ans = path.join(originalIllPath, id.replace(/.0$/, '.png'))
911
+ } else if (fs.existsSync(path.join(originalIllPath, "ill", id.replace(/.0$/, '.png')))) {
912
+ if (kind == 'common') {
913
+ ans = path.join(originalIllPath, "ill", id.replace(/.0$/, '.png'))
914
+ } else if (kind == 'blur') {
915
+ ans = path.join(originalIllPath, "illBlur", id.replace(/.0$/, '.png'))
916
+ } else if (kind == 'low') {
917
+ ans = path.join(originalIllPath, "illLow", id.replace(/.0$/, '.png'))
918
+ }
919
+ } else {
920
+ if (kind == 'common') {
921
+ ans = this.getOnlinePhiIllUrl('ill', id.replace(/.0$/, '.png'))
922
+ } else if (kind == 'blur') {
923
+ ans = this.getOnlinePhiIllUrl('illBlur', id.replace(/.0$/, '.png'))
924
+ } else if (kind == 'low') {
925
+ ans = this.getOnlinePhiIllUrl('illLow', id.replace(/.0$/, '.png'))
926
+ }
927
+ }
928
+ } else {
929
+ if (fs.existsSync(path.join(originalIllPath, "SP", songsinfo.id.replace(/.0$/, '.png')))) {
930
+ ans = path.join(originalIllPath, "SP", songsinfo.id.replace(/.0$/, '.png'))
931
+ } else {
932
+ ans = this.getOnlinePhiIllUrl('SP', songsinfo.id.replace(/.0$/, '.png'))
933
+ }
934
+ }
935
+ } else if (ans) {
936
+ ans = path.join(ortherIllPath, ans)
937
+ }
938
+ if (!ans) {
939
+ logger.warn(id, '背景不存在')
940
+ ans = path.join(imgPath, 'phigros.png')
941
+ }
942
+ return ans
943
+ }
944
+
945
+ /**
946
+ *
947
+ * @param {idString} songId
948
+ * @param {levelKind} dif
949
+ */
950
+ getChartImg(songId, dif) {
951
+ const id = songId.replace(/.0$/, '');
952
+ if (fs.existsSync(path.join(originalIllPath, "chartimg", dif, `${id}.png`))) {
953
+ return path.join(originalIllPath, "chartimg", dif, `${id}.png`)
954
+ } else {
955
+ return this.getOnlinePhiIllUrl('chartimg', dif, `${id}.png`)
956
+ }
957
+ }
958
+
959
+ /**
960
+ * 返回定数表图片 url
961
+ * @param {number} dif 难度
962
+ */
963
+ getTableImg(dif) {
964
+ if (fs.existsSync(path.join(originalIllPath, "table", `${dif}.png`))) {
965
+ return path.join(originalIllPath, "table", `${dif}.png`)
966
+ } else {
967
+ return this.getOnlinePhiIllUrl('table', `${dif}.png`)
968
+ }
969
+ }
970
+
971
+ /**
972
+ * 返回章节封面 url
973
+ * @param {string} name 标准章节名
974
+ */
975
+ getChapIll(name) {
976
+ if (fs.existsSync(path.join(originalIllPath, "chap", `${name}.png`))) {
977
+ return path.join(originalIllPath, "chap", `${name}.png`)
978
+ } else {
979
+ return this.getOnlinePhiIllUrl('chap', `${name}.png`)
980
+ }
981
+ }
982
+
983
+ /**
984
+ * 通过id获得头像文件名称
985
+ * @param {string} id
986
+ * @returns file name
987
+ */
988
+ idgetavatar(id) {
989
+ if (this.avatarid?.includes(id)) {
990
+ if (id == "Cipher : /2&//<|0") {
991
+ return "Cipher1"
992
+ }
993
+ if (id == "Oblivion: PHIN") {
994
+ return "OblivionPHIN"
995
+ }
996
+ return id
997
+ } else {
998
+ return 'Introduction'
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ * 根据曲目id获取原名
1004
+ * @param {idString} id 曲目id
1005
+ * @returns {songString | undefined} 原名
1006
+ */
1007
+ idgetsong(id) {
1008
+ return this.songsid?.[id]
1009
+ }
1010
+
1011
+ /**
1012
+ * 通过原曲曲目获取曲目id
1013
+ * @param {songString} song 原曲曲名
1014
+ * @returns {idString | undefined} 曲目id
1015
+ */
1016
+ SongGetId(song) {
1017
+ return this.idssong?.[song]
1018
+ }
1019
+
1020
+ /**
1021
+ * 获取角色介绍背景曲绘
1022
+ * @param {string} save_background
1023
+ * @returns
1024
+ */
1025
+ getBackground(save_background) {
1026
+ try {
1027
+ switch (save_background) {
1028
+ case 'Another Me ': {
1029
+ save_background = 'Another Me (KALPA)'
1030
+ break
1031
+ }
1032
+ case 'Another Me': {
1033
+ save_background = 'Another Me (Rising Sun Traxx)'
1034
+ break
1035
+ }
1036
+ case 'Re_Nascence (Psystyle Ver.) ': {
1037
+ save_background = 'Re_Nascence (Psystyle Ver.)'
1038
+ break
1039
+ }
1040
+ case 'Energy Synergy Matrix': {
1041
+ save_background = 'ENERGY SYNERGY MATRIX'
1042
+ break
1043
+ }
1044
+ case 'Le temps perdu-': {
1045
+ save_background = 'Le temps perdu'
1046
+ break
1047
+ }
1048
+ default: {
1049
+ break
1050
+ }
1051
+ }
1052
+ // @ts-ignore
1053
+ return this.getill(this.SongGetId(save_background) || save_background)
1054
+ } catch (err) {
1055
+ logger.error(`获取背景曲绘错误`, err)
1056
+ return 'Introduction';
1057
+ }
1058
+ }
1059
+
1060
+ }()
1061
+
1062
+ /**
1063
+ *
1064
+ * @param {idStringWithout0} idWithout0
1065
+ * @returns {idString}
1066
+ */
1067
+ function idWithout0ToIdWith0(idWithout0) {
1068
+ return /** @type {idString} */(idWithout0 + '.0')
1069
+ }