poi-plugin-equips-farm 1.0.4 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poi-plugin-equips-farm",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A POI plugin to assist players in farming ships for specific equipment with enhanced multi-language search support",
5
5
  "main": "index.es",
6
6
  "poiPlugin": {
@@ -9,6 +9,14 @@
9
9
  "icon": "fa/wrench",
10
10
  "priority": 100
11
11
  },
12
+ "files": [
13
+ "index.es",
14
+ "lib",
15
+ "views",
16
+ "redux",
17
+ "assets",
18
+ "initial_equip_ships.json"
19
+ ],
12
20
  "scripts": {
13
21
  "test": "echo \"Error: no test specified\" && exit 1"
14
22
  },
@@ -17,7 +25,7 @@
17
25
  },
18
26
  "repository": {
19
27
  "type": "git",
20
- "url": "https://github.com/Lanyangzhi/poi-plugin-equips-farm.git"
28
+ "url": "git+https://github.com/Lanyangzhi/poi-plugin-equips-farm.git"
21
29
  },
22
30
  "keywords": [
23
31
  "poi",
package/views/index.es CHANGED
@@ -36,7 +36,7 @@ class FarmingAssistant extends Component {
36
36
  } = this.props
37
37
 
38
38
  // 1. Generate Farming Map from WCTF (Consolidated by Base ID)
39
- const farmingMap = getFarmingMap(wctf)
39
+ const farmingMap = getFarmingMap(wctf, $ships)
40
40
 
41
41
  // 2. Convert Map to List for UI
42
42
  const equipmentMap = {}
package/lib/utils.es DELETED
@@ -1,106 +0,0 @@
1
- import shipsData from '../assets/ships.json'
2
-
3
- // --- Icon URLs ---
4
- const SHIP_ICON_BASE = 'http://74.120.174.162/static/image/common/ship_card'
5
- const EQUIP_ICON_BASE = 'http://74.120.174.162/static/image/common/slotitem'
6
-
7
- export const getShipIconUrl = (id) => `${SHIP_ICON_BASE}/${id}.png`
8
- export const getEquipIconUrl = (id) => `${EQUIP_ICON_BASE}/${id}.png`
9
-
10
- // --- Data Merging ---
11
-
12
- // Returns a Map of Equipment ID -> { id, name, iconId, typeName, ships: [] }
13
- // This needs Master Data ($ships, $equipments, $shipTypes, $equipTypes) to be passed in,
14
- // because we shouldn't access store directly in pure utils if possible (or we use selectors in component).
15
- export function prepareFarmingData($ships, $equipments, $shipTypes, $equipTypes) {
16
- const equipmentMap = {}
17
-
18
- // 1. Iterate over local farming config (ships.json)
19
- shipsData.forEach(entry => {
20
- const shipId = entry.shipId
21
- const masterShip = $ships ? $ships[shipId] : null
22
- const shipName = masterShip ? masterShip.api_name : `Ship#${shipId}`
23
- const shipTypeId = masterShip ? masterShip.api_stype : 0
24
- const shipTypeName = ($shipTypes && $shipTypes[shipTypeId]) ? $shipTypes[shipTypeId].api_name : '??'
25
-
26
- entry.farming.forEach(farmItem => {
27
- const equipId = farmItem.equipId
28
- const masterEquip = $equipments ? $equipments[equipId] : null
29
-
30
- // Fallback if master equip is missing
31
- const equipName = masterEquip ? masterEquip.api_name : `Equip#${equipId}`
32
- // Safe access to api_type
33
- const typeId = (masterEquip && masterEquip.api_type) ? masterEquip.api_type[2] : 0
34
- const iconId = (masterEquip && masterEquip.api_type) ? masterEquip.api_type[3] : 0
35
-
36
- const typeName = ($equipTypes && $equipTypes[typeId]) ? $equipTypes[typeId].api_name : '??'
37
-
38
- if (!equipmentMap[equipId]) {
39
- equipmentMap[equipId] = {
40
- id: equipId,
41
- name: equipName,
42
- iconId: iconId,
43
- typeName: typeName,
44
- typeId: typeId,
45
- ships: []
46
- }
47
- }
48
-
49
- // Add provider ship to this equipment
50
- equipmentMap[equipId].ships.push({
51
- shipId: shipId,
52
- shipName: shipName,
53
- shipType: shipTypeName,
54
- shipTypeId: shipTypeId,
55
- level: farmItem.level,
56
- remodel: farmItem.remodel
57
- })
58
- })
59
- })
60
-
61
- // Convert map to array
62
- const equipmentList = Object.values(equipmentMap)
63
-
64
- return { equipmentList }
65
- }
66
-
67
- // Logic for Drop Check
68
- export function checkShipDrop(shipId, targetEquipIds) {
69
- // This logic needs to access ships.json directly to be fast and independent of Master Data if possible,
70
- // BUT since we minimized ships.json, we still have the IDs.
71
- // So current ships.json structure is enough: [{shipId, farming: [{equipId}]}]
72
-
73
- // We can assume drop check is simple: Does this ship provide anything?
74
- // Note: ships.json contains remodeling forms (e.g. Isuzu Kai Ni is 12).
75
- // If Isuzu (110) drops, we actually want to know if "Isuzu (110)" OR "Isuzu Kai Ni (12)" provides something?
76
- // NO. If Isuzu drops, you have Isuzu. You need to level her.
77
- // So if Isuzu (110) is in list, we match.
78
- // If Isuzu Kai Ni (12) is in list, does dropping Isuzu count?
79
- // Technically YES, because you can evolve it.
80
- // BUT we need a "Base Ship -> Evolution" map to know that 110 becomes 12.
81
- // POI's $ships[id].api_aftershipid tells you the next form.
82
- // Implementing full evolution tree check is complex.
83
- // Updated Logic: Strict match for now. If you farm Isuzu Kai Ni equipment, you probably added Isuzu Base to the list too?
84
- // Or users expect to add "Type 21 Radar" and be told "Isuzu dropped, she gives it at Lv 50".
85
-
86
- // Let's iterate ships.json.
87
- const matches = []
88
-
89
- // We need to match the Dropped Ship ID.
90
- // AND we also strictly speaking need to know if the Dropped Ship *evolves* into a provider.
91
- // For MVP, we'll check if the dropped ship ID exists in ships.json directly.
92
-
93
- const shipEntry = shipsData.find(s => s.shipId === shipId)
94
- if (shipEntry) {
95
- shipEntry.farming.forEach(item => {
96
- if (targetEquipIds.includes(item.equipId)) {
97
- matches.push({
98
- equipId: item.equipId,
99
- level: item.level,
100
- remodel: item.remodel
101
- })
102
- }
103
- })
104
- }
105
- return matches
106
- }