@hieuzest/koishi-plugin-riichi-city 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -79,6 +79,10 @@ ${config.extraHelp}`.trim();
79
79
  const l = await this.api.listLobbys();
80
80
  return Object.values(l).map((x) => `[${x.id}] ${x.name}`).join("\n");
81
81
  });
82
+ ctx.command("rc-dhs.info <cid:number>").action(async (_, cid) => {
83
+ const details = await this.api.enterLobby(cid);
84
+ return `${details.matchInfo.name} [${details.classifyID}]`;
85
+ });
82
86
  ctx.guild().command("rc-dhs.bind [cid:number]", { admin: { channel: true } }).userFields(["authority"]).channelFields(["rc-dhs/bind"]).action(async ({ session }, cid) => {
83
87
  const contestId = session.channel["rc-dhs/bind"];
84
88
  if (!cid && contestId) {
@@ -414,11 +418,14 @@ var Rcpt = class {
414
418
  }
415
419
  });
416
420
  }
421
+ generateStage(stageLevel) {
422
+ return types.stages[stageLevel - 1] ?? `${types.stages.at(-1)}★${stageLevel - types.stages.length}`;
423
+ }
417
424
  generateReply(session, ranks) {
418
425
  const about = `${ranks.four.nickname} (${ranks.userId})`;
419
- const four = session.text(".prefix-4") + (ranks.four.stageNextPt === 0 ? `[${types.stages[ranks.four.stageLevel - 1]} ${ranks.four.stagePt}]` : `[${types.stages[ranks.four.stageLevel - 1]} ${ranks.four.stagePt}/${ranks.four.stageNextPt}]`) + ` R${Math.floor(ranks.four.rValue / 1e3)}` + (ranks.four.lastRankList?.length ? `
426
+ const four = session.text(".prefix-4") + (ranks.four.stageNextPt === 0 ? `[${types.stages[ranks.four.stageLevel - 1]} ${ranks.four.stagePt}]` : `[${this.generateStage(ranks.four.stageLevel)} ${ranks.four.stagePt}/${ranks.four.stageNextPt}]`) + ` R${Math.floor(ranks.four.rValue / 1e3)}` + (ranks.four.lastRankList?.length ? `
420
427
  ${session.text(".recent-results")} [${ranks.four.lastRankList.reverse().join("")}]` : "");
421
- const three = session.text(".prefix-3") + (ranks.three.stageNextPt === 0 ? `[${types.stages[ranks.three.stageLevel - 1]} ${ranks.three.stagePt}]` : `[${types.stages[ranks.three.stageLevel - 1]} ${ranks.three.stagePt}/${ranks.three.stageNextPt}]`) + ` R${Math.floor(ranks.three.rValue / 1e3)}` + (ranks.three.lastRankList?.length ? `
428
+ const three = session.text(".prefix-3") + (ranks.three.stageNextPt === 0 ? `[${types.stages[ranks.three.stageLevel - 1]} ${ranks.three.stagePt}]` : `[${this.generateStage(ranks.three.stageLevel)} ${ranks.three.stagePt}/${ranks.three.stageNextPt}]`) + ` R${Math.floor(ranks.three.rValue / 1e3)}` + (ranks.three.lastRankList?.length ? `
422
429
  ${session.text(".recent-results")} [${ranks.three.lastRankList.reverse().join("")}]` : "");
423
430
  return [about, four, three].join("\n");
424
431
  }
package/lib/lobby.js CHANGED
@@ -181,6 +181,8 @@ var RiichiCityLobby = class {
181
181
  } else {
182
182
  notFound.push(player.pattern);
183
183
  }
184
+ } else if (player.accountId) {
185
+ if (!Object.values(onlinePlayers).includes(player.accountId)) notFound.push(player.pattern);
184
186
  }
185
187
  }
186
188
  if (notFound.length) throw new PlayerNotFoundError(...notFound);
package/lib/rcpt.d.ts CHANGED
@@ -9,6 +9,7 @@ declare module 'koishi' {
9
9
  export declare class Rcpt {
10
10
  api: RiichiCityApi;
11
11
  constructor(ctx: Context);
12
+ generateStage(stageLevel: number): string;
12
13
  generateReply(session: Session, ranks: {
13
14
  userId: number;
14
15
  four: types.UserBaseData;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hieuzest/koishi-plugin-riichi-city",
3
3
  "description": "",
4
- "version": "0.5.1",
4
+ "version": "0.5.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [