koishi-plugin-dwrgbwiki 1.3.2 → 1.3.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.
Files changed (3) hide show
  1. package/gacha.js +17 -20
  2. package/index.js +10 -2
  3. package/package.json +1 -1
package/gacha.js CHANGED
@@ -643,7 +643,7 @@ async function gachaPull(config, store, userId, poolType, poolQuery, count) {
643
643
  const daily = user.daily[type] || { date: todayStr, count: 0 }
644
644
  if (daily.date !== todayStr) { daily.date = todayStr; daily.count = 0 }
645
645
  if (daily.count >= limit) {
646
- return { ok: false, limit: true, error: '今日' + (POOL_TYPES[type].label || type) + '抽卡次数已达上限(每种每天限 ' + limit + ' 次),明天再来吧' }
646
+ return { ok: false, error: '今日' + (POOL_TYPES[type].label || type) + '抽卡次数已达上限(每种每天限 ' + limit + ' 次),明天再来吧' }
647
647
  }
648
648
 
649
649
  const results = []
@@ -767,7 +767,7 @@ function buildResourcesHtml(data, config) {
767
767
  return '<div class="card" style="--c:' + color + '">' +
768
768
  '<div class="card-img">' + imgHtml + '</div>' +
769
769
  '<div class="card-name">' + esc(it.name) + '</div>' +
770
- '<div class="card-type" style="color:' + color + '">' + esc(label) + (it.count > 1 ? ' ×' + it.count : '') + '</div>' +
770
+ '<div class="card-type" style="color:' + color + '">' + esc(label) + (it.count > 1 ? ' · ×' + it.count : '') + '</div>' +
771
771
  '</div>'
772
772
  }).join('')
773
773
 
@@ -792,13 +792,13 @@ body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei'
792
792
  .res { font-size:13px; color:#8b949e; background:rgba(139,148,158,.08); border:1px solid rgba(139,148,158,.25); border-radius:8px; padding:5px 14px; }
793
793
  .res b { color:#e6edf3; margin-left:4px; }
794
794
  .grid { display:grid; grid-template-columns:repeat(${colNum}, 1fr); gap:14px; }
795
- .card { background:rgba(22,27,34,.75); border:1px solid rgba(255,255,255,.09); border-radius:14px; padding:12px 8px;
795
+ .card { background:rgba(22,27,34,.75); border:1px solid rgba(255,255,255,.09); border-radius:14px; padding:14px 12px;
796
796
  text-align:center; overflow:hidden; }
797
- .card-img { width:54px; height:54px; margin:0 auto 8px; background:#111318; border-radius:10px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
797
+ .card-img { width:100%; aspect-ratio:1/1; background:#111318; border-radius:10px; display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:10px; }
798
798
  .card-img img { max-width:100%; max-height:100%; object-fit:contain; filter:drop-shadow(0 0 10px var(--c)) drop-shadow(0 0 20px var(--c)); }
799
- .noimg { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:22px; font-weight:800; color:var(--c); }
800
- .card-name { font-size:14.5px; font-weight:700; color:#fff; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
801
- .card-type { font-size:13px; }
799
+ .noimg { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:34px; font-weight:800; color:var(--c); }
800
+ .card-name { font-size:20px; font-weight:700; color:#fff; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
801
+ .card-type { font-size:12px; }
802
802
  .empty { text-align:center; color:#8b949e; font-size:15px; padding:40px 0; }
803
803
  .foot { text-align:center; color:#8b949e; font-size:12px; margin-top:18px; opacity:.75; }
804
804
  </style>
@@ -845,7 +845,7 @@ function buildGachaHtml(data, config) {
845
845
  senior: '稀世', intermediate: '奇珍', junior: '罕见', basic: '普通', discount: '折扣',
846
846
  }
847
847
 
848
- const colNum = data.items.length === 1 ? 1 : (data.items.length <= 3 ? data.items.length : 6)
848
+ const colNum = data.items.length === 1 ? 1 : (data.items.length <= 3 ? data.items.length : 5)
849
849
  const cardHtml = data.items.map((it, idx) => {
850
850
  const color = colors[it.rarity] || '#9ca3af'
851
851
  const label = labels[it.rarity] || it.rarityLabel || it.rarity
@@ -854,11 +854,9 @@ function buildGachaHtml(data, config) {
854
854
  : ''
855
855
  return '<div class="card" style="--c:' + color + '">' +
856
856
  '<div class="card-img"><img src="' + esc(it.img || it.icon || '') + '" onerror="this.style.visibility=\'hidden\'"></div>' +
857
- '<div class="card-body">' +
858
857
  '<div class="card-name">' + esc(it.name) + '</div>' +
859
858
  '<div class="card-type" style="color:' + color + '">' + esc(label) + (it.type ? ' · ' + esc(it.type) : '') + '</div>' +
860
859
  repeatHtml +
861
- '</div>' +
862
860
  '</div>'
863
861
  }).join('')
864
862
 
@@ -883,19 +881,18 @@ body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei'
883
881
  background:linear-gradient(90deg, #79c0ff, #ffd76d); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
884
882
  .pool-sub { font-size:13px; color:#8b949e; margin-top:6px; }
885
883
  .grid { display:grid; grid-template-columns:repeat(${colNum}, 1fr); gap:14px; }
886
- .card { background:rgba(22,27,34,.75); border:1px solid rgba(255,255,255,.09); border-radius:14px; padding:12px 14px;
887
- display:flex; align-items:center; gap:14px; overflow:hidden; }
888
- .card-img { width:62px; height:62px; flex-shrink:0; background:#111318; border-radius:10px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
884
+ .card { background:rgba(22,27,34,.75); border:1px solid rgba(255,255,255,.09); border-radius:14px; padding:14px 12px;
885
+ text-align:center; overflow:hidden; }
886
+ .card-img { width:100%; aspect-ratio:1/1; background:#111318; border-radius:10px; display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:10px; }
889
887
  .card-img img { max-width:100%; max-height:100%; object-fit:contain; filter:drop-shadow(0 0 10px var(--c)) drop-shadow(0 0 20px var(--c)); }
890
- .card-body { min-width:0; }
891
- .card-name { font-size:17px; font-weight:700; color:#fff; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
892
- .card-type { font-size:14px; }
893
- .repeat { margin-top:6px; font-size:12.5px; color:#f85149; background:rgba(248,81,73,.08); border:1px solid rgba(248,81,73,.2); border-radius:6px; padding:3px 8px; display:inline-block; }
888
+ .card-name { font-size:20px; font-weight:700; color:#fff; margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
889
+ .card-type { font-size:12px; }
890
+ .repeat { margin-top:6px; font-size:15px; color:#f85149; background:rgba(248,81,73,.08); border:1px solid rgba(248,81,73,.2); border-radius:6px; padding:3px 6px; }
894
891
  .gains { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:20px; }
895
892
  .gains span { font-size:13px; font-weight:700; color:#3fb950; background:rgba(63,185,80,.08); border:1px solid rgba(63,185,80,.25); border-radius:8px; padding:5px 14px; }
896
893
  .foot { text-align:center; color:#8b949e; font-size:12px; margin-top:18px; opacity:.75; }
897
894
  .pity { text-align:center; color:#8b949e; font-size:12px; margin-top:8px; }
898
- .daily { display:inline-block; font-size:12.5px; color:#8b949e; background:rgba(139,148,158,.08); border:1px solid rgba(139,148,158,.25);
895
+ .daily { display:inline-block; font-size:25px; color:#8b949e; background:rgba(139,148,158,.08); border:1px solid rgba(139,148,158,.25);
899
896
  border-radius:8px; padding:4px 12px; margin-top:10px; }
900
897
  </style>
901
898
  </head>
@@ -1368,7 +1365,7 @@ async function gachaExplore(config, store, userId, diffArg) {
1368
1365
  const daily = user.daily['explore'] || { date: todayStr, count: 0 }
1369
1366
  if (daily.date !== todayStr) { daily.date = todayStr; daily.count = 0 }
1370
1367
  if (daily.count >= limit) {
1371
- return { ok: false, limit: true, error: '今日探索次数已达上限(每天限 ' + limit + ' 次),明天再来吧' }
1368
+ return { ok: false, error: '今日探索次数已达上限(每天限 ' + limit + ' 次),明天再来吧' }
1372
1369
  }
1373
1370
 
1374
1371
  const src = await resolveSource(config)
@@ -1433,7 +1430,7 @@ body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Microsoft YaHei'
1433
1430
  .status { display:inline-block; font-size:14px; font-weight:700; border-radius:8px; padding:5px 16px; margin-top:10px; }
1434
1431
  .status.good { color:#3fb950; background:rgba(63,185,80,.1); border:1px solid rgba(63,185,80,.3); }
1435
1432
  .status.bad { color:#f85149; background:rgba(248,81,73,.1); border:1px solid rgba(248,81,73,.3); }
1436
- .daily { display:inline-block; font-size:12.5px; color:#8b949e; background:rgba(139,148,158,.08); border:1px solid rgba(139,148,158,.25);
1433
+ .daily { display:inline-block; font-size:25px; color:#8b949e; background:rgba(139,148,158,.08); border:1px solid rgba(139,148,158,.25);
1437
1434
  border-radius:8px; padding:4px 12px; margin-left:8px; }
1438
1435
  .log { background:rgba(22,27,34,.75); border:1px solid rgba(255,255,255,.09); border-radius:14px; padding:18px 20px; }
1439
1436
  .line { font-size:13px; line-height:1.9; color:#c9d1d9; }
package/index.js CHANGED
@@ -242,7 +242,11 @@ module.exports = {
242
242
  if (t === '加页探索' || t === '加页手记探索') {
243
243
  try {
244
244
  const result = await gacha.gachaExplore(config, gachaStore, uid, poolId)
245
- if (!result.ok) return result.limit ? result.error : errorImage(ctx, config, result.error, GACHA_HERO_SUB)
245
+ if (!result.ok) {
246
+ // 达到每日上限:纯文字提示
247
+ if (result.error && result.error.includes('上限')) return result.error
248
+ return errorImage(ctx, config, result.error, GACHA_HERO_SUB)
249
+ }
246
250
  const width = (config.gachaWidth && config.gachaWidth > 0) ? config.gachaWidth : config.width
247
251
  const html = gacha.buildExploreHtml(result, { ...config, width })
248
252
  const image = await capture(ctx, html, { ...config, width })
@@ -259,7 +263,11 @@ module.exports = {
259
263
  }
260
264
  try {
261
265
  const result = await gacha.gachaPull(config, gachaStore, uid, t, poolId, count)
262
- if (!result.ok) return result.limit ? result.error : errorImage(ctx, config, result.error, GACHA_HERO_SUB)
266
+ if (!result.ok) {
267
+ // 达到每日上限:纯文字提示
268
+ if (result.error && result.error.includes('上限')) return result.error
269
+ return errorImage(ctx, config, result.error, GACHA_HERO_SUB)
270
+ }
263
271
  const width = (config.gachaWidth && config.gachaWidth > 0) ? config.gachaWidth : config.width
264
272
  const html = gacha.buildGachaHtml(result, { ...config, width })
265
273
  const image = await capture(ctx, html, { ...config, width })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-dwrgbwiki",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "第五人格BWIKI编辑组测试用插件,所有代码由DeepSeek V4 Flash编写",
5
5
  "main": "index.js",
6
6
  "files": [