poi-plugin-yulaiyulai 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/README.md +1 -1
  2. package/lib/core.js +29 -1
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -32,7 +32,7 @@ poi 的“安装插件”输入框本质上是 `npm install`,可以输入以
32
32
  2. **本地 npm tarball 的绝对路径**(当前工作区里的版本可直接这样装):
33
33
 
34
34
  ```text
35
- C:\Users\Soul\Downloads\poi-plugin-yulaiyulai-1.3.2.tgz
35
+ C:\Users\Soul\Downloads\poi-plugin-yulaiyulai-1.3.3.tgz
36
36
  ```
37
37
 
38
38
  注意路径要以 `.tgz` 结尾,并且文件在当前机器上真实存在。如果移动了文件,把上面的路径换成实际位置即可。
package/lib/core.js CHANGED
@@ -7,6 +7,8 @@
7
7
 
8
8
  const bundledRoutes = require('../data/map-routes.json')
9
9
  const fallbackRewards = require('../data/rewards-2025')
10
+ const baseEquipment = require('../data/equipment')
11
+ const baseDropAreas = require('../data/drop-areas')
10
12
 
11
13
  const DATA_VERSION = 1
12
14
  const MAX_ARCHIVE = 100
@@ -433,6 +435,30 @@ function sanitizeHistory(raw) {
433
435
  .sort((a, b) => b.year - a.year)
434
436
  }
435
437
 
438
+ function clone(value) {
439
+ return JSON.parse(JSON.stringify(value))
440
+ }
441
+
442
+ function ensureCurrentReference(season) {
443
+ if (!season || season.year !== baseEquipment.year) return
444
+ const currentCatalog = season.equipmentCatalog
445
+ const baseRecon = baseEquipment.categories.find((category) => category.id === 'recon')
446
+ const currentRecon = currentCatalog && Array.isArray(currentCatalog.categories)
447
+ ? currentCatalog.categories.find((category) => category.id === 'recon')
448
+ : null
449
+ const catalogOutdated =
450
+ !currentCatalog ||
451
+ Number(currentCatalog.year) < baseEquipment.year ||
452
+ !currentRecon ||
453
+ !Array.isArray(currentRecon.items) ||
454
+ currentRecon.items.length < (baseRecon ? baseRecon.items.length : 0)
455
+ if (catalogOutdated) season.equipmentCatalog = clone(baseEquipment)
456
+
457
+ if (!season.dropAreas || Number(season.dropAreas.year) < baseDropAreas.year) {
458
+ season.dropAreas = clone(baseDropAreas)
459
+ }
460
+ }
461
+
436
462
  function sanitizeState(raw, now) {
437
463
  const fallback = createInitialState(now)
438
464
  if (!raw || typeof raw !== 'object') return fallback
@@ -450,9 +476,11 @@ function sanitizeState(raw, now) {
450
476
  })
451
477
  }
452
478
  if (undoStack.length > MAX_ARCHIVE) undoStack.splice(0, undoStack.length - MAX_ARCHIVE)
479
+ const season = sanitizeSeason(raw.season, now)
480
+ ensureCurrentReference(season)
453
481
  return {
454
482
  version: DATA_VERSION,
455
- season: sanitizeSeason(raw.season, now),
483
+ season,
456
484
  history,
457
485
  undoStack,
458
486
  ui: raw.ui && typeof raw.ui === 'object' ? { tab: String(raw.ui.tab || 'stats') } : fallback.ui,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "poi-plugin-yulaiyulai",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "_requested": {
5
- "raw": "poi-plugin-yulaiyulai-1.3.2.tgz"
5
+ "raw": "poi-plugin-yulaiyulai-1.3.3.tgz"
6
6
  },
7
7
  "description": "鱼来鱼来:秋刀鱼活动渔获统计,按图/点记录,同步任务与奖励,按年度结账。",
8
8
  "main": "index.es",