koishi-plugin-noah 1.3.3 → 1.3.5

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 (2) hide show
  1. package/lib/index.cjs +48 -19
  2. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -3706,23 +3706,26 @@ var SDVXService2 = class _SDVXService {
3706
3706
  const tempScores = [];
3707
3707
  const lines = text.split("\n");
3708
3708
  for (const line of lines) {
3709
- if (line.startsWith("mid:")) {
3710
- const match = line.match(
3711
- /mid:(\d+)\s+mtype:(\d+)\s+ctype:(\d+)\s+score:(\d+)\s+exscore:(\d+)\s+time:(.+)/
3712
- );
3713
- if (match) {
3714
- const [, musicId, musicType, clearType, score, exscore, time] = match;
3715
- const parsedMusicId = parseInt(musicId);
3716
- tempScores.push({
3717
- musicId: parsedMusicId,
3718
- musicType: parseInt(musicType),
3719
- clearType: parseInt(clearType),
3720
- score: parseInt(score),
3721
- exscore: parseInt(exscore),
3722
- time
3723
- });
3724
- musicIds.push(parsedMusicId);
3725
- }
3709
+ const match = line.match(
3710
+ /lscore:(\d+)\s+lexscore:(\d+)\s+lctype:(\d+)\s+mid:(\d+)\s+mtype:(\d+)\s+ctype:(\d+)\s+score:(\d+)\s+exscore:(\d+)\s+time:([^,]+)(?:,\s+retryCnt:(\d+)(?:,\s+judge:([^,]*)(?:,\s+critical:(\d+)(?:,\s+near:(\d+)(?:,\s+error:(\d+)(?:,\s+combo:(\d+))?)?)?)?)?)?/
3711
+ );
3712
+ if (match) {
3713
+ const musicId = match[4];
3714
+ const musicType = match[5];
3715
+ const clearType = match[6];
3716
+ const score = match[7];
3717
+ const exscore = match[8];
3718
+ const time = match[9];
3719
+ const parsedMusicId = parseInt(musicId);
3720
+ tempScores.push({
3721
+ musicId: parsedMusicId,
3722
+ musicType: parseInt(musicType),
3723
+ clearType: parseInt(clearType),
3724
+ score: parseInt(score),
3725
+ exscore: parseInt(exscore),
3726
+ time: time.trim()
3727
+ });
3728
+ musicIds.push(parsedMusicId);
3726
3729
  }
3727
3730
  }
3728
3731
  if (tempScores.length === 0) {
@@ -3963,6 +3966,7 @@ function recent(ctx, config, logger5) {
3963
3966
  __name(recent, "recent");
3964
3967
 
3965
3968
  // src/games/sdvx/commands/vf.ts
3969
+ var fs4 = __toESM(require("fs"), 1);
3966
3970
  var import_koishi13 = require("koishi");
3967
3971
 
3968
3972
  // src/games/sdvx/services/score-service.ts
@@ -4223,13 +4227,38 @@ function vf(ctx, config, logger5) {
4223
4227
  }
4224
4228
  );
4225
4229
  if (options.lossless) {
4226
- return import_koishi13.h.file(imageBuffer, "image/png");
4230
+ session.send(import_koishi13.h.file(imageBuffer, "image/png"));
4231
+ } else {
4232
+ session.send(import_koishi13.h.image(imageBuffer, "image/jpg"));
4233
+ }
4234
+ const totalVolforce = best50ScoreList.reduce((sum, score) => sum + score.extra.volforce, 0) / 50;
4235
+ if (totalVolforce > 20) {
4236
+ try {
4237
+ const audioPath = getAssetPath(
4238
+ ctx,
4239
+ "stamps/noah_stamp/stamp_0385/nearnoah02-2.mp3"
4240
+ );
4241
+ const imagePath = getAssetPath(
4242
+ ctx,
4243
+ "stamps/noah_stamp/stamp_0385/stamp_0385_02.png"
4244
+ );
4245
+ if (fs4.existsSync(audioPath)) {
4246
+ const audioBuffer = fs4.readFileSync(audioPath);
4247
+ session.send(import_koishi13.h.audio(audioBuffer, "audio/mpeg"));
4248
+ }
4249
+ if (fs4.existsSync(imagePath)) {
4250
+ const imageBuffer2 = fs4.readFileSync(imagePath);
4251
+ session.send(import_koishi13.h.image(imageBuffer2, "image/png"));
4252
+ }
4253
+ } catch (error) {
4254
+ logger5.warn(`Failed to send celebration files: ${error.message}`);
4255
+ }
4227
4256
  }
4228
- return import_koishi13.h.image(imageBuffer, "image/jpg");
4229
4257
  } catch (error) {
4230
4258
  logger5.warn(error);
4231
4259
  return session.text(".error");
4232
4260
  }
4261
+ return;
4233
4262
  });
4234
4263
  }
4235
4264
  __name(vf, "vf");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-noah",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "contributors": [
5
5
  "Logthm <logthm@outlook.com>"
6
6
  ],