@hieuzest/koishi-plugin-riichi-city 0.5.0 → 0.5.2
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 +5 -2
- package/lib/lobby.js +7 -1
- package/lib/rcpt.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -414,11 +414,14 @@ var Rcpt = class {
|
|
|
414
414
|
}
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
+
generateStage(stageLevel) {
|
|
418
|
+
return types.stages[stageLevel - 1] ?? `${types.stages.at(-1)}★${stageLevel - types.stages.length}`;
|
|
419
|
+
}
|
|
417
420
|
generateReply(session, ranks) {
|
|
418
421
|
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}]` : `[${
|
|
422
|
+
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
423
|
${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}]` : `[${
|
|
424
|
+
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
425
|
${session.text(".recent-results")} [${ranks.three.lastRankList.reverse().join("")}]` : "");
|
|
423
426
|
return [about, four, three].join("\n");
|
|
424
427
|
}
|
package/lib/lobby.js
CHANGED
|
@@ -159,7 +159,13 @@ var RiichiCityLobby = class {
|
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
async listPlayers(ready = true) {
|
|
162
|
-
return this.api.listPlayers(this.id).then(
|
|
162
|
+
return this.api.listPlayers(this.id).then(
|
|
163
|
+
(l) => Object.fromEntries(l.filter((x) => ready === void 0 || ready && x.status === 2 || !ready && x.status === 1).map((p) => [p.nickname, p.userID])),
|
|
164
|
+
(e) => {
|
|
165
|
+
if (e instanceof import_api.RiichiCityError && e.code === 228) throw new import_koishi.SessionError(`无管理权限,请将【${this.extra.adminAccountId}】设置为管理员。`);
|
|
166
|
+
else throw e;
|
|
167
|
+
}
|
|
168
|
+
);
|
|
163
169
|
}
|
|
164
170
|
async listPaipus(offset = 0, limit = 20) {
|
|
165
171
|
const res = await this.api.listPaipus({ classifyID: this.classifyID, limit, skip: offset });
|
package/lib/rcpt.d.ts
CHANGED