delta-force-core 0.2.2 → 0.2.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.
- package/README.md +556 -298
- package/index.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,21 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/delta-force-core)
|
|
10
10
|
[](https://www.npmjs.com/package/delta-force-core)
|
|
11
|
-
[](https://bundlephobia.com/package/delta-force-core)
|
|
12
11
|
[](./LICENSE)
|
|
13
12
|
[](https://www.typescriptlang.org/)
|
|
14
13
|
[](https://nodejs.org/)
|
|
15
14
|
[](https://github.com/Zhoyi011/delta-force-core/stargazers)
|
|
16
|
-
[](https://github.com/Zhoyi011/delta-force-core/issues)
|
|
17
|
-
[](https://github.com/Zhoyi011/delta-force-core/commits/main)
|
|
18
15
|
[](./CONTRIBUTING.md)
|
|
19
16
|
|
|
20
|
-
[简体中文](./README.md) · [English](./README.en.md)
|
|
17
|
+
[简体中文](./README.md) · [English](./README.en.md)
|
|
21
18
|
|
|
22
19
|
</div>
|
|
23
20
|
|
|
24
21
|
---
|
|
25
22
|
|
|
23
|
+
<a id="status"></a>
|
|
26
24
|
> ## 📢 项目状态
|
|
27
25
|
>
|
|
28
26
|
> **v0.2.x** — 稳定版本,覆盖 **干员 / 武器 / 装备 / 子弹** 四大模块。
|
|
@@ -31,36 +29,38 @@
|
|
|
31
29
|
|
|
32
30
|
---
|
|
33
31
|
|
|
32
|
+
<a id="toc"></a>
|
|
34
33
|
## 📖 目录
|
|
35
34
|
|
|
36
|
-
- [✨ 特性](
|
|
37
|
-
- [🎯 使用场景](
|
|
38
|
-
- [🧠 设计理念](
|
|
39
|
-
- [📦 安装](
|
|
40
|
-
- [🚀 快速开始](
|
|
41
|
-
- [🧩 核心概念](
|
|
42
|
-
- [📘 API 参考](
|
|
43
|
-
- [引擎(Engine)](
|
|
44
|
-
- [抽签函数](
|
|
45
|
-
- [查询函数](
|
|
46
|
-
- [列表函数](
|
|
47
|
-
- [用户覆盖层](
|
|
48
|
-
- [📚 数据模块](
|
|
49
|
-
- [干员(Operators)](
|
|
50
|
-
- [武器(Weapons)](
|
|
51
|
-
- [装备(Equipment)](
|
|
52
|
-
- [子弹(Ammo)](
|
|
53
|
-
- [📄 index.json](
|
|
54
|
-
- [🌐 生态与集成](
|
|
55
|
-
- [🤝 贡献指南](
|
|
56
|
-
- [🛠 开发](
|
|
57
|
-
- [📅 路线图](
|
|
58
|
-
- [❓ FAQ](
|
|
59
|
-
- [📜 License](
|
|
60
|
-
- [❤️ 致谢](
|
|
35
|
+
- [✨ 特性](#features)
|
|
36
|
+
- [🎯 使用场景](#use-cases)
|
|
37
|
+
- [🧠 设计理念](#design)
|
|
38
|
+
- [📦 安装](#install)
|
|
39
|
+
- [🚀 快速开始](#quick-start)
|
|
40
|
+
- [🧩 核心概念](#concepts)
|
|
41
|
+
- [📘 API 参考](#api)
|
|
42
|
+
- [引擎(Engine)](#api-engine)
|
|
43
|
+
- [抽签函数](#api-random)
|
|
44
|
+
- [查询函数](#api-query)
|
|
45
|
+
- [列表函数](#api-list)
|
|
46
|
+
- [用户覆盖层](#api-override)
|
|
47
|
+
- [📚 数据模块](#data)
|
|
48
|
+
- [干员(Operators)](#data-operators)
|
|
49
|
+
- [武器(Weapons)](#data-weapons)
|
|
50
|
+
- [装备(Equipment)](#data-equipment)
|
|
51
|
+
- [子弹(Ammo)](#data-ammo)
|
|
52
|
+
- [📄 index.json](#index-json)
|
|
53
|
+
- [🌐 生态与集成](#ecosystem)
|
|
54
|
+
- [🤝 贡献指南](#contributing)
|
|
55
|
+
- [🛠 开发](#dev)
|
|
56
|
+
- [📅 路线图](#roadmap)
|
|
57
|
+
- [❓ FAQ](#faq)
|
|
58
|
+
- [📜 License](#license)
|
|
59
|
+
- [❤️ 致谢](#thanks)
|
|
61
60
|
|
|
62
61
|
---
|
|
63
62
|
|
|
63
|
+
<a id="features"></a>
|
|
64
64
|
## ✨ 特性
|
|
65
65
|
|
|
66
66
|
<table>
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
95
|
+
<a id="use-cases"></a>
|
|
95
96
|
## 🎯 使用场景
|
|
96
97
|
|
|
97
98
|
<table>
|
|
@@ -123,35 +124,33 @@
|
|
|
123
124
|
|
|
124
125
|
---
|
|
125
126
|
|
|
127
|
+
<a id="design"></a>
|
|
126
128
|
## 🧠 设计理念
|
|
127
129
|
|
|
128
130
|
### 1. 数据与逻辑分离
|
|
129
131
|
|
|
130
132
|
**官方数据是只读的**,由库维护者持续更新;**用户偏好是运行时注入的**,不污染官方数据。
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
```
|
|
133
135
|
┌──────────────────────────────────────┐
|
|
134
|
-
│
|
|
135
|
-
│
|
|
136
|
-
│
|
|
136
|
+
│ 官方数据(硬编码、只读) │
|
|
137
|
+
│ OPERATORS / WEAPONS / │
|
|
138
|
+
│ EQUIPMENT / AMMO │
|
|
137
139
|
└──────────────────┬───────────────────┘
|
|
138
|
-
│
|
|
139
|
-
▼
|
|
140
|
+
│
|
|
141
|
+
▼
|
|
140
142
|
┌──────────────────────────────────────┐
|
|
141
|
-
│
|
|
142
|
-
│
|
|
143
|
-
│
|
|
143
|
+
│ 用户覆盖层(可选、运行时) │
|
|
144
|
+
│ qualityOverride / aliasOverride / │
|
|
145
|
+
│ tagOverride │
|
|
144
146
|
└──────────────────┬───────────────────┘
|
|
145
|
-
│
|
|
146
|
-
▼
|
|
147
|
+
│
|
|
148
|
+
▼
|
|
147
149
|
┌──────────────────────────────────────┐
|
|
148
|
-
│
|
|
149
|
-
│
|
|
150
|
+
│ 引擎(Engine) │
|
|
151
|
+
│ · 抽签 · 查询 │
|
|
150
152
|
└──────────────────────────────────────┘
|
|
151
|
-
|
|
152
|
-
text
|
|
153
|
-
|
|
154
|
-
</div>
|
|
153
|
+
```
|
|
155
154
|
|
|
156
155
|
### 2. 为什么 quality 不在官方数据里?
|
|
157
156
|
|
|
@@ -169,10 +168,11 @@ text
|
|
|
169
168
|
|
|
170
169
|
---
|
|
171
170
|
|
|
171
|
+
<a id="install"></a>
|
|
172
172
|
## 📦 安装
|
|
173
173
|
|
|
174
174
|
<details open>
|
|
175
|
-
<summary><b>npm / yarn / pnpm</b></summary>
|
|
175
|
+
<summary><b>npm / yarn / pnpm / bun</b></summary>
|
|
176
176
|
|
|
177
177
|
```bash
|
|
178
178
|
# npm
|
|
@@ -186,8 +186,14 @@ pnpm add delta-force-core
|
|
|
186
186
|
|
|
187
187
|
# bun
|
|
188
188
|
bun add delta-force-core
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
</details>
|
|
192
|
+
|
|
193
|
+
<details>
|
|
194
|
+
<summary><b>CDN(浏览器直接使用)</b></summary>
|
|
195
|
+
|
|
196
|
+
```html
|
|
191
197
|
<!-- ES Module -->
|
|
192
198
|
<script type="module">
|
|
193
199
|
import { getRandomLoadout } from 'https://esm.sh/delta-force-core';
|
|
@@ -200,27 +206,41 @@ html
|
|
|
200
206
|
const data = await res.json();
|
|
201
207
|
console.log(data.weapons);
|
|
202
208
|
</script>
|
|
209
|
+
```
|
|
210
|
+
|
|
203
211
|
</details>
|
|
204
|
-
环境要求:Node.js ≥ 18 或任何支持 ES Module 的现代浏览器。
|
|
205
212
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
**环境要求**:Node.js ≥ 18 或任何支持 ES Module 的现代浏览器。
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
<a id="quick-start"></a>
|
|
218
|
+
## 🚀 快速开始
|
|
219
|
+
|
|
220
|
+
### 场景 1 · 我只是想查数据(Wiki 用户)
|
|
221
|
+
|
|
222
|
+
```ts
|
|
209
223
|
import { WEAPONS, OPERATORS, EQUIPMENT, AMMO } from 'delta-force-core';
|
|
210
224
|
|
|
211
225
|
console.log(WEAPONS); // 全部武器
|
|
212
226
|
console.log(OPERATORS); // 全部干员
|
|
213
227
|
console.log(EQUIPMENT.armors); // 全部护甲
|
|
214
228
|
console.log(AMMO); // 全部子弹
|
|
215
|
-
|
|
216
|
-
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 场景 2 · 我想抽签(抽卡应用)
|
|
232
|
+
|
|
233
|
+
```ts
|
|
217
234
|
import { getRandomWeapon, getRandomLoadout } from 'delta-force-core';
|
|
218
235
|
|
|
219
236
|
console.log(getRandomWeapon()); // 随机一把武器
|
|
220
237
|
console.log(getRandomLoadout()); // 随机一套完整配装
|
|
221
238
|
console.log(getRandomLoadout({ allowNormal: true })); // 只用普通模式
|
|
222
|
-
|
|
223
|
-
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### 场景 3 · 我有自己的品质评估
|
|
242
|
+
|
|
243
|
+
```ts
|
|
224
244
|
import { createEngine } from 'delta-force-core';
|
|
225
245
|
|
|
226
246
|
const engine = createEngine({
|
|
@@ -233,40 +253,62 @@ const engine = createEngine({
|
|
|
233
253
|
|
|
234
254
|
console.log(engine.getRandomWeapon({ quality: '金色' }));
|
|
235
255
|
console.log(engine.getWeaponQuality('m4a1')); // '金色'
|
|
236
|
-
|
|
237
|
-
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### 场景 4 · 我在纯 JS / JSON 环境
|
|
259
|
+
|
|
260
|
+
```js
|
|
238
261
|
import data from 'delta-force-core/index.json' with { type: 'json' };
|
|
239
262
|
|
|
240
263
|
console.log(data.weapons);
|
|
241
264
|
console.log(data.equipment.helmets);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
<a id="concepts"></a>
|
|
270
|
+
## 🧩 核心概念
|
|
271
|
+
|
|
272
|
+
### 引擎(Engine)
|
|
273
|
+
|
|
274
|
+
`Engine` 是访问**所有抽签和查询能力**的统一入口。它由三层组成:
|
|
275
|
+
|
|
276
|
+
> **官方数据(固定)** + **用户覆盖层(可选)** = **引擎**
|
|
277
|
+
|
|
278
|
+
- **默认引擎**:`defaultEngine`,官方数据 + 空覆盖层,自动在入口注册
|
|
279
|
+
- **自定义引擎**:通过 `createEngine(options)` 创建,注入你的覆盖层
|
|
280
|
+
|
|
281
|
+
### 覆盖层(Override)
|
|
282
|
+
|
|
283
|
+
| 覆盖类型 | 用途 | 影响 |
|
|
284
|
+
|---|---|---|
|
|
285
|
+
| `qualityOverride` | 武器品质评估 | 影响 `getRandomWeapon({ quality })` |
|
|
286
|
+
| `aliasOverride` | 别名(如 `M4` → `m4a1`) | 影响 `findWeaponByAlias()` |
|
|
287
|
+
| `tagOverride` | 个人标签 | 纯元数据,不影响抽签 |
|
|
288
|
+
|
|
289
|
+
### 普通模式(allowNormal)
|
|
290
|
+
|
|
291
|
+
| 值 | 行为 |
|
|
292
|
+
|---|---|
|
|
293
|
+
| `true` | 只在**普通模式可用**的物品中抽 |
|
|
294
|
+
| `false` | 只在**禁止普通模式**的物品中抽(如 AWM / M82) |
|
|
295
|
+
| `undefined` | 不筛选,全部进池 |
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
<a id="api"></a>
|
|
300
|
+
## 📘 API 参考
|
|
301
|
+
|
|
302
|
+
> 💡 **提示**:所有以 `defaultEngine` 形式导出的函数,等价于先 `createEngine()` 再调用。想自定义行为用 `createEngine`。
|
|
303
|
+
|
|
304
|
+
<a id="api-engine"></a>
|
|
305
|
+
### 引擎(Engine)
|
|
306
|
+
|
|
307
|
+
#### `createEngine(options?: EngineOptions): Engine`
|
|
308
|
+
|
|
267
309
|
创建一个引擎实例。
|
|
268
310
|
|
|
269
|
-
ts
|
|
311
|
+
```ts
|
|
270
312
|
import { createEngine } from 'delta-force-core';
|
|
271
313
|
|
|
272
314
|
const engine = createEngine({
|
|
@@ -274,8 +316,12 @@ const engine = createEngine({
|
|
|
274
316
|
aliasOverride: { m4a1: ['M4', 'M4卡宾枪'] },
|
|
275
317
|
tagOverride: { m4a1: ['经典', '入门'] },
|
|
276
318
|
});
|
|
277
|
-
|
|
278
|
-
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
<details>
|
|
322
|
+
<summary><b>查看 EngineOptions 类型</b></summary>
|
|
323
|
+
|
|
324
|
+
```ts
|
|
279
325
|
interface EngineOptions {
|
|
280
326
|
/** 武器品质评估:weaponId → '绿色' | '蓝色' | '紫色' | '金色' */
|
|
281
327
|
qualityOverride?: Record<string, WeaponQuality>;
|
|
@@ -284,71 +330,116 @@ interface EngineOptions {
|
|
|
284
330
|
/** 个人标签:entityId → string[] */
|
|
285
331
|
tagOverride?: Record<string, string[]>;
|
|
286
332
|
}
|
|
333
|
+
```
|
|
334
|
+
|
|
287
335
|
</details>
|
|
288
|
-
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
#### `defaultEngine`
|
|
340
|
+
|
|
289
341
|
默认引擎,已自动注册官方数据 + 空覆盖层。
|
|
290
342
|
|
|
291
|
-
ts
|
|
343
|
+
```ts
|
|
292
344
|
import { defaultEngine } from 'delta-force-core';
|
|
293
345
|
|
|
294
346
|
defaultEngine.getRandomWeapon();
|
|
347
|
+
```
|
|
348
|
+
|
|
295
349
|
所有抽签/查询函数都以默认引擎的形式直接导出:
|
|
296
350
|
|
|
297
|
-
ts
|
|
351
|
+
```ts
|
|
298
352
|
import { getRandomWeapon } from 'delta-force-core';
|
|
299
353
|
// 等价于
|
|
300
354
|
import { defaultEngine } from 'delta-force-core';
|
|
301
355
|
defaultEngine.getRandomWeapon();
|
|
302
|
-
|
|
303
|
-
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
<a id="api-random"></a>
|
|
361
|
+
### 抽签函数
|
|
362
|
+
|
|
363
|
+
所有抽签函数使用 `Math.random()`,均匀分布。**空池会抛错。**
|
|
364
|
+
|
|
365
|
+
#### `getRandomOperator(category?: string): Operator`
|
|
304
366
|
|
|
305
|
-
getRandomOperator(category?: string): Operator
|
|
306
367
|
随机抽取一名干员。
|
|
307
368
|
|
|
308
|
-
参数
|
|
309
|
-
|
|
310
|
-
|
|
369
|
+
| 参数 | 类型 | 说明 |
|
|
370
|
+
|---|---|---|
|
|
371
|
+
| `category` | `string?` | 兵种分类(`突击兵` / `支援兵` / `工程兵` / `侦察兵`),不传则从全部干员中抽 |
|
|
372
|
+
|
|
373
|
+
```ts
|
|
311
374
|
getRandomOperator(); // 任意干员
|
|
312
375
|
getRandomOperator('突击兵'); // 只从突击兵里抽
|
|
313
|
-
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
#### `getRandomWeapon(options?: WeaponOptions): Weapon`
|
|
381
|
+
|
|
314
382
|
随机抽取一把武器。
|
|
315
383
|
|
|
316
|
-
选项
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
384
|
+
| 选项 | 类型 | 说明 |
|
|
385
|
+
|---|---|---|
|
|
386
|
+
| `category` | `string?` | 武器大类 |
|
|
387
|
+
| `quality` | `WeaponQuality?` | 品质,**需要引擎有 qualityOverride 才有意义** |
|
|
388
|
+
| `allowNormal` | `boolean?` | 普通模式筛选 |
|
|
389
|
+
|
|
390
|
+
```ts
|
|
321
391
|
getRandomWeapon();
|
|
322
392
|
getRandomWeapon({ category: '突击步枪' });
|
|
323
393
|
getRandomWeapon({ allowNormal: true });
|
|
324
394
|
getRandomWeapon({ category: '狙击步枪', allowNormal: false });
|
|
325
395
|
engine.getRandomWeapon({ quality: '金色' });
|
|
326
|
-
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
#### `getRandomAmmo(options?: AmmoOptions): Ammo`
|
|
401
|
+
|
|
327
402
|
随机抽取一种子弹。
|
|
328
403
|
|
|
329
|
-
选项
|
|
330
|
-
|
|
331
|
-
|
|
404
|
+
| 选项 | 类型 | 说明 |
|
|
405
|
+
|---|---|---|
|
|
406
|
+
| `caliber` | `string?` | 口径筛选,如 `5.56x45mm` |
|
|
407
|
+
|
|
408
|
+
```ts
|
|
332
409
|
getRandomAmmo();
|
|
333
410
|
getRandomAmmo({ caliber: '5.56x45mm' });
|
|
334
|
-
|
|
335
|
-
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
#### `getRandomArmor` / `getRandomHelmet` / `getRandomBackpack` / `getRandomChestRig`
|
|
416
|
+
|
|
417
|
+
```ts
|
|
336
418
|
getRandomArmor(options?: TierOptions): EquipmentItem
|
|
337
419
|
getRandomHelmet(options?: TierOptions): EquipmentItem
|
|
338
420
|
getRandomBackpack(options?: TierOptions): EquipmentItem
|
|
339
421
|
getRandomChestRig(options?: TierOptions): EquipmentItem
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
| 选项 | 类型 | 说明 |
|
|
425
|
+
|---|---|---|
|
|
426
|
+
| `tier` | `number?` | 指定等级(1~6),不传则全等级 |
|
|
427
|
+
| `allowNormal` | `boolean?` | 普通模式筛选(护甲/头盔支持) |
|
|
428
|
+
|
|
429
|
+
```ts
|
|
344
430
|
getRandomArmor();
|
|
345
431
|
getRandomArmor({ tier: 5 });
|
|
346
432
|
getRandomHelmet({ allowNormal: true });
|
|
347
433
|
getRandomBackpack({ tier: 6 });
|
|
348
|
-
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
#### `getRandomLoadout(options?: LoadoutOptions): Loadout`
|
|
439
|
+
|
|
349
440
|
随机生成一套完整配装。
|
|
350
441
|
|
|
351
|
-
ts
|
|
442
|
+
```ts
|
|
352
443
|
const loadout = getRandomLoadout({ allowNormal: true });
|
|
353
444
|
|
|
354
445
|
// 返回:
|
|
@@ -360,26 +451,40 @@ const loadout = getRandomLoadout({ allowNormal: true });
|
|
|
360
451
|
// backpack: {...}, // 背包
|
|
361
452
|
// chestRig: {...} // 胸挂
|
|
362
453
|
// }
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
<a id="api-query"></a>
|
|
459
|
+
### 查询函数
|
|
460
|
+
|
|
461
|
+
| 函数 | 说明 |
|
|
462
|
+
|---|---|
|
|
463
|
+
| `findOperatorById(id)` | 按 id 查干员 |
|
|
464
|
+
| `findWeaponById(id)` | 按 id 查武器 |
|
|
465
|
+
| `findAmmoById(id)` | 按 id 查子弹 |
|
|
466
|
+
| `findArmorById(id)` | 按 id 查护甲 |
|
|
467
|
+
| `findHelmetById(id)` | 按 id 查头盔 |
|
|
468
|
+
| `findBackpackById(id)` | 按 id 查背包 |
|
|
469
|
+
| `findChestRigById(id)` | 按 id 查胸挂 |
|
|
470
|
+
| `findWeaponsByCaliber(caliber)` | 按口径查武器 |
|
|
471
|
+
| `findAmmoByCaliber(caliber)` | 按口径查子弹 |
|
|
472
|
+
| `findWeaponByAlias(alias)` | 按别名查武器(需 aliasOverride) |
|
|
473
|
+
|
|
474
|
+
```ts
|
|
376
475
|
findWeaponById('m4a1');
|
|
377
476
|
// { id: 'm4a1', name: 'M4A1突击步枪', allowNormal: true }
|
|
378
477
|
|
|
379
478
|
findHelmetById('helmet_l4_gt1');
|
|
380
479
|
findWeaponsByCaliber('5.56x45mm');
|
|
381
|
-
|
|
382
|
-
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
<a id="api-list"></a>
|
|
485
|
+
### 列表函数
|
|
486
|
+
|
|
487
|
+
```ts
|
|
383
488
|
listOperatorCategories();
|
|
384
489
|
// ['突击兵', '支援兵', '工程兵', '侦察兵']
|
|
385
490
|
|
|
@@ -388,8 +493,14 @@ listWeaponCategories();
|
|
|
388
493
|
|
|
389
494
|
listAllOperators(); // 全部干员,拉平成一维数组
|
|
390
495
|
listAllWeapons(); // 全部武器,拉平成一维数组
|
|
391
|
-
|
|
392
|
-
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
<a id="api-override"></a>
|
|
501
|
+
### 用户覆盖层
|
|
502
|
+
|
|
503
|
+
```ts
|
|
393
504
|
const engine = createEngine({
|
|
394
505
|
qualityOverride: { m4a1: '金色' },
|
|
395
506
|
aliasOverride: { m4a1: ['M4', 'M4卡宾枪'] },
|
|
@@ -399,11 +510,19 @@ const engine = createEngine({
|
|
|
399
510
|
engine.getWeaponQuality('m4a1'); // '金色'
|
|
400
511
|
engine.getAliases('m4a1'); // ['M4', 'M4卡宾枪']
|
|
401
512
|
engine.getTags('m4a1'); // ['经典', '入门']
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
405
516
|
|
|
406
|
-
|
|
517
|
+
<a id="data"></a>
|
|
518
|
+
## 📚 数据模块
|
|
519
|
+
|
|
520
|
+
<a id="data-operators"></a>
|
|
521
|
+
### 干员(Operators)
|
|
522
|
+
|
|
523
|
+
**结构**
|
|
524
|
+
|
|
525
|
+
```ts
|
|
407
526
|
interface Operator {
|
|
408
527
|
id: string;
|
|
409
528
|
name: string;
|
|
@@ -416,23 +535,33 @@ interface OperatorCategory {
|
|
|
416
535
|
category: string;
|
|
417
536
|
operators: Operator[];
|
|
418
537
|
}
|
|
419
|
-
|
|
538
|
+
```
|
|
420
539
|
|
|
421
|
-
|
|
540
|
+
**导出**
|
|
541
|
+
|
|
542
|
+
```ts
|
|
422
543
|
import { OPERATORS } from 'delta-force-core';
|
|
423
|
-
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
**分类**:突击兵 / 支援兵 / 工程兵 / 侦察兵
|
|
547
|
+
|
|
548
|
+
**当前条目**:
|
|
424
549
|
|
|
425
|
-
|
|
550
|
+
| 分类 | 干员 |
|
|
551
|
+
|---|---|
|
|
552
|
+
| 突击兵 | 红狼 / 威龙 / 疾风 / 无名 |
|
|
553
|
+
| 支援兵 | 蜂医 / 蛊 / 蝶 / 旅人 |
|
|
554
|
+
| 工程兵 | 牧羊人 / 乌鲁鲁 / 深蓝 / 液氮 / 比特 |
|
|
555
|
+
| 侦察兵 | 露娜 / 骇爪 / 回响 / 银翼 |
|
|
426
556
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
结构
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
<a id="data-weapons"></a>
|
|
560
|
+
### 武器(Weapons)
|
|
561
|
+
|
|
562
|
+
**结构**
|
|
434
563
|
|
|
435
|
-
ts
|
|
564
|
+
```ts
|
|
436
565
|
interface Weapon {
|
|
437
566
|
id: string;
|
|
438
567
|
name: string;
|
|
@@ -442,28 +571,38 @@ interface Weapon {
|
|
|
442
571
|
image?: string;
|
|
443
572
|
allowNormal?: boolean; // 缺省视为 true
|
|
444
573
|
}
|
|
445
|
-
|
|
574
|
+
```
|
|
446
575
|
|
|
447
|
-
|
|
576
|
+
> ⚠️ **注意**:官方 `Weapon` **不含 `quality`**。品质由用户注入。
|
|
448
577
|
|
|
449
|
-
|
|
578
|
+
**导出**
|
|
579
|
+
|
|
580
|
+
```ts
|
|
450
581
|
import { WEAPONS } from 'delta-force-core';
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
**分类与数量**:
|
|
585
|
+
|
|
586
|
+
| 分类 | 数量 |
|
|
587
|
+
|---|---|
|
|
588
|
+
| 突击步枪 | 24 |
|
|
589
|
+
| 冲锋枪 | 12 |
|
|
590
|
+
| 精确射手步枪 | 10 |
|
|
591
|
+
| 狙击步枪 | 5 |
|
|
592
|
+
| 轻机枪 | 4 |
|
|
593
|
+
| 霰弹枪 | 5 |
|
|
594
|
+
| 手枪 | 7 |
|
|
595
|
+
| 特殊武器 | 1 |
|
|
596
|
+
| **合计** | **68** |
|
|
597
|
+
|
|
598
|
+
---
|
|
599
|
+
|
|
600
|
+
<a id="data-equipment"></a>
|
|
601
|
+
### 装备(Equipment)
|
|
602
|
+
|
|
603
|
+
**结构**
|
|
604
|
+
|
|
605
|
+
```ts
|
|
467
606
|
interface EquipmentItem {
|
|
468
607
|
id: string;
|
|
469
608
|
name: string;
|
|
@@ -485,19 +624,27 @@ interface Equipment {
|
|
|
485
624
|
backpacks: EquipmentTier[];
|
|
486
625
|
chest_rigs: EquipmentTier[];
|
|
487
626
|
}
|
|
488
|
-
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**导出**
|
|
489
630
|
|
|
490
|
-
ts
|
|
631
|
+
```ts
|
|
491
632
|
import { EQUIPMENT } from 'delta-force-core';
|
|
492
633
|
|
|
493
634
|
EQUIPMENT.armors; // 护甲,1~6 级
|
|
494
635
|
EQUIPMENT.helmets; // 头盔,1~6 级
|
|
495
636
|
EQUIPMENT.backpacks; // 背包,1~6 级
|
|
496
637
|
EQUIPMENT.chest_rigs; // 胸挂,1~5 级
|
|
497
|
-
|
|
498
|
-
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
<a id="data-ammo"></a>
|
|
643
|
+
### 子弹(Ammo)
|
|
499
644
|
|
|
500
|
-
|
|
645
|
+
**结构**
|
|
646
|
+
|
|
647
|
+
```ts
|
|
501
648
|
interface Ammo {
|
|
502
649
|
id: string;
|
|
503
650
|
name: string;
|
|
@@ -505,25 +652,35 @@ interface Ammo {
|
|
|
505
652
|
description?: string;
|
|
506
653
|
image?: string;
|
|
507
654
|
}
|
|
508
|
-
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
> ⚠️ **当前粒度**:只到"口径",同口径的 1~6 弹(如 M855 / M995)后续再加。
|
|
509
658
|
|
|
510
|
-
|
|
659
|
+
**导出**
|
|
511
660
|
|
|
512
|
-
ts
|
|
661
|
+
```ts
|
|
513
662
|
import { AMMO } from 'delta-force-core';
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
**当前口径**(19 种):
|
|
666
|
+
|
|
667
|
+
| 手枪 / 霰弹 | 中间威力 | 全威力 | 其它 |
|
|
668
|
+
|---|---|---|---|
|
|
669
|
+
| `.357 Magnum` | `5.45x39mm` | `7.62x51mm` | `4.6x30mm` |
|
|
670
|
+
| `.45 ACP` | `5.56x45mm` | `7.62x54mm` | `.300 Blackout` |
|
|
671
|
+
| `.58 AE` | `5.7x28mm` | `12.7x55mm` | `箭矢` |
|
|
672
|
+
| `12 Gauge` | `5.8x42mm` | | `45-70 Govt` |
|
|
673
|
+
| `9x19mm` | `6.8x51mm` | | |
|
|
674
|
+
| `9x39mm` | `7.62x39mm` | | |
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
<a id="index-json"></a>
|
|
679
|
+
## 📄 index.json
|
|
680
|
+
|
|
681
|
+
库在每次构建时生成一份 `index.json`,包含**当前官方数据的完整快照**:
|
|
682
|
+
|
|
683
|
+
```json
|
|
527
684
|
{
|
|
528
685
|
"$schema": "https://raw.githubusercontent.com/delta-force-core/schema/main/v1.json",
|
|
529
686
|
"version": "0.2.0",
|
|
@@ -533,15 +690,15 @@ json
|
|
|
533
690
|
"equipment": {...},
|
|
534
691
|
"ammo": [...]
|
|
535
692
|
}
|
|
536
|
-
|
|
693
|
+
```
|
|
537
694
|
|
|
538
|
-
|
|
695
|
+
**用途**:
|
|
539
696
|
|
|
540
|
-
|
|
697
|
+
- 🐍 非 JS 环境(如 Python 脚本)直接消费
|
|
698
|
+
- 🌐 CDN 直接 fetch(`https://unpkg.com/delta-force-core/index.json`)
|
|
699
|
+
- 📊 数据 diff 检查
|
|
541
700
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
js
|
|
701
|
+
```js
|
|
545
702
|
// ESM
|
|
546
703
|
import data from 'delta-force-core/index.json' with { type: 'json' };
|
|
547
704
|
|
|
@@ -551,16 +708,25 @@ const data = require('delta-force-core/index.json');
|
|
|
551
708
|
// HTTP
|
|
552
709
|
const res = await fetch('https://unpkg.com/delta-force-core/index.json');
|
|
553
710
|
const data = await res.json();
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
<a id="ecosystem"></a>
|
|
716
|
+
## 🌐 生态与集成
|
|
717
|
+
|
|
718
|
+
| 平台 | 用法 |
|
|
719
|
+
|---|---|
|
|
720
|
+
| **Node.js** | `npm install delta-force-core` |
|
|
721
|
+
| **浏览器** | `https://esm.sh/delta-force-core` |
|
|
722
|
+
| **Deno** | `import ... from 'npm:delta-force-core'` |
|
|
723
|
+
| **Bun** | `bun add delta-force-core` |
|
|
724
|
+
| **Python** | 读 `index.json` |
|
|
725
|
+
| **Discord.js** | 见下方示例 |
|
|
726
|
+
|
|
727
|
+
### Discord.js 示例
|
|
728
|
+
|
|
729
|
+
```ts
|
|
564
730
|
import { Client, GatewayIntentBits, Events } from 'discord.js';
|
|
565
731
|
import { getRandomLoadout } from 'delta-force-core';
|
|
566
732
|
|
|
@@ -582,18 +748,28 @@ client.on(Events.InteractionCreate, async (interaction) => {
|
|
|
582
748
|
].join('\n'),
|
|
583
749
|
});
|
|
584
750
|
});
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
---
|
|
588
754
|
|
|
589
|
-
|
|
755
|
+
<a id="contributing"></a>
|
|
756
|
+
## 🤝 贡献指南
|
|
757
|
+
|
|
758
|
+
### 更新干员 / 武器 / 装备 / 子弹
|
|
759
|
+
|
|
760
|
+
**只需要修改对应的数据文件**:
|
|
761
|
+
|
|
762
|
+
```
|
|
590
763
|
src/data/
|
|
591
764
|
├─ operators.ts ← 干员
|
|
592
765
|
├─ weapons.ts ← 武器
|
|
593
766
|
├─ equipment.ts ← 装备(护甲/头盔/背包/胸挂)
|
|
594
767
|
└─ ammo.ts ← 子弹
|
|
595
|
-
|
|
596
|
-
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
### 例子:新增一把武器
|
|
771
|
+
|
|
772
|
+
```ts
|
|
597
773
|
// src/data/weapons.ts
|
|
598
774
|
{
|
|
599
775
|
category: '突击步枪',
|
|
@@ -602,8 +778,11 @@ ts
|
|
|
602
778
|
{ id: 'new_rifle', name: '新突击步枪', allowNormal: true }, // ← 加一行
|
|
603
779
|
],
|
|
604
780
|
},
|
|
605
|
-
|
|
606
|
-
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### 例子:新增一件头盔
|
|
784
|
+
|
|
785
|
+
```ts
|
|
607
786
|
// src/data/equipment.ts → EQUIPMENT.helmets
|
|
608
787
|
{
|
|
609
788
|
tier: 4,
|
|
@@ -613,8 +792,11 @@ ts
|
|
|
613
792
|
{ id: 'helmet_l4_new', name: '新头盔', features: '属性描述' }, // ← 加一行
|
|
614
793
|
],
|
|
615
794
|
},
|
|
616
|
-
|
|
617
|
-
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
### 流程
|
|
798
|
+
|
|
799
|
+
```bash
|
|
618
800
|
# 1. 改数据文件
|
|
619
801
|
vim src/data/weapons.ts
|
|
620
802
|
|
|
@@ -625,49 +807,70 @@ npm run build
|
|
|
625
807
|
git add .
|
|
626
808
|
git commit -m "data: 新增 XXX 武器"
|
|
627
809
|
git push origin main
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### 注意事项
|
|
813
|
+
|
|
814
|
+
| 项 | 说明 |
|
|
815
|
+
|---|---|
|
|
816
|
+
| `id` 必须全局唯一 | 用于查询和去重,重复会静默出 bug |
|
|
817
|
+
| `quality` 不要加 | 官方数据不含品质,由用户层覆盖 |
|
|
818
|
+
| `allowNormal` 缺省 = true | 只在需要禁止时写 `false` |
|
|
819
|
+
| 可选字段全部用 `?:` | 保证向前兼容 |
|
|
820
|
+
| 新增分类 | 直接在数组里追加 `{ category, weapons: [...] }` 块 |
|
|
821
|
+
|
|
822
|
+
### 提交规范
|
|
823
|
+
|
|
824
|
+
采用 [Conventional Commits](https://www.conventionalcommits.org/):
|
|
825
|
+
|
|
826
|
+
| 前缀 | 用途 |
|
|
827
|
+
|---|---|
|
|
828
|
+
| `feat:` | 新功能 |
|
|
829
|
+
| `fix:` | Bug 修复 |
|
|
830
|
+
| `data:` | 数据更新 |
|
|
831
|
+
| `refactor:` | 重构 |
|
|
832
|
+
| `docs:` | 文档 |
|
|
833
|
+
| `chore:` | 杂项 |
|
|
834
|
+
| `test:` | 测试 |
|
|
835
|
+
|
|
646
836
|
例子:
|
|
647
837
|
|
|
648
|
-
|
|
838
|
+
```
|
|
649
839
|
feat: 新增 getRandomAmmo() 支持按口径抽签
|
|
650
840
|
data: 新增 5 把突击步枪
|
|
651
841
|
fix: 修正 AKM 的 allowNormal 字段
|
|
652
842
|
docs: 更新 README 安装说明
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
---
|
|
656
846
|
|
|
657
|
-
|
|
847
|
+
<a id="dev"></a>
|
|
848
|
+
## 🛠 开发
|
|
658
849
|
|
|
659
|
-
|
|
660
|
-
|
|
850
|
+
### 环境要求
|
|
851
|
+
|
|
852
|
+
- Node.js ≥ 18
|
|
853
|
+
- TypeScript ≥ 5.4
|
|
854
|
+
|
|
855
|
+
### 安装
|
|
856
|
+
|
|
857
|
+
```bash
|
|
661
858
|
git clone https://github.com/Zhoyi011/delta-force-core.git
|
|
662
859
|
cd delta-force-core
|
|
663
860
|
npm install
|
|
664
|
-
|
|
665
|
-
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
### 目录结构
|
|
864
|
+
|
|
865
|
+
```text
|
|
666
866
|
delta-force-core/
|
|
667
867
|
├─ .gitignore
|
|
668
868
|
├─ package.json
|
|
669
869
|
├─ tsconfig.json
|
|
670
870
|
├─ README.md
|
|
871
|
+
├─ README.en.md
|
|
872
|
+
├─ LICENSE
|
|
873
|
+
├─ CONTRIBUTING.md
|
|
671
874
|
├─ index.json ← 构建产物
|
|
672
875
|
├─ scripts/
|
|
673
876
|
│ └─ emit-json.mjs ← 生成 index.json
|
|
@@ -683,115 +886,170 @@ delta-force-core/
|
|
|
683
886
|
│ └─ ammo.ts ← 子弹数据
|
|
684
887
|
└─ .github/
|
|
685
888
|
└─ workflows/ ← CI / 自动发布
|
|
686
|
-
|
|
687
|
-
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
### 常用命令
|
|
892
|
+
|
|
893
|
+
```bash
|
|
688
894
|
npm run build # 编译 + 生成 index.json
|
|
689
895
|
npm run dev # 开发模式(watch)
|
|
690
896
|
npm run emit-json # 只生成 index.json
|
|
691
|
-
|
|
692
|
-
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
### 发布到 npm
|
|
900
|
+
|
|
901
|
+
```bash
|
|
693
902
|
# 1. 更新版本号
|
|
694
903
|
npm version patch # 或 minor / major
|
|
695
904
|
|
|
696
905
|
# 2. 发布(会自动跑 prepublishOnly → npm run build)
|
|
697
906
|
npm publish
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
---
|
|
910
|
+
|
|
911
|
+
<a id="roadmap"></a>
|
|
912
|
+
## 📅 路线图
|
|
913
|
+
|
|
914
|
+
<table>
|
|
915
|
+
<tr>
|
|
916
|
+
<th>状态</th>
|
|
917
|
+
<th>功能</th>
|
|
918
|
+
<th>版本</th>
|
|
919
|
+
</tr>
|
|
920
|
+
<tr><td>✅ 已完成</td><td>干员 / 武器 / 装备 / 子弹</td><td>v0.1</td></tr>
|
|
921
|
+
<tr><td>✅ 已完成</td><td>引擎 + 用户覆盖层(quality / alias / tag)</td><td>v0.2</td></tr>
|
|
922
|
+
<tr><td>🔄 进行中</td><td>完整 README + 文档</td><td>v0.2.x</td></tr>
|
|
923
|
+
<tr><td>📋 计划中</td><td>配件系统(槽位 / 兼容关系)</td><td>v0.3</td></tr>
|
|
924
|
+
<tr><td>📋 计划中</td><td>子弹细分(1~6 弹,伤害 / 穿透)</td><td>v0.3</td></tr>
|
|
925
|
+
<tr><td>📋 计划中</td><td>图片资源(干员 / 武器 / 装备)</td><td>v0.4</td></tr>
|
|
926
|
+
<tr><td>💭 考虑中</td><td>多语言(English / 日本語)</td><td>v1.0</td></tr>
|
|
927
|
+
</table>
|
|
928
|
+
|
|
929
|
+
---
|
|
930
|
+
|
|
931
|
+
<a id="faq"></a>
|
|
932
|
+
## ❓ FAQ
|
|
933
|
+
|
|
934
|
+
<details>
|
|
935
|
+
<summary><b>Q1: 为什么官方武器里没有 <code>quality</code> 字段?</b></summary>
|
|
703
936
|
|
|
704
|
-
|
|
937
|
+
品质是玩家**主观评估**,不是官方数据。我们把品质放到用户层 `qualityOverride` 里,让每个使用者用自己的标准。
|
|
705
938
|
|
|
706
|
-
|
|
939
|
+
如果你的项目需要品质,用 `createEngine` 注入:
|
|
940
|
+
|
|
941
|
+
```ts
|
|
707
942
|
const engine = createEngine({
|
|
708
943
|
qualityOverride: { m4a1: '金色' },
|
|
709
944
|
});
|
|
710
|
-
|
|
711
|
-
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
</details>
|
|
948
|
+
|
|
949
|
+
<details>
|
|
950
|
+
<summary><b>Q2: 默认引擎和自定义引擎有什么区别?</b></summary>
|
|
951
|
+
|
|
952
|
+
**默认引擎** `defaultEngine` = 官方数据 + 空覆盖层。
|
|
953
|
+
|
|
954
|
+
**自定义引擎** = 官方数据 + 你的覆盖层。所有查询和抽签方法行为一致,只是自定义引擎会应用你的 quality/alias/tag。
|
|
712
955
|
|
|
713
|
-
|
|
956
|
+
</details>
|
|
957
|
+
|
|
958
|
+
<details>
|
|
959
|
+
<summary><b>Q3: 我能不能只拿数据,不用抽签功能?</b></summary>
|
|
714
960
|
|
|
715
|
-
</details><details> <summary><b>Q3: 我能不能只拿数据,不用抽签功能?</b></summary>
|
|
716
961
|
可以。直接 import 数据常量:
|
|
717
962
|
|
|
718
|
-
ts
|
|
963
|
+
```ts
|
|
719
964
|
import { WEAPONS, OPERATORS, EQUIPMENT, AMMO } from 'delta-force-core';
|
|
720
|
-
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
或者用 `index.json`(适合非 JS 环境)。
|
|
968
|
+
|
|
969
|
+
</details>
|
|
970
|
+
|
|
971
|
+
<details>
|
|
972
|
+
<summary><b>Q4: 数据多久更新一次?</b></summary>
|
|
721
973
|
|
|
722
|
-
</details><details> <summary><b>Q4: 数据多久更新一次?</b></summary>
|
|
723
974
|
跟随游戏版本更新。新装备 / 武器 / 干员上线后,我们会尽快同步。
|
|
724
975
|
|
|
725
976
|
你也可以提 PR 直接改数据文件。
|
|
726
977
|
|
|
727
|
-
</details
|
|
978
|
+
</details>
|
|
979
|
+
|
|
980
|
+
<details>
|
|
981
|
+
<summary><b>Q5: 支持 TypeScript 吗?</b></summary>
|
|
982
|
+
|
|
728
983
|
原生 TypeScript 编写,完整类型定义。IDE 会有智能提示和类型检查。
|
|
729
984
|
|
|
730
|
-
</details
|
|
731
|
-
|
|
985
|
+
</details>
|
|
986
|
+
|
|
987
|
+
<details>
|
|
988
|
+
<summary><b>Q6: 支持 CommonJS 吗?</b></summary>
|
|
989
|
+
|
|
990
|
+
主入口是 **ES Module**。如果是 CommonJS 项目:
|
|
732
991
|
|
|
733
|
-
js
|
|
992
|
+
```js
|
|
734
993
|
// 方式 1:动态 import
|
|
735
994
|
const { getRandomLoadout } = await import('delta-force-core');
|
|
736
995
|
|
|
737
996
|
// 方式 2:直接用 JSON
|
|
738
997
|
const data = require('delta-force-core/index.json');
|
|
739
|
-
|
|
740
|
-
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
</details>
|
|
1001
|
+
|
|
1002
|
+
<details>
|
|
1003
|
+
<summary><b>Q7: 怎么自己部署一份 <code>index.json</code>?</b></summary>
|
|
1004
|
+
|
|
1005
|
+
```bash
|
|
741
1006
|
# fork 仓库 → 改数据 → 构建
|
|
742
1007
|
npm run build
|
|
743
1008
|
# dist/ 里就是最新数据,index.json 在根目录
|
|
1009
|
+
```
|
|
1010
|
+
|
|
744
1011
|
也可以直接用 npm 包自带的:
|
|
745
1012
|
|
|
746
|
-
|
|
1013
|
+
```
|
|
747
1014
|
https://unpkg.com/delta-force-core/index.json
|
|
748
|
-
|
|
749
|
-
Fork 仓库
|
|
1015
|
+
```
|
|
750
1016
|
|
|
751
|
-
|
|
1017
|
+
</details>
|
|
752
1018
|
|
|
753
|
-
|
|
1019
|
+
<details>
|
|
1020
|
+
<summary><b>Q8: 怎么贡献数据修正?</b></summary>
|
|
754
1021
|
|
|
755
|
-
|
|
1022
|
+
1. Fork 仓库
|
|
1023
|
+
2. 改 `src/data/*.ts`
|
|
1024
|
+
3. `npm run build` 确认编译通过
|
|
1025
|
+
4. 提交 PR,附上数据来源(截图 / 官方公告)
|
|
756
1026
|
|
|
757
|
-
详见
|
|
1027
|
+
详见 [贡献指南](#contributing)。
|
|
758
1028
|
|
|
759
1029
|
</details>
|
|
760
|
-
📜 License
|
|
761
|
-
本项目基于 MIT License 发布。
|
|
762
1030
|
|
|
763
|
-
|
|
764
|
-
MIT License
|
|
1031
|
+
---
|
|
765
1032
|
|
|
766
|
-
|
|
1033
|
+
<a id="license"></a>
|
|
1034
|
+
## 📜 License
|
|
767
1035
|
|
|
768
|
-
|
|
769
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
770
|
-
in the Software without restriction, including without limitation the rights
|
|
771
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
772
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
773
|
-
furnished to do so, subject to the following conditions:
|
|
1036
|
+
本项目基于 [MIT License](./LICENSE) 发布。
|
|
774
1037
|
|
|
775
|
-
|
|
776
|
-
copies or substantial portions of the Software.
|
|
1038
|
+
---
|
|
777
1039
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
781
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
782
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
783
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
784
|
-
SOFTWARE.
|
|
785
|
-
❤️ 致谢
|
|
786
|
-
感谢所有为三角洲行动数据整理做出贡献的玩家社区
|
|
1040
|
+
<a id="thanks"></a>
|
|
1041
|
+
## ❤️ 致谢
|
|
787
1042
|
|
|
788
|
-
|
|
1043
|
+
- 感谢所有为三角洲行动数据整理做出贡献的玩家社区
|
|
1044
|
+
- 感谢 [Shields.io](https://shields.io/) 提供徽章服务
|
|
1045
|
+
- 感谢 [unpkg](https://unpkg.com/) / [esm.sh](https://esm.sh/) 提供 CDN
|
|
789
1046
|
|
|
790
|
-
|
|
1047
|
+
---
|
|
791
1048
|
|
|
792
1049
|
<div align="center">
|
|
793
|
-
如果这个项目对你有帮助,请给一个 ⭐ Star 支持一下!
|
|
794
1050
|
|
|
795
|
-
|
|
1051
|
+
**如果这个项目对你有帮助,请给一个 ⭐ Star 支持一下!**
|
|
1052
|
+
|
|
1053
|
+
[⬆ 回到顶部](#delta-force-core)
|
|
796
1054
|
|
|
797
|
-
</div>
|
|
1055
|
+
</div>
|
package/index.json
CHANGED