@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,831 @@
1
+ /**Phigros出字母猜曲名游戏
2
+ * 会随机抽选 n 首歌曲
3
+ * 每首曲目的名字只显示一部分,剩下的部分隐藏
4
+ * 通过给出的字母猜出相应的歌曲
5
+ * 玩家可以翻开所有曲目响应的字母获得更多线索
6
+ */
7
+ import { pinyin } from 'pinyin-pro'
8
+
9
+ import Config from '../../components/Config.js'
10
+ import send from '../../model/render/send.js'
11
+ import getInfo from '../../model/game/getInfo.js'
12
+ import getPic from '../../model/render/getPic.js'
13
+ import fCompute from '../../model/game/fCompute.js'
14
+ import picmodle from '../../model/render/picmodle.js'
15
+ import logger from '../../components/Logger.js'
16
+ import segment from '../../components/segment.js'
17
+ import {
18
+ LETTER_HIDDEN_CHAR,
19
+ allGuessed,
20
+ encryptSongName,
21
+ getRevealCandidates,
22
+ hasHiddenCharacters,
23
+ revealCharacter
24
+ } from './letterGameUtils.js'
25
+
26
+ /**
27
+ * @type {idString[]}
28
+ */
29
+ let songIdList = getInfo.idList || []
30
+ /**
31
+ * 存储每首歌曲被抽取的权重
32
+ * @type {Record<string, Record<idString, number>>}
33
+ */
34
+ let songweights = {}
35
+
36
+ /** @type {Record<string, NodeJS.Timeout>} */
37
+ const songweightCleanupTimers = {}
38
+ const SONGWEIGHT_IDLE_TTL = 60 * 60 * 1000
39
+
40
+ /** @param {string} groupId */
41
+ function scheduleSongweightCleanup(groupId) {
42
+ if (songweightCleanupTimers[groupId]) clearTimeout(songweightCleanupTimers[groupId])
43
+ songweightCleanupTimers[groupId] = setTimeout(() => {
44
+ delete songweights[groupId]
45
+ delete songweightCleanupTimers[groupId]
46
+ }, SONGWEIGHT_IDLE_TTL)
47
+ songweightCleanupTimers[groupId].unref?.()
48
+ }
49
+
50
+ /**
51
+ * @param {string} groupId
52
+ * @param {GameList} gameList
53
+ */
54
+ function cleanupGameState(groupId, gameList) {
55
+ delete letterGameData[groupId]
56
+ delete gameList[groupId]
57
+ delete timeCount[groupId]
58
+ }
59
+
60
+ /**
61
+ * @typedef {{ansList: string[], winnerlist: string[]}} LetterGameResult
62
+ */
63
+
64
+ // let gamelist = {}//存储标准答案曲名
65
+ // let blurlist = {}//存储模糊后的曲名
66
+ // let alphalist = {}//存储翻开的字母
67
+ // let winnerlist = {} //存储猜对者的群名称
68
+ // let lastGuessedTime = {} //存储群聊猜字母全局冷却时间
69
+ // let lastRevealedTime = {} //存储群聊翻字母全局冷却时间
70
+ // let lastTipTime = {} //存储群聊提示全局冷却时间
71
+ // let gameSelectList = {} //群聊游戏选择的游戏范围
72
+
73
+
74
+ class letterGameDataObject {
75
+ /**
76
+ * 单个群聊开字母游戏数据对象
77
+ * @param {number} letterNum 曲目数量
78
+ */
79
+ constructor(letterNum = 8) {
80
+ /**
81
+ * 曲目数量
82
+ * @type {number}
83
+ */
84
+ this.letterNum = letterNum
85
+ /**
86
+ * 答案曲名列表
87
+ * @type {songString[]}
88
+ **/
89
+ this.ansList = new Array(letterNum).fill('')
90
+ /**
91
+ * 曲目ID列表
92
+ * @type {idString[]}
93
+ */
94
+ this.ansIdList = new Array(letterNum).fill('')
95
+ /**
96
+ * 模糊后的曲名列表
97
+ * @type {(string|null)[]}
98
+ */
99
+ this.blurlist = new Array(letterNum).fill('')
100
+ /**
101
+ * 猜对者列表
102
+ * @type {string[]}
103
+ */
104
+ this.winnerlist = new Array(letterNum).fill('')
105
+ /**
106
+ * 翻开的字母列表
107
+ * @type {string[]}
108
+ */
109
+ this.alphalist = []
110
+ /**
111
+ * 上次猜测时间
112
+ * @type {number}
113
+ */
114
+ this.lastGuessedTime = 0
115
+ /**
116
+ * 上次翻开时间
117
+ * @type {number}
118
+ */
119
+ this.lastRevealedTime = 0
120
+ /**
121
+ * 上次提示时间
122
+ * @type {number}
123
+ */
124
+ this.lastTipTime = 0
125
+ /**
126
+ * 游戏选择的范围
127
+ * @type {string[]}
128
+ */
129
+ this.gameSelectList = []
130
+ }
131
+ }
132
+
133
+
134
+ /**@type {Record<string, letterGameDataObject>} */
135
+ const letterGameData = {}
136
+
137
+ /**
138
+ * 存储群聊游戏计时器
139
+ * @type {Object.<string, {startTime: number, newTime: number}>}
140
+ */
141
+ let timeCount = {}
142
+
143
+
144
+ /**
145
+ * @import {GameList} from '../guessGame.js'
146
+ */
147
+
148
+ export default class guessLetter {
149
+ /**
150
+ * 发起出字母猜歌
151
+ * @param {any} e 事件对象
152
+ * @param {GameList} gameList 进行中的游戏列表
153
+ */
154
+ static async start(e, gameList) {
155
+ const { group_id } = e // 使用对象解构提取group_id
156
+
157
+ if (letterGameData[group_id]) {
158
+ send.reply(e, `喂喂喂,已经有群友发起出字母猜歌啦,不要再重复发起了,赶快输入'/第X个XXXX'来猜曲名或者'/出X'来揭开字母吧!结束请发 /${Config.getUserCfg('config', 'cmdhead')} ans 嗷!`, true)
159
+ return true
160
+ }
161
+
162
+ let { msg } = e // 提取消息
163
+ msg = msg.replace(/[#/](.*?)(ltr|letter|开字母)(\s*)/, "")
164
+
165
+ /**
166
+ * 其他游戏的曲目
167
+ * @type {idString[]}
168
+ */
169
+ let allSelectSongId = []
170
+ // console.info(getInfo.DLC_Info)
171
+
172
+ // 初始化游戏数据对象
173
+ letterGameData[group_id] = new letterGameDataObject(Config.getUserCfg('config', 'LetterNum'));
174
+
175
+ const currentGame = letterGameData[group_id];
176
+
177
+ for (let i in getInfo.DLC_Info) {
178
+ if (msg.includes(i)) {
179
+ letterGameData[group_id].gameSelectList.push(i)
180
+ allSelectSongId = allSelectSongId.concat(/**@type {idString[]} */(getInfo.DLC_Info[i]))
181
+ }
182
+ }
183
+
184
+ if (letterGameData[group_id].gameSelectList.length == 0) {
185
+ letterGameData[group_id].gameSelectList = ['pgr']
186
+ allSelectSongId = [...songIdList]
187
+ }
188
+
189
+ if (allSelectSongId.length < Config.getUserCfg('config', 'LetterNum')) {
190
+ send.reply(e, "曲库中曲目的数量小于开字母的条数哦!更改曲库后需要重启哦!")
191
+ cleanupGameState(group_id, gameList)
192
+ return true
193
+ }
194
+
195
+
196
+ if (!songweights[group_id]) {
197
+ songweights[group_id] = {}
198
+ }
199
+
200
+ // 将每一首曲目的权重初始化为1
201
+ allSelectSongId.forEach(id => {
202
+ if (!songweights[group_id][id]) {
203
+ songweights[group_id][id] = 1
204
+ } else {
205
+ songweights[group_id][id] *= 1.1 // 每次游戏权重增加10%,防止浮点数过小
206
+ songweights[group_id][id] = Math.min(songweights[group_id][id], 5) // 权重上限5
207
+ }
208
+ })
209
+ scheduleSongweightCleanup(group_id)
210
+
211
+ let nowTime = Date.now()
212
+
213
+ for (let i = 0; i < currentGame.letterNum; i++) {
214
+ // 根据曲目权重随机返回一首曲目名称
215
+ let randId = getRandomSong(e, allSelectSongId)
216
+
217
+ // 防止抽到重复的曲目
218
+ let cnnt = 0
219
+ while (currentGame.ansIdList.includes(randId) || getInfo.info(randId)?.can_t_be_letter) {
220
+ ++cnnt
221
+ if (cnnt >= 50) {
222
+ logger.error(`[phi-plugin][letter]抽取曲目失败,请检查曲库设置`)
223
+ send.reply(e, `抽取曲目失败,请检查曲库设置`)
224
+ cleanupGameState(group_id, gameList)
225
+ return
226
+ }
227
+ randId = getRandomSong(e, allSelectSongId)
228
+ }
229
+ const songs_info = getInfo.info(randId)
230
+
231
+ /**@type {songString} */
232
+ const song_name = songs_info?.song ? songs_info.song :/**@type {any} */ (randId)
233
+
234
+ currentGame.ansIdList[i] = randId
235
+ currentGame.ansList[i] = song_name
236
+ currentGame.blurlist[i] = encryptSongName(song_name)
237
+ gameList[group_id] = { gameType: "guessLetter" }
238
+ timeCount[group_id] = {
239
+ startTime: nowTime,
240
+ newTime: Date.now() + (1000 * Config.getUserCfg('config', 'LetterTimeLength'))
241
+ }
242
+
243
+ }
244
+
245
+ // 输出提示信息
246
+ send.reply(e, `开字母开启成功!回复'/nX. XXXX'命令猜歌,例如:/n1. Reimei;发送'/open X'来揭开字母(不区分大小写,不需要指令头),如'/open A';发送'/${Config.getUserCfg('config', 'cmdhead')} ans'结束并查看答案哦!`)
247
+
248
+ // 延时1s
249
+ await timeout(1 * 1000)
250
+
251
+ await tryToSendMd(e, (t) => ['开字母进行中:', getPuzzle(currentGame, t)].join('\n'));
252
+
253
+ /**如果过长时间没人回答则结束 */
254
+ while (timeCount[group_id]?.startTime == nowTime && Date.now() < timeCount[group_id].newTime) {
255
+ await timeout(1000)
256
+ }
257
+
258
+ if (!letterGameData[group_id] || nowTime !== timeCount[group_id]?.startTime) {
259
+ return false
260
+ }
261
+
262
+ if (letterGameData[group_id]) {
263
+ await send.reply(e, '呜,怎么还没有人答对啊QAQ!只能说答案了喵……')
264
+ const result = finishGame(group_id, gameList)
265
+ if (result) {
266
+ await tryToSendMd(e, (t) => formatGameover(result, t));
267
+ }
268
+
269
+ return true
270
+ }
271
+ return true
272
+ }
273
+
274
+ /**
275
+ * 翻开字母
276
+ * @param {any} e 事件对象
277
+ * @param {GameList} gameList 进行中的游戏列表
278
+ */
279
+ static async reveal(e, gameList) {
280
+ const { group_id, msg } = e
281
+
282
+ const currentGame = letterGameData[group_id];
283
+ if (!currentGame) {
284
+ send.reply(e, `现在还没有进行的开字母捏,赶快输入'/${Config.getUserCfg('config', 'cmdhead')} ltr'开始新的一局吧!`, true)
285
+ return false
286
+ }
287
+
288
+ if (timeCount[group_id]) {
289
+ timeCount[group_id].newTime = Date.now() + (1000 * Config.getUserCfg('config', 'LetterTimeLength'))
290
+ }
291
+
292
+ const time = Config.getUserCfg('config', 'LetterRevealCd')
293
+ const currentTime = Date.now()
294
+ const timetik = currentTime - currentGame.lastRevealedTime
295
+ const timeleft = Math.floor((1000 * time - timetik) / 1000)
296
+
297
+ if (timetik < 1000 * time) {
298
+ send.reply(e, `翻字符的全局冷却时间还有${timeleft}s呐,先耐心等下哇QAQ`, true)
299
+ return true
300
+ }
301
+
302
+ currentGame.lastRevealedTime = currentTime
303
+ /**@type {string} */
304
+ const newMsg = msg.replace(/([#/](出|开|翻|揭|看|翻开|打开|揭开|open)|\s*)/g, '').match(/./)?.[0]
305
+
306
+ if (newMsg) {
307
+ const letter = newMsg.toLowerCase()
308
+ let output = []
309
+ let included = false
310
+
311
+ if (currentGame.alphalist.includes(letter.toUpperCase())) {
312
+ send.reply(e, `字符[ ${letter} ]已经被打开过了ww,不用需要再重复开啦!`, true)
313
+ return true
314
+ }
315
+
316
+ for (let i in currentGame.ansList) {
317
+ const songname = currentGame.ansList[i]
318
+ const blurname = currentGame.blurlist[i]
319
+ let characters = ''
320
+ let letters = ''
321
+
322
+ if (/[\u4e00-\u9fa5]/.test(songname)) {
323
+ characters = [...songname].filter(char => /[\u4e00-\u9fa5]/.test(char)).join("")
324
+ letters = pinyin(characters, { pattern: 'first', toneType: 'none', type: 'string' })
325
+ }
326
+
327
+ if (!songname.toLowerCase().includes(letter) && !letters.includes(letter)) {
328
+ continue
329
+ }
330
+
331
+ included = true
332
+
333
+ if (!blurname) {
334
+ continue
335
+ }
336
+
337
+ const newBlurname = revealCharacter(songname, blurname, letter)
338
+
339
+ currentGame.blurlist[i] = newBlurname
340
+
341
+ if (!hasHiddenCharacters(newBlurname)) {
342
+ currentGame.blurlist[i] = null;
343
+ }
344
+ }
345
+
346
+ if (included) {
347
+ currentGame.alphalist = currentGame.alphalist || []
348
+ currentGame.alphalist.push(/^[A-Za-z]+$/g.test(letter) ? letter.toUpperCase() : letter)
349
+ output.push(`成功翻开字母[ ${letter} ]`)
350
+ } else {
351
+ output.push(`这几首曲目中不包含字母[ ${letter} ]`)
352
+ }
353
+
354
+ const opened = '当前所有翻开的字符[' + currentGame.alphalist.join(' ') + ']'
355
+
356
+ output.push(opened)
357
+
358
+ const isEmpty = allGuessed(currentGame);
359
+ if (!isEmpty) {
360
+ await tryToSendMd(e, (t) => [...output, '开字母进行中:', getPuzzle(currentGame, t)].join('\n'));
361
+ } else {
362
+ const result = finishGame(group_id, gameList)
363
+ if (result) {
364
+ await tryToSendMd(e, (t) => ['所有字母已翻开,答案如下:', ...output, formatGameover(result, t)].join('\n'));
365
+ }
366
+ }
367
+
368
+ return true
369
+ }
370
+ return false
371
+ }
372
+
373
+ /**
374
+ * 猜测
375
+ * @param {any} e 事件对象
376
+ * @param {GameList} gameList 进行中的游戏列表
377
+ */
378
+ static async guess(e, gameList) {
379
+ const { group_id, msg, user_id, sender } = e //使用对象解构提取group_id,msg,user_id和sender
380
+ const currentGame = letterGameData[group_id];
381
+ //必须已经开始了一局
382
+ if (!currentGame) {
383
+ /**未进行游戏放过命令 */
384
+ return false
385
+ }
386
+
387
+ if (timeCount[group_id]) {
388
+ timeCount[group_id].newTime = Date.now() + (1000 * Config.getUserCfg('config', 'LetterTimeLength'))
389
+ }
390
+
391
+ const time = Config.getUserCfg('config', 'LetterGuessCd')
392
+ const currentTime = Date.now()
393
+ const timetik = currentTime - currentGame.lastGuessedTime
394
+ const timeleft = Math.floor((1000 * time - timetik) / 1000)
395
+
396
+ //上一轮猜测的Cd还没过
397
+ if (timetik < 1000 * time) {
398
+ send.reply(e, `猜测的冷却时间还有${timeleft}s呐,先耐心等下哇QAQ`, true)
399
+ return true
400
+ }
401
+
402
+ //上一轮Cd结束,更新新一轮的时间戳
403
+ currentGame.lastGuessedTime = currentTime
404
+
405
+ const opened = `\n所有翻开的字母[ ${currentGame.alphalist.join(' ')}]\n`
406
+ const regex = /^[#/]\s*[第n]\s*(\d+|[一二三四五六七八九十百]+)\s*[个首\.]?(.*)$/
407
+ /**
408
+ * [0] 完整匹配
409
+ * [1] Num
410
+ * [2] ans
411
+ * [3] index
412
+ * [4] input
413
+ * [5] groups
414
+ */
415
+ const result = msg.match(regex)
416
+
417
+ if (!result) {
418
+ /**格式匹配错误放过命令 */
419
+ return false
420
+ }
421
+
422
+ /**
423
+ * @type {string[]}
424
+ */
425
+ const output = []
426
+ let num = 0
427
+
428
+ if (isNaN(result[1])) {
429
+ num = NumberToArabic(result[1])
430
+ } else {
431
+ num = Number(result[1])
432
+ }
433
+
434
+ const content = result[2]
435
+
436
+ if (num > Config.getUserCfg('config', 'LetterNum') || num <= 0) {
437
+ send.reply(e, `没有第${num}个啦!看清楚再回答啊喂! ̄へ ̄`)
438
+ return true
439
+ }
440
+
441
+ --num;
442
+
443
+ const ids = getInfo.fuzzysongsnick(content, 0.95)
444
+ const standard_id = currentGame.ansIdList[num] // 标准答案
445
+ const standard_name = currentGame.ansList[num] // 标准答案名称
446
+
447
+ if (!ids[0]) {
448
+ send.reply(e, `没有找到[${content}]的曲目信息呐QAQ`, true)
449
+ return true
450
+ }
451
+ for (const id of ids) {
452
+ if (standard_id === id) {
453
+ //已经猜完移除掉的曲目不能再猜
454
+ if (!currentGame.blurlist[num]) {
455
+ send.reply(e, `曲目[${standard_name}]已经猜过了,要不咱们换一个吧uwu`)
456
+ return true
457
+ }
458
+
459
+ currentGame.blurlist[num] = null //移除模糊曲目
460
+
461
+ send.send_with_At(e, `恭喜你ww,答对啦喵,第${num + 1}首答案是[${standard_name}]!ヾ(≧▽≦*)o `, true)
462
+
463
+ /**发送曲绘 */
464
+ const info = getInfo.info(standard_id)
465
+ if (info?.illustration) { //如果有曲绘文件
466
+ switch (Config.getUserCfg('config', 'LetterIllustration')) {
467
+ case "水印版": {
468
+ send.reply(e, await picmodle.ill(e, { illustration: info.illustration, illustrator: info.illustrator }))
469
+ break;
470
+ }
471
+ case "原版": {
472
+ send.reply(e, getPic.getIll(standard_id))
473
+ }
474
+ default:
475
+ break;
476
+ }
477
+ }
478
+
479
+ currentGame.winnerlist[num] = sender.card //记录猜对者
480
+ const isEmpty = allGuessed(currentGame) //是否全部猜完
481
+
482
+ if (!isEmpty) {
483
+ output.push('开字母进行中:')
484
+ output.push(opened)
485
+ await tryToSendMd(e, (t) => [...output, getPuzzle(currentGame, t)].join('\n'));
486
+ return true
487
+ } else {
488
+ output.push('所有曲目均已被猜出,答案如下:');
489
+ const result = finishGame(group_id, gameList)
490
+ if (result) {
491
+ await tryToSendMd(e, (t) => [...output, formatGameover(result, t)].join('\n'));
492
+ }
493
+ return true
494
+ }
495
+ }
496
+ }
497
+
498
+ if (ids[1]) {
499
+ send.reply(e, `第${num + 1}首不是[${content}]www,要不再想想捏?如果实在不会可以悄悄发个[/${Config.getUserCfg('config', 'cmdhead')} tip]哦≧ ﹏ ≦`, true)
500
+ } else {
501
+ send.reply(e, `第${num + 1}首不是[${getInfo.info(ids[0])?.song ?? ids[0]}]www,要不再想想捏?如果实在不会可以悄悄发个[/${Config.getUserCfg('config', 'cmdhead')} tip]哦≧ ﹏ ≦`, true)
502
+ }
503
+
504
+ return false
505
+
506
+ }
507
+
508
+ /**
509
+ * 答案
510
+ * @param {any} e 事件对象
511
+ * @param {GameList} gameList 进行中的游戏列表
512
+ */
513
+ static async ans(e, gameList) {
514
+ const { group_id } = e//使用对象解构提取group_id
515
+
516
+ const currentGame = letterGameData[group_id];
517
+ //必须已经开始了一局
518
+ if (!currentGame) {
519
+ /**未进行游戏放过命令 */
520
+ send.reply(e, `现在还没有进行的开字母捏,赶快输入'/${Config.getUserCfg('config', 'cmdhead')} letter'开始新的一局吧!`, true)
521
+ return false
522
+ }
523
+
524
+
525
+ await send.reply(e, '好吧好吧,既然你执着要放弃,那就公布答案好啦。', true)
526
+ const result = finishGame(group_id, gameList)
527
+ if (result) {
528
+ await tryToSendMd(e, (t) => formatGameover(result, t));
529
+ }
530
+ return true
531
+ }
532
+
533
+ /**
534
+ * 提示
535
+ * @param {any} e 事件对象
536
+ * @param {GameList} gameList 进行中的游戏列表
537
+ */
538
+ static async getTip(e, gameList) {
539
+ const { group_id } = e
540
+
541
+
542
+ const currentGame = letterGameData[group_id];
543
+
544
+ if (!currentGame) {
545
+ send.reply(e, `现在还没有进行的开字母捏,赶快输入'/${Config.getUserCfg('config', 'cmdhead')} letter'开始新的一局吧!`, true)
546
+ return false
547
+ }
548
+
549
+ if (timeCount[group_id]) {
550
+ timeCount[group_id].newTime = Date.now() + (1000 * Config.getUserCfg('config', 'LetterTimeLength'))
551
+ }
552
+
553
+ const time = Config.getUserCfg('config', 'LetterTipCd')
554
+ const currentTime = Date.now()
555
+ const timetik = currentTime - currentGame.lastTipTime
556
+ const timeleft = Math.floor((1000 * time - timetik) / 1000)
557
+
558
+ if (timetik < 1000 * time) {
559
+ send.reply(e, `使用提示的全局冷却时间还有${timeleft}s呐,还请先耐心等下哇QAQ`, true)
560
+ return false
561
+ }
562
+
563
+ currentGame.lastTipTime = currentTime
564
+
565
+ const candidates = getRevealCandidates(currentGame)
566
+ if (candidates.length === 0) {
567
+ logger.warn(`[phi-plugin][letter]群${group_id}的提示没有可翻开的字符`)
568
+ send.reply(e, '当前没有可以继续翻开的字符,请结束本局后重新开始。', true)
569
+ return true
570
+ }
571
+ const randsymbol = candidates[fCompute.randInt(0, candidates.length - 1)]
572
+
573
+ /**
574
+ * @type {string[]}
575
+ */
576
+ const output = []
577
+
578
+ currentGame.ansList.forEach((value, index) => {
579
+ const songname = value
580
+ let blurname = currentGame.blurlist[index]
581
+
582
+ if (!blurname) {
583
+ return;
584
+ }
585
+
586
+ const newBlurname = revealCharacter(songname, blurname, randsymbol)
587
+
588
+ currentGame.blurlist[index] = newBlurname
589
+ if (!hasHiddenCharacters(newBlurname)) {
590
+ currentGame.blurlist[index] = null
591
+ }
592
+ })
593
+
594
+ const reg = /^[A-Za-z]+$/g
595
+ if (reg.test(randsymbol)) {
596
+ currentGame.alphalist.push(randsymbol.toUpperCase())
597
+ } else {
598
+ currentGame.alphalist.push(randsymbol)
599
+ }
600
+
601
+ output.push(`已经帮你随机翻开一个字符[ ${randsymbol} ]了捏 ♪(^∀^●)ノ\n`)
602
+
603
+ const opened = '当前所有翻开的字符[' + currentGame.alphalist.join(' ') + ']'
604
+
605
+ output.push(opened)
606
+
607
+ const isEmpty = allGuessed(currentGame)
608
+ if (!isEmpty) {
609
+ output.push('开字母进行中:')
610
+ await tryToSendMd(e, (t) => [...output, getPuzzle(currentGame, t)].join('\n'));
611
+ } else {
612
+ output.unshift('所有字母已翻开,答案如下:');
613
+ const result = finishGame(group_id, gameList)
614
+ if (result) {
615
+ await tryToSendMd(e, (t) => [...output, formatGameover(result, t)].join('\n'));
616
+ }
617
+ }
618
+ return true
619
+ }
620
+
621
+ /**
622
+ * 洗牌
623
+ * @param {any} e 事件对象
624
+ */
625
+ static async mix(e) {
626
+ const { group_id } = e
627
+
628
+ const currentGame = letterGameData[group_id];
629
+
630
+ if (currentGame) {
631
+ await send.reply(e, `当前有正在进行的游戏,请等待游戏结束再执行该指令`, true)
632
+ return false
633
+ }
634
+
635
+ songweights[group_id] = {}
636
+ scheduleSongweightCleanup(group_id)
637
+
638
+ await send.reply(e, `洗牌成功了www`, true)
639
+ return true
640
+ }
641
+ }
642
+
643
+
644
+ /**
645
+ * 定义随机抽取曲目的函数
646
+ * @param {any} e
647
+ * @param {idString[]} allSelectSongId
648
+ * @returns
649
+ */
650
+ function getRandomSong(e, allSelectSongId) {
651
+ //对象解构提取groupid
652
+ const { group_id } = e
653
+
654
+ //计算曲目的总权重
655
+ const totalWeight = Object.values(songweights[group_id]).reduce((total, weight) => total + weight, 0)
656
+
657
+ //生成一个0到总权重之间带有6位小数的随机数
658
+ const randomWeight = fCompute.randFloatBetween(0, totalWeight, 6)
659
+
660
+ let accumulatedWeight = 0
661
+ const ids = /** @type {idString[]} */ (Object.keys(songweights[group_id]))
662
+ for (const id of ids) {
663
+ const weight = songweights[group_id][id]
664
+ accumulatedWeight += weight
665
+ if (accumulatedWeight >= randomWeight) {
666
+ songweights[group_id][id] *= 0.5 //权重每次衰减50%
667
+ return id
668
+ }
669
+ }
670
+
671
+ //如果由于浮点数精度问题未能正确选择歌曲,则随机返回一首
672
+ if (allSelectSongId) {
673
+ return allSelectSongId[fCompute.randInt(0, allSelectSongId.length - 1)]
674
+ }
675
+ return songIdList[fCompute.randInt(0, songIdList.length - 1)]
676
+ }
677
+
678
+ /**
679
+ *
680
+ * @param {number} ms
681
+ * @returns
682
+ */
683
+ function timeout(ms) {
684
+ return new Promise((resolve, reject) => {
685
+ setTimeout(resolve, ms, 'done');
686
+ });
687
+ }
688
+
689
+ /**
690
+ * 将中文数字转为阿拉伯数字
691
+ * @param {string} digit
692
+ * @returns
693
+ */
694
+ function NumberToArabic(digit) {
695
+ //只处理到千,再高也根本用不上的www(十位数都用不上的说)
696
+ const numberMap = { 一: 1, 二: 2, 三: 3, 四: 4, 五: 5, 六: 6, 七: 7, 八: 8, 九: 9 }
697
+ const unitMap = { 十: 10, 百: 100, 千: 1000 }
698
+
699
+ const total = digit.split('').reduce((acc, character) => {
700
+ // @ts-ignore
701
+ const { [character]: numberValue } = numberMap
702
+ // @ts-ignore
703
+ const { [character]: unitValue } = unitMap
704
+
705
+ if (numberValue !== undefined) {
706
+ acc.currentUnit = numberValue
707
+ } else if (unitValue !== undefined) {
708
+ acc.currentUnit *= unitValue
709
+ acc.total += acc.currentUnit
710
+ acc.currentUnit = 0
711
+ }
712
+
713
+ return acc
714
+ }, { total: 0, currentUnit: 1 })
715
+
716
+ return total.total + total.currentUnit
717
+ }
718
+
719
+ /**
720
+ * 结束本群游戏并返回结算快照。重复调用不会再次结算。
721
+ * @param {string} group_id
722
+ * @param {GameList} gameList
723
+ * @returns {LetterGameResult|null}
724
+ */
725
+ function finishGame(group_id, gameList) {
726
+ const currentGame = letterGameData[group_id]
727
+ if (!currentGame) return null
728
+
729
+ const result = {
730
+ ansList: [...currentGame.ansList],
731
+ winnerlist: [...currentGame.winnerlist]
732
+ }
733
+
734
+ cleanupGameState(group_id, gameList)
735
+ return result
736
+ }
737
+
738
+ /**
739
+ * @param {LetterGameResult} result
740
+ * @param {boolean} letterMarkdown
741
+ */
742
+ function formatGameover(result, letterMarkdown) {
743
+ /**@type {string[]} */
744
+ const output = ['***\n']
745
+
746
+ result.ansList.forEach((value, index) => {
747
+ const correct_name = value
748
+ const winner_card = result.winnerlist[index]
749
+ output.push(`${index + 1}. ${correct_name}` + (winner_card ? ` @${winner_card}` : ''))
750
+ });
751
+ if (letterMarkdown) {
752
+ const cmdhead = Config.getUserCfg('config', 'cmdhead')
753
+ output.push(`\n***\n\n` +
754
+ // '| - | - | - |\n' +
755
+ `| ${cmdInpt(`/${cmdhead} letter `, '再来一局')} | ${cmdInpt(`/${cmdhead} guess`, '猜个曲绘')} | ${cmdInpt(`/${cmdhead} tipgame`, '提示猜歌')} |` +
756
+ '\n| :---: | :---: | :---: |\n');
757
+ }
758
+
759
+ return output.join('\n');
760
+ }
761
+
762
+ /**
763
+ * 生成谜面
764
+ * @param {letterGameDataObject} currentGame
765
+ * @param {boolean} letterMarkdown 是否使用markdown格式的字母谜面
766
+ */
767
+ function getPuzzle(currentGame, letterMarkdown) {
768
+ /**@type {string[]} */
769
+ const output = [];
770
+ letterMarkdown && output.push('***');
771
+ output.push(`曲库范围:${currentGame.gameSelectList.join('、')}\n`);
772
+ currentGame.ansList.forEach((song, index) => {
773
+ if (currentGame.blurlist[index]) {
774
+ const visibleBlurName = currentGame.blurlist[index].replaceAll(LETTER_HIDDEN_CHAR, '*')
775
+ const str = letterMarkdown
776
+ ? cmdInpt(`/n${index + 1}. `, visibleBlurName.replace(/\*/g, '\\*'))
777
+ : visibleBlurName
778
+ output.push(`${index + 1}. ${str}`);
779
+ } else {
780
+ output.push(`${index + 1}. ${song} ✅`)
781
+ if (currentGame.winnerlist[index]) {
782
+ output.push(` @${currentGame.winnerlist[index]}`)
783
+ }
784
+ }
785
+ })
786
+ if (letterMarkdown) {
787
+ const cmdhead = Config.getUserCfg('config', 'cmdhead')
788
+ output.push(`\n***\n` +
789
+ // '| - | - | - |\n' +
790
+ `| ${cmdInpt(`/开 `, '开个字母')} | ${cmdInpt(`/${cmdhead} tip`, '看看提示')} | ${cmdInpt(`/${cmdhead} ans`, '公布答案')} |` +
791
+ '\n| :---: | :---: | :---: |\n');
792
+ output.push('\n*点击蓝色字体可以快速填写指令哦~')
793
+ }
794
+ return output.join('\n');
795
+ }
796
+
797
+ /**
798
+ * @param {string} text 指令内容
799
+ * @param {string} show
800
+ * @param {boolean} reference
801
+ */
802
+ function cmdInpt(text, show, reference = false) {
803
+ return `<qqbot-cmd-input text="${text}" show="${show}" reference="${reference}" />`
804
+ }
805
+
806
+ /**@import {botEvent} from '../../components/baseClass.js' */
807
+
808
+ /**
809
+ * @param {botEvent} e
810
+ * @param {(arg0: boolean) => string} fnc
811
+ */
812
+ async function tryToSendMd(e, fnc) {
813
+ const letterMarkdown = Config.getUserCfg('config', 'LetterMarkdown')
814
+ if (!letterMarkdown) {
815
+ await send.reply(e, fnc(false))
816
+ return;
817
+ }
818
+
819
+ let sent
820
+ try {
821
+ sent = /** @type {{error?: unknown[]}|undefined} */ (await send.reply(e, segment.markdown(fnc(true))))
822
+ } catch (error) {
823
+ logger.warn(`[phi-plugin][letter]Markdown发送失败,改用普通消息`, error)
824
+ await send.reply(e, fnc(false))
825
+ return
826
+ }
827
+
828
+ if (sent?.error?.length) {
829
+ await send.reply(e, fnc(false))
830
+ }
831
+ }