koishi-plugin-xxck-1 0.3.8 → 0.3.9
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.d.ts +0 -5
- package/lib/index.js +14 -54
- package/lib/locales/zh-CN/index.d.ts +0 -14
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -118,11 +118,6 @@ declare module 'koishi' {
|
|
|
118
118
|
exchange_date: string;
|
|
119
119
|
exchange_count: number;
|
|
120
120
|
};
|
|
121
|
-
gacha_shop_limit: {
|
|
122
|
-
card_id: string;
|
|
123
|
-
total_limit: number;
|
|
124
|
-
left_limit: number;
|
|
125
|
-
};
|
|
126
121
|
gacha_event_pool: {
|
|
127
122
|
code: string;
|
|
128
123
|
card_id: string;
|
package/lib/index.js
CHANGED
|
@@ -101,7 +101,7 @@ var zh_CN_default = {
|
|
|
101
101
|
"error.draw.poolEmpty": "❌ 普通卡池暂无卡片!请联系主人录入卡片",
|
|
102
102
|
"error.upgrade.cardNotInShop": "❌ 升格失败!编号【{cid}】不在今日店铺中!请查看WWC店铺获取最新卡片",
|
|
103
103
|
"error.upgrade.cardNotInPool": "❌ 升格失败!编号【{cid}】不在卡池中!该卡片已被移除",
|
|
104
|
-
"error.upgrade.cardLimitExceed": "❌ 升格失败!编号【{cid}】全服剩余可购买次数不足!当前剩余:{
|
|
104
|
+
"error.upgrade.cardLimitExceed": "❌ 升格失败!编号【{cid}】全服剩余可购买次数不足!当前剩余:{remaining}次",
|
|
105
105
|
"error.upgrade.disturb.notEnough": "❌ 升格失败!热带扰动不足!当前拥有:{have},需要:{need}",
|
|
106
106
|
"error.upgrade.paramInvalid": "❌ 升格参数错误!请输入店铺内的卡片编号,多个编号用空格分隔",
|
|
107
107
|
"error.exchange.count.invalid": "❌ 兑换数量错误!请输入1-40之间的正整数!",
|
|
@@ -121,12 +121,7 @@ var zh_CN_default = {
|
|
|
121
121
|
"error.disturbDraw.count.notEnough": "❌ 扰动抽数不足!\n当前剩余:{have} 次 | 需要:{need} 次(可使用 WWC扰动兑换 兑换)",
|
|
122
122
|
"error.switch.private": "❌ 私信场景无需设置群开关!该指令仅可在群聊中使用",
|
|
123
123
|
"error.switch.fail": "❌ 开关操作失败!{msg}",
|
|
124
|
-
"error.shop.no7starCard": "❌ 店铺生成失败!普通卡池中无7星卡片,请联系主人录入",
|
|
125
|
-
"error.shop.fail": "❌ 店铺功能执行异常,请稍后再试!",
|
|
126
124
|
"error.shop.cardNotEnough": "店铺卡片数量不足,无法刷新",
|
|
127
|
-
"error.shop.cardNotInShop": "卡片{cid}不在今日店铺中,无法兑换",
|
|
128
|
-
"error.shop.cardNotInPool": "卡片{cid}未在卡池注册,无法兑换",
|
|
129
|
-
"error.shop.cardLimitExceed": "卡片{cid}限购超限,剩余仅{remaining}张",
|
|
130
125
|
"error.collection.fail": "❌ 收藏功能执行异常,请稍后再试!",
|
|
131
126
|
"error.ranking.fail": "❌ 排名功能执行异常,请稍后再试!",
|
|
132
127
|
// ==============================================
|
|
@@ -140,15 +135,6 @@ var zh_CN_default = {
|
|
|
140
135
|
// ==============================================
|
|
141
136
|
"image.warehouse.title": "{name} 的卡片仓库(带【限定】标记为限时卡)",
|
|
142
137
|
"image.warehouse.empty": "你的仓库暂无任何卡片,快去抽卡吧!",
|
|
143
|
-
"image.shop.title": "WWC每日商店({date})",
|
|
144
|
-
"image.shop.userInfo": "玩家:{name}",
|
|
145
|
-
"image.shop.asset": "热带扰动: {disturb} | 水汽:{vapor} | 剩余抽数:{draw}",
|
|
146
|
-
"image.shop.exchangeCount": "今日普通兑换:{used}/{limit}抽(单次最多40)",
|
|
147
|
-
"image.shop.header.card": "卡片信息",
|
|
148
|
-
"image.shop.header.price": "升格价格",
|
|
149
|
-
"image.shop.header.cmd": "兑换指令",
|
|
150
|
-
"image.shop.footerTip": "每日刷新卡片,全服限购5次",
|
|
151
|
-
"image.shop.cmdTemplate": "WWC升格 {cid}",
|
|
152
138
|
"image.collection.title": "{showName} 的卡片收藏图鉴(含限定卡)",
|
|
153
139
|
"image.collection.title1": "{showName} 的卡片收藏图鉴1(分类规则见配置项)",
|
|
154
140
|
"image.collection.title2": "{showName} 的卡片收藏图鉴2(分类规则见配置项)",
|
|
@@ -760,20 +746,6 @@ async function _do_sign(ctx, session, signResetHour, signResetMinute) {
|
|
|
760
746
|
const SIGN_DRAW_COUNT = 40;
|
|
761
747
|
const userAsset = await ctx.database.get("gacha_user_draw_count", { qq });
|
|
762
748
|
const newDrawCount = (userAsset[0]?.draw_count ?? 0) + SIGN_DRAW_COUNT;
|
|
763
|
-
let resetDate = new Date(now);
|
|
764
|
-
resetDate.setHours(resetHour, resetMinute, 0, 0);
|
|
765
|
-
if (now < resetDate) {
|
|
766
|
-
resetDate.setDate(resetDate.getDate() - 1);
|
|
767
|
-
}
|
|
768
|
-
const resetDateStr = `${resetDate.getFullYear()}${String(resetDate.getMonth() + 1).padStart(2, "0")}${String(resetDate.getDate()).padStart(2, "0")}`;
|
|
769
|
-
const allCards = await ctx.database.get("gacha_shop_limit", {});
|
|
770
|
-
for (const card of allCards) {
|
|
771
|
-
await ctx.database.upsert("gacha_shop_limit", [{
|
|
772
|
-
card_id: card.card_id,
|
|
773
|
-
left_limit: 5
|
|
774
|
-
}]);
|
|
775
|
-
}
|
|
776
|
-
ctx.logger.info(`签到重置:所有店铺卡片限购次数已恢复为5次`);
|
|
777
749
|
await ctx.database.upsert("gacha_user_draw_count", [{
|
|
778
750
|
qq,
|
|
779
751
|
draw_count: newDrawCount,
|
|
@@ -1353,35 +1325,21 @@ async function _do_shop(ctx, session, signResetHour, signResetMinute) {
|
|
|
1353
1325
|
server_bought: 0,
|
|
1354
1326
|
server_limit: 5
|
|
1355
1327
|
});
|
|
1356
|
-
const exist = await ctx.database.get("gacha_shop_limit", { card_id: card.card_id });
|
|
1357
|
-
if (!exist.length) {
|
|
1358
|
-
await ctx.database.create("gacha_shop_limit", {
|
|
1359
|
-
card_id: card.card_id,
|
|
1360
|
-
total_limit: 5,
|
|
1361
|
-
left_limit: 5
|
|
1362
|
-
});
|
|
1363
|
-
}
|
|
1364
1328
|
}
|
|
1365
1329
|
todayShop = await getShopRowsByDate(ctx, today);
|
|
1366
1330
|
}
|
|
1367
1331
|
const pool = await ctx.database.get("gacha_card_pool", {});
|
|
1368
1332
|
const poolMap = new Map(pool.map((p) => [p.card_id, p]));
|
|
1369
|
-
const limitList = await ctx.database.get("gacha_shop_limit", {
|
|
1370
|
-
card_id: { $in: todayShop.map((s) => s.card_id) }
|
|
1371
|
-
});
|
|
1372
|
-
const limitMap = /* @__PURE__ */ new Map();
|
|
1373
|
-
todayShop.forEach((s) => {
|
|
1374
|
-
const lim = limitList.find((x) => x.card_id === s.card_id);
|
|
1375
|
-
limitMap.set(s.card_id, lim?.left_limit ?? 5);
|
|
1376
|
-
});
|
|
1377
1333
|
const shopCardList = todayShop.map((item) => {
|
|
1378
1334
|
const card = poolMap.get(item.card_id);
|
|
1335
|
+
const limit = item.server_limit ?? 5;
|
|
1336
|
+
const bought = item.server_bought ?? 0;
|
|
1379
1337
|
return {
|
|
1380
1338
|
id: item.card_id,
|
|
1381
1339
|
name: card?.card_name || "未知",
|
|
1382
1340
|
star: item.card_star,
|
|
1383
1341
|
price: item.price,
|
|
1384
|
-
leftLimit:
|
|
1342
|
+
leftLimit: Math.max(0, limit - bought)
|
|
1385
1343
|
};
|
|
1386
1344
|
});
|
|
1387
1345
|
shopCardList.sort((a, b) => b.star - a.star || String(a.id).localeCompare(String(b.id)));
|
|
@@ -1747,6 +1705,11 @@ async function _do_event_draw(ctx, session, data, event6Threshold, event7Thresho
|
|
|
1747
1705
|
hasGot: limitStar === 6 ? pityRecord[0].got6 || false : pityRecord[0].got7 || false
|
|
1748
1706
|
};
|
|
1749
1707
|
const threshold = limitStar === 6 ? event6Threshold : event7Threshold;
|
|
1708
|
+
if (!currentPity.hasGot && currentPity.pityCount >= threshold) {
|
|
1709
|
+
ctx.logger.warn(`[限时保底修复] ${showName}(${qq}) 卡池${code}:计数${currentPity.pityCount}≥阈值${threshold}却未标记已获得,按已触发硬保底修正`);
|
|
1710
|
+
currentPity.hasGot = true;
|
|
1711
|
+
currentPity.pityCount = 0;
|
|
1712
|
+
}
|
|
1750
1713
|
await ctx.database.upsert("gacha_user_event_draw", [{ qq, [key]: have - count }]);
|
|
1751
1714
|
ctx.logger.info(`[限时抽卡] ${showName}(${qq}) 扣除${count}次${limitStar}星限时抽数,剩余${have - count}次`);
|
|
1752
1715
|
const normalCards = await ctx.database.get("gacha_card_pool", {});
|
|
@@ -1793,10 +1756,12 @@ async function _do_event_draw(ctx, session, data, event6Threshold, event7Thresho
|
|
|
1793
1756
|
for (let i = 0; i < count; i++) {
|
|
1794
1757
|
let drawCard;
|
|
1795
1758
|
newPityCount++;
|
|
1796
|
-
const isGuarantee = !currentPity.hasGot && newPityCount
|
|
1759
|
+
const isGuarantee = !currentPity.hasGot && newPityCount >= threshold;
|
|
1797
1760
|
if (isGuarantee) {
|
|
1798
1761
|
drawCard = eventCard;
|
|
1799
|
-
|
|
1762
|
+
currentPity.hasGot = true;
|
|
1763
|
+
newPityCount = 0;
|
|
1764
|
+
ctx.logger.info(`[限时累计保底触发] ${showName}(${qq}) 抽卡${code}期,累计${currentPity.pityCount + 1}抽,保底获得${limitStar}星限时卡:${eventCard.card_name}`);
|
|
1800
1765
|
} else {
|
|
1801
1766
|
const randIndex = Math.floor(Math.random() * probabilityPool.length);
|
|
1802
1767
|
const selectedStar = probabilityPool[randIndex];
|
|
@@ -1918,7 +1883,7 @@ async function _do_event_draw(ctx, session, data, event6Threshold, event7Thresho
|
|
|
1918
1883
|
info += session.text("tip.draw.vapor", { vapor: waterVaporTotal });
|
|
1919
1884
|
info += session.text("tip.draw.disturb", { disturbanceTotal });
|
|
1920
1885
|
if (!currentPity.hasGot) {
|
|
1921
|
-
const remaining = threshold - newPityCount;
|
|
1886
|
+
const remaining = Math.max(0, threshold - newPityCount);
|
|
1922
1887
|
info += session.text("tip.eventDraw.pityProgress", { star: limitStar, current: newPityCount, threshold, left: remaining });
|
|
1923
1888
|
} else {
|
|
1924
1889
|
info += session.text("tip.eventDraw.pityReset", { star: limitStar });
|
|
@@ -2180,11 +2145,6 @@ async function apply(ctx, config) {
|
|
|
2180
2145
|
exchange_date: { type: "string" },
|
|
2181
2146
|
exchange_count: { type: "integer" }
|
|
2182
2147
|
}, { primary: ["qq", "exchange_date"] });
|
|
2183
|
-
ctx.model.extend("gacha_shop_limit", {
|
|
2184
|
-
card_id: { type: "string" },
|
|
2185
|
-
total_limit: { type: "integer" },
|
|
2186
|
-
left_limit: { type: "integer" }
|
|
2187
|
-
}, { primary: ["card_id"] });
|
|
2188
2148
|
ctx.model.extend("gacha_user_exchange", {
|
|
2189
2149
|
qq: { type: "string" },
|
|
2190
2150
|
create_at: { type: "integer" },
|
|
@@ -79,27 +79,13 @@ declare const _default: {
|
|
|
79
79
|
"error.disturbDraw.count.notEnough": string;
|
|
80
80
|
"error.switch.private": string;
|
|
81
81
|
"error.switch.fail": string;
|
|
82
|
-
"error.shop.no7starCard": string;
|
|
83
|
-
"error.shop.fail": string;
|
|
84
82
|
"error.shop.cardNotEnough": string;
|
|
85
|
-
"error.shop.cardNotInShop": string;
|
|
86
|
-
"error.shop.cardNotInPool": string;
|
|
87
|
-
"error.shop.cardLimitExceed": string;
|
|
88
83
|
"error.collection.fail": string;
|
|
89
84
|
"error.ranking.fail": string;
|
|
90
85
|
"draw.broadcast.title": string;
|
|
91
86
|
"draw.broadcast.getCard": string;
|
|
92
87
|
"image.warehouse.title": string;
|
|
93
88
|
"image.warehouse.empty": string;
|
|
94
|
-
"image.shop.title": string;
|
|
95
|
-
"image.shop.userInfo": string;
|
|
96
|
-
"image.shop.asset": string;
|
|
97
|
-
"image.shop.exchangeCount": string;
|
|
98
|
-
"image.shop.header.card": string;
|
|
99
|
-
"image.shop.header.price": string;
|
|
100
|
-
"image.shop.header.cmd": string;
|
|
101
|
-
"image.shop.footerTip": string;
|
|
102
|
-
"image.shop.cmdTemplate": string;
|
|
103
89
|
"image.collection.title": string;
|
|
104
90
|
"image.collection.title1": string;
|
|
105
91
|
"image.collection.title2": string;
|