nonebot-plugin-efthelper 0.1.0__py3-none-any.whl
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.
- nonebot_plugin_efthelper/__init__.py +1195 -0
- nonebot_plugin_efthelper/api.py +668 -0
- nonebot_plugin_efthelper/assets/README.md +27 -0
- nonebot_plugin_efthelper/assets/bear.png +0 -0
- nonebot_plugin_efthelper/assets/usec.png +0 -0
- nonebot_plugin_efthelper/card.py +1112 -0
- nonebot_plugin_efthelper/circle.py +380 -0
- nonebot_plugin_efthelper/config.py +310 -0
- nonebot_plugin_efthelper/eftforge.py +177 -0
- nonebot_plugin_efthelper/endings.py +86 -0
- nonebot_plugin_efthelper/format.py +339 -0
- nonebot_plugin_efthelper/image.py +96 -0
- nonebot_plugin_efthelper/index.py +313 -0
- nonebot_plugin_efthelper/registry.py +164 -0
- nonebot_plugin_efthelper-0.1.0.dist-info/METADATA +105 -0
- nonebot_plugin_efthelper-0.1.0.dist-info/RECORD +19 -0
- nonebot_plugin_efthelper-0.1.0.dist-info/WHEEL +5 -0
- nonebot_plugin_efthelper-0.1.0.dist-info/licenses/LICENSE +21 -0
- nonebot_plugin_efthelper-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"""邪教圈(Cultist Circle)献祭推荐。
|
|
2
|
+
|
|
3
|
+
全部是纯计算与渲染,不依赖 NoneBot,方便单独跑和单测。
|
|
4
|
+
|
|
5
|
+
机制(社区/wiki 实测口径):
|
|
6
|
+
最多献祭 5 件,游戏累加每件物品的「基准价格」(basePrice,不是跳蚤价),
|
|
7
|
+
合计落到哪一档决定奖励池与仪式耗时:
|
|
8
|
+
|
|
9
|
+
0 – 10,000 2 小时
|
|
10
|
+
10,001 – 25,000 3 小时
|
|
11
|
+
25,001 – 50,000 4 小时
|
|
12
|
+
50,001 – 100,000 5 小时
|
|
13
|
+
100,001 – 200,000 8 小时
|
|
14
|
+
200,001 – 350,000 12 小时
|
|
15
|
+
≥ 350,001 14 小时(稀有战利品概率大增)
|
|
16
|
+
≥ 400,000 6 小时 + 25% 概率出任务/藏身处所需物
|
|
17
|
+
|
|
18
|
+
推荐目标:给定阈值 T 和件数 k,选 k 件(允许重复)使
|
|
19
|
+
Σ basePrice ≥ T 且 Σ 获取成本 最小。
|
|
20
|
+
|
|
21
|
+
可购性口径:跳蚤市场有价格即可购,不做额外白名单。
|
|
22
|
+
获取成本取 min(跳蚤价, 最便宜商人价),并在结果里标注来源。
|
|
23
|
+
|
|
24
|
+
实测校准(2026-11-28,PVE):
|
|
25
|
+
4 × LM KC-130 飞机模型(单件基准 90,566,合计 362,264)→ 游戏内 14 小时。
|
|
26
|
+
这一次验证了三件事:
|
|
27
|
+
· basePrice 就是圈子累加的那个数(不是跳蚤价);
|
|
28
|
+
· ≥350,001 落 14 小时档没错;
|
|
29
|
+
· 同一件物品重复放多份是允许的(4 份同型号照样生效)。
|
|
30
|
+
注意成本口径仍不可靠:tarkov.dev 的跳蚤价常被单个低价挂单带偏
|
|
31
|
+
(实测「奇怪物语海报」24h 最低 11,111 / 均价 67,443 /
|
|
32
|
+
玩家实际看到 180,000 起),所以「省了多少」只能当参考量级。
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from __future__ import annotations
|
|
36
|
+
|
|
37
|
+
from dataclasses import dataclass
|
|
38
|
+
from itertools import combinations_with_replacement
|
|
39
|
+
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple
|
|
40
|
+
|
|
41
|
+
# 献祭件数上限(游戏硬限制)
|
|
42
|
+
MAX_ITEMS = 5
|
|
43
|
+
|
|
44
|
+
# 推荐默认阈值:400,000 档同时拿到 6 小时和 25% 任务物加成
|
|
45
|
+
DEFAULT_THRESHOLD = 400_000
|
|
46
|
+
|
|
47
|
+
# 跳蚤价的垃圾值下限。tarkov.dev 里无市场的物品价格会被写成 1,
|
|
48
|
+
# 直接参与计算会推荐出一堆 1₽ 的假货。
|
|
49
|
+
MIN_SANE_PRICE = 100
|
|
50
|
+
|
|
51
|
+
# 阈值 -> (耗时描述, 一句话收益)
|
|
52
|
+
TIERS: List[Tuple[int, str, str]] = [
|
|
53
|
+
(400_000, "6 小时", "25% 概率出当前任务/藏身处所需物"),
|
|
54
|
+
(350_001, "14 小时", "稀有战利品概率大增"),
|
|
55
|
+
(200_001, "12 小时", "中高档奖励"),
|
|
56
|
+
(100_001, "8 小时", "中档奖励"),
|
|
57
|
+
(50_001, "5 小时", "偏下奖励"),
|
|
58
|
+
(25_001, "4 小时", "低档奖励"),
|
|
59
|
+
(10_001, "3 小时", "低档奖励"),
|
|
60
|
+
(0, "2 小时", "最低档"),
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class Candidate:
|
|
66
|
+
"""一件可用于献祭的物品。"""
|
|
67
|
+
|
|
68
|
+
tpl: str
|
|
69
|
+
name: str
|
|
70
|
+
base: int # 献祭可提供的基准价值
|
|
71
|
+
price: int # 实际获取成本
|
|
72
|
+
source: str # "flea" 跳蚤 / "trader" 商人
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def ratio(self) -> float:
|
|
76
|
+
return self.base / self.price if self.price else 0.0
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
class Plan:
|
|
81
|
+
"""一个 k 件方案。items 是 ((Candidate, 份数), ...)。"""
|
|
82
|
+
|
|
83
|
+
count: int
|
|
84
|
+
items: Tuple[Tuple[Candidate, int], ...]
|
|
85
|
+
base_total: int
|
|
86
|
+
cost_total: int
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def saved(self) -> int:
|
|
90
|
+
return self.base_total - self.cost_total
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def ratio(self) -> float:
|
|
94
|
+
return self.base_total / self.cost_total if self.cost_total else 0.0
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# ---------------------------------------------------------------- 数据准备
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def make_candidates(items: Iterable[Dict]) -> List[Candidate]:
|
|
101
|
+
"""把 api 层给的扁平 dict 列表转成可计算候选。
|
|
102
|
+
|
|
103
|
+
每项需要 tpl / name / base / flea / trader 五个字段。
|
|
104
|
+
跳蚤无价的物品直接丢掉(用户口径:跳蚤有价即可购)。
|
|
105
|
+
"""
|
|
106
|
+
out: List[Candidate] = []
|
|
107
|
+
seen = set()
|
|
108
|
+
for it in items:
|
|
109
|
+
tpl = it.get("tpl") or ""
|
|
110
|
+
if not tpl or tpl in seen:
|
|
111
|
+
continue
|
|
112
|
+
base = int(it.get("base") or 0)
|
|
113
|
+
flea = int(it.get("flea") or 0)
|
|
114
|
+
trader = int(it.get("trader") or 0)
|
|
115
|
+
if base <= 0 or flea < MIN_SANE_PRICE:
|
|
116
|
+
continue
|
|
117
|
+
prices: List[Tuple[int, str]] = [(flea, "flea")]
|
|
118
|
+
if 0 < trader < flea:
|
|
119
|
+
prices.append((trader, "trader"))
|
|
120
|
+
price, source = min(prices)
|
|
121
|
+
if price <= 0:
|
|
122
|
+
continue
|
|
123
|
+
seen.add(tpl)
|
|
124
|
+
out.append(
|
|
125
|
+
Candidate(
|
|
126
|
+
tpl=tpl,
|
|
127
|
+
name=str(it.get("name") or tpl),
|
|
128
|
+
base=base,
|
|
129
|
+
price=price,
|
|
130
|
+
source=source,
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
return out
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# ---------------------------------------------------------------- 求解
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _solve_one(
|
|
140
|
+
cands: Sequence[Candidate],
|
|
141
|
+
target: int,
|
|
142
|
+
k: int,
|
|
143
|
+
pool: int,
|
|
144
|
+
max_same: int = 0,
|
|
145
|
+
price_factor: float = 1.0,
|
|
146
|
+
price_step: float = 0.0,
|
|
147
|
+
) -> Optional[Plan]:
|
|
148
|
+
"""恰好 k 件、合计 ≥ target、成本最低的方案。
|
|
149
|
+
|
|
150
|
+
单件必须能提供 target/k 的价值才有资格入选——否则塞满 k 件也够不着阈值,
|
|
151
|
+
这个剪枝把候选从几千件压到几十件。之后在按性价比排序的前 pool 件里
|
|
152
|
+
枚举可重复组合,规模可控(pool=30、k=5 时约 28 万种)。
|
|
153
|
+
"""
|
|
154
|
+
if k <= 0 or target <= 0:
|
|
155
|
+
return None
|
|
156
|
+
need = -(-target // k) # 向上取整
|
|
157
|
+
|
|
158
|
+
# 件数越多,越要把便宜的挂单吃光,所以单价的保守系数随件数递增:
|
|
159
|
+
# factor(k) = price_factor + price_step * (k - 1)
|
|
160
|
+
# 同一件数下系数是常数,不会改变候选之间的相对排序。
|
|
161
|
+
factor = price_factor + price_step * (k - 1)
|
|
162
|
+
if factor > 1:
|
|
163
|
+
cands = [
|
|
164
|
+
Candidate(
|
|
165
|
+
tpl=c.tpl,
|
|
166
|
+
name=c.name,
|
|
167
|
+
base=c.base,
|
|
168
|
+
price=max(1, int(round(c.price * factor))),
|
|
169
|
+
source=c.source,
|
|
170
|
+
)
|
|
171
|
+
for c in cands
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
usable = [c for c in cands if c.base >= need]
|
|
175
|
+
if not usable:
|
|
176
|
+
return None
|
|
177
|
+
usable.sort(key=lambda c: c.ratio, reverse=True)
|
|
178
|
+
usable = usable[:pool]
|
|
179
|
+
# 允许同一件物品重复献祭,所以 k 件能凑出的上限是「最大单件基准 × k」,
|
|
180
|
+
# 不是「前 k 大不同物品之和」——写错会把整档方案误判成无解。
|
|
181
|
+
if max(c.base for c in usable) * k < target:
|
|
182
|
+
return None
|
|
183
|
+
|
|
184
|
+
best: Optional[Plan] = None
|
|
185
|
+
for combo in combinations_with_replacement(usable, k):
|
|
186
|
+
# max_same>0 时限制同一件物品最多出现几次;不限的话最优解几乎总是
|
|
187
|
+
# 「同一件买 k 份」,因为重复允许时性价比最高的那件永远赢
|
|
188
|
+
if max_same and _max_run(combo) > max_same:
|
|
189
|
+
continue
|
|
190
|
+
base_total = 0
|
|
191
|
+
for c in combo:
|
|
192
|
+
base_total += c.base
|
|
193
|
+
if base_total < target:
|
|
194
|
+
continue
|
|
195
|
+
cost_total = 0
|
|
196
|
+
for c in combo:
|
|
197
|
+
cost_total += c.price
|
|
198
|
+
if best is not None and cost_total >= best.cost_total:
|
|
199
|
+
continue
|
|
200
|
+
best = Plan(count=k, items=_group(combo), base_total=base_total, cost_total=cost_total)
|
|
201
|
+
return best
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _max_run(combo: Sequence[Candidate]) -> int:
|
|
205
|
+
"""组合里同一件物品连续出现的最大长度(combinations_with_replacement 是有序的)。"""
|
|
206
|
+
longest = run = 1
|
|
207
|
+
for i in range(1, len(combo)):
|
|
208
|
+
run = run + 1 if combo[i].tpl == combo[i - 1].tpl else 1
|
|
209
|
+
longest = max(longest, run)
|
|
210
|
+
return longest
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _group(combo: Sequence[Candidate]) -> Tuple[Tuple[Candidate, int], ...]:
|
|
214
|
+
"""把组合合并成 (物品, 份数),保持首次出现顺序。"""
|
|
215
|
+
order: List[Candidate] = []
|
|
216
|
+
counts: Dict[str, int] = {}
|
|
217
|
+
for c in combo:
|
|
218
|
+
if c.tpl not in counts:
|
|
219
|
+
order.append(c)
|
|
220
|
+
counts[c.tpl] = 0
|
|
221
|
+
counts[c.tpl] += 1
|
|
222
|
+
return tuple((c, counts[c.tpl]) for c in order)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def solve_all(
|
|
226
|
+
cands: Sequence[Candidate],
|
|
227
|
+
target: int,
|
|
228
|
+
max_items: int = MAX_ITEMS,
|
|
229
|
+
pool: int = 30,
|
|
230
|
+
max_same: int = 0,
|
|
231
|
+
price_factor: float = 1.0,
|
|
232
|
+
price_step: float = 0.0,
|
|
233
|
+
) -> List[Plan]:
|
|
234
|
+
"""算出 1..max_items 件的最佳方案,返回按件数升序的列表(无解的跳过)。"""
|
|
235
|
+
plans: List[Plan] = []
|
|
236
|
+
for k in range(1, max_items + 1):
|
|
237
|
+
plan = _solve_one(cands, target, k, pool, max_same, price_factor, price_step)
|
|
238
|
+
if plan is not None:
|
|
239
|
+
plans.append(plan)
|
|
240
|
+
return plans
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def solve_k(
|
|
244
|
+
cands: Sequence[Candidate],
|
|
245
|
+
target: int,
|
|
246
|
+
k: int,
|
|
247
|
+
pool: int = 30,
|
|
248
|
+
max_same: int = 0,
|
|
249
|
+
price_factor: float = 1.0,
|
|
250
|
+
price_step: float = 0.0,
|
|
251
|
+
) -> Optional[Plan]:
|
|
252
|
+
"""只算「恰好 k 件」这一种方案(/eftcircle 指定件数时用)。"""
|
|
253
|
+
return _solve_one(cands, target, k, pool, max_same, price_factor, price_step)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def render_usage() -> str:
|
|
257
|
+
return (
|
|
258
|
+
"📖 /eftcircle 用法\n"
|
|
259
|
+
"\n"
|
|
260
|
+
" /eftcircle <模式> <件数>\n"
|
|
261
|
+
"\n"
|
|
262
|
+
"模式:\n"
|
|
263
|
+
" pvp → PvP 正式服\n"
|
|
264
|
+
" pvps → PvP 赛季\n"
|
|
265
|
+
" pve → PvE\n"
|
|
266
|
+
"\n"
|
|
267
|
+
"件数:1-5,写几就按几件凑\n"
|
|
268
|
+
"阈值固定按 14 小时档(≥ 350,001)\n"
|
|
269
|
+
"\n"
|
|
270
|
+
"示例:\n"
|
|
271
|
+
" /eftcircle pve 5\n"
|
|
272
|
+
" /eftcircle pvp 1"
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def best_plan(plans: Sequence[Plan]) -> Optional[Plan]:
|
|
277
|
+
"""成本最低的那个方案。"""
|
|
278
|
+
if not plans:
|
|
279
|
+
return None
|
|
280
|
+
return min(plans, key=lambda p: (p.cost_total, p.count))
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def best_value(plans: Sequence[Plan]) -> Optional[Plan]:
|
|
284
|
+
"""性价比最高的方案(基准/成本最大)。
|
|
285
|
+
|
|
286
|
+
成本最低不等于最划算:多花一点卢布换更多基准价值往往更值,
|
|
287
|
+
所以默认推荐的是这个,而不是最便宜的那个。
|
|
288
|
+
"""
|
|
289
|
+
if not plans:
|
|
290
|
+
return None
|
|
291
|
+
return max(plans, key=lambda p: (p.ratio, -p.cost_total))
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
# ---------------------------------------------------------------- 渲染
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def tier_of(base_total: int) -> Tuple[str, str]:
|
|
298
|
+
"""按合计价值查档位,返回 (耗时, 收益说明)。"""
|
|
299
|
+
for floor, hours, note in TIERS:
|
|
300
|
+
if base_total >= floor:
|
|
301
|
+
return hours, note
|
|
302
|
+
return TIERS[-1][1], TIERS[-1][2]
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def _wan(value: int) -> str:
|
|
306
|
+
"""大数字加千分位。"""
|
|
307
|
+
return format(int(value), ",")
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def _rub(value: int) -> str:
|
|
311
|
+
"""卢布金额:符号在前 + 千分位。"""
|
|
312
|
+
return "₽" + _wan(value)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def render(plans: Sequence[Plan], mode_label: str, target: int, *, now: str = "") -> str:
|
|
316
|
+
"""渲染成适合聊天的纯文本。"""
|
|
317
|
+
hours, note = tier_of(target)
|
|
318
|
+
lines: List[str] = [
|
|
319
|
+
f"🔮 邪教圈献祭推荐 · {mode_label}",
|
|
320
|
+
f"目标 ≥ {_rub(target)}({hours}档 · {note})",
|
|
321
|
+
"",
|
|
322
|
+
]
|
|
323
|
+
if not plans:
|
|
324
|
+
lines.append("❌ 当前数据下算不出可达标的方案,稍后重试或换个阈值")
|
|
325
|
+
return "\n".join(lines)
|
|
326
|
+
|
|
327
|
+
top = best_value(plans)
|
|
328
|
+
assert top is not None
|
|
329
|
+
lines.append(f"★ 最有性价比:献祭 {top.count} 件")
|
|
330
|
+
for cand, n in top.items:
|
|
331
|
+
tag = "商人" if cand.source == "trader" else "跳蚤"
|
|
332
|
+
lines.append(
|
|
333
|
+
f" {cand.name} ×{n}"
|
|
334
|
+
f"(单件基准 {_rub(cand.base)} / {tag} {_rub(cand.price)})"
|
|
335
|
+
)
|
|
336
|
+
lines.append(
|
|
337
|
+
f" 合计基准 {_rub(top.base_total)} | 成本 {_rub(top.cost_total)}"
|
|
338
|
+
f" | 省 {_rub(top.saved)}({top.ratio:.1f} 倍)"
|
|
339
|
+
)
|
|
340
|
+
lines.append("")
|
|
341
|
+
|
|
342
|
+
if len(plans) > 1:
|
|
343
|
+
lines.append("各件数方案")
|
|
344
|
+
for plan in plans:
|
|
345
|
+
if plan is top:
|
|
346
|
+
continue
|
|
347
|
+
detail = " + ".join(f"{c.name}×{n}" for c, n in plan.items)
|
|
348
|
+
lines.append(
|
|
349
|
+
f" {plan.count} 件 成本 {_rub(plan.cost_total)}"
|
|
350
|
+
f" 省 {_rub(plan.saved)} {detail}"
|
|
351
|
+
)
|
|
352
|
+
lines.append("")
|
|
353
|
+
lines.append(" 件数多不必然更省,上表是每种件数各自的最优解")
|
|
354
|
+
|
|
355
|
+
lines.append("")
|
|
356
|
+
lines.append(" 同一种物品要买多件时注意跳蚤挂单量,买不到就换一批")
|
|
357
|
+
if now:
|
|
358
|
+
lines.append(f" 行情时间:{now}")
|
|
359
|
+
return "\n".join(lines)
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def summary_rows(plans: Sequence[Plan]) -> List[Dict[str, Any]]:
|
|
363
|
+
"""给卡片渲染用的扁平结构(card.py 不 import 本模块,避免循环依赖)。"""
|
|
364
|
+
top = best_value(plans)
|
|
365
|
+
return [
|
|
366
|
+
{
|
|
367
|
+
"count": p.count,
|
|
368
|
+
"names": [(c.name, n) for c, n in p.items],
|
|
369
|
+
"parts": [
|
|
370
|
+
{"name": c.name, "n": n, "base": c.base, "cost": c.price, "source": c.source}
|
|
371
|
+
for c, n in p.items
|
|
372
|
+
],
|
|
373
|
+
"cost": p.cost_total,
|
|
374
|
+
"base": p.base_total,
|
|
375
|
+
"saved": p.saved,
|
|
376
|
+
"ratio": p.ratio,
|
|
377
|
+
"best": p is top,
|
|
378
|
+
}
|
|
379
|
+
for p in plans
|
|
380
|
+
]
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"""插件配置。
|
|
2
|
+
|
|
3
|
+
所有配置项都可以通过 NoneBot 的 `.env` 文件或环境变量覆盖,
|
|
4
|
+
例如在 `.env` 里写 `EFT_CACHE_TTL=3600`。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
from pydantic import BaseModel, Field
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _default_cache_dir() -> Path:
|
|
16
|
+
"""优先用 nonebot-plugin-localstore;没装就退回到 ./cache/eft。"""
|
|
17
|
+
try:
|
|
18
|
+
import nonebot_plugin_localstore as store # type: ignore
|
|
19
|
+
|
|
20
|
+
return Path(store.get_plugin_cache_dir("nonebot_plugin_efthelper"))
|
|
21
|
+
except Exception:
|
|
22
|
+
return Path(os.getcwd()) / "cache" / "eft"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class EftConfig(BaseModel):
|
|
26
|
+
"""插件运行配置。"""
|
|
27
|
+
|
|
28
|
+
eft_cache_dir: Path = Field(
|
|
29
|
+
default_factory=_default_cache_dir,
|
|
30
|
+
description="静态数据缓存目录(等级表、成就名对照表)",
|
|
31
|
+
)
|
|
32
|
+
eft_cache_ttl: int = Field(
|
|
33
|
+
default=7 * 24 * 3600,
|
|
34
|
+
description="静态数据缓存有效期(秒)。默认 7 天;设为 0 表示永不过期",
|
|
35
|
+
)
|
|
36
|
+
eft_connect_timeout: float = Field(
|
|
37
|
+
default=10.0,
|
|
38
|
+
description="HTTP 连接超时(秒)",
|
|
39
|
+
)
|
|
40
|
+
eft_interactive_timeout: float = Field(
|
|
41
|
+
default=25.0,
|
|
42
|
+
description=(
|
|
43
|
+
"交互类请求的超时(秒):服务器状态、玩家资料。"
|
|
44
|
+
"tarkov.dev 会偶发挂起,这个值直接决定用户最长等多久"
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
eft_static_timeout: float = Field(
|
|
48
|
+
default=150.0,
|
|
49
|
+
description=(
|
|
50
|
+
"静态数据下载的超时(秒)。json.tarkov.dev 的 items 端点有 17MB,"
|
|
51
|
+
"慢的时候要几十秒,所以给得很宽"
|
|
52
|
+
),
|
|
53
|
+
)
|
|
54
|
+
eft_read_timeout: float = Field(
|
|
55
|
+
default=60.0,
|
|
56
|
+
description="HTTP 客户端的默认读取超时(秒),上面两项没覆盖到的请求用它",
|
|
57
|
+
)
|
|
58
|
+
eft_max_retries: int = Field(
|
|
59
|
+
default=3,
|
|
60
|
+
description="请求的最大重试次数。tarkov.dev 的 CDN 偶尔会抽风",
|
|
61
|
+
)
|
|
62
|
+
eft_interactive_retries: int = Field(
|
|
63
|
+
default=2,
|
|
64
|
+
description=(
|
|
65
|
+
"交互类请求的重试次数。设太大最坏情况会等很久,"
|
|
66
|
+
"所以比静态下载少一次"
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
eft_render_timeout: float = Field(
|
|
70
|
+
default=35.0,
|
|
71
|
+
description=(
|
|
72
|
+
"立绘渲染请求的超时(秒)。imagemagic 服务响应偏慢,"
|
|
73
|
+
"但超过半分钟基本就是挂了,没必要让用户继续等"
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
eft_render_retries: int = Field(
|
|
77
|
+
default=1,
|
|
78
|
+
description="立绘请求的重试次数。拿不到图只是少张图,不值得反复重试",
|
|
79
|
+
)
|
|
80
|
+
eft_send_image: bool = Field(
|
|
81
|
+
default=True,
|
|
82
|
+
description="是否附带发送角色立绘",
|
|
83
|
+
)
|
|
84
|
+
eft_card_enabled: bool = Field(
|
|
85
|
+
default=True,
|
|
86
|
+
description=(
|
|
87
|
+
"把资料文字和立绘合成一张「玩家卡片」发送(背景配色随 USEC/BEAR 阵营变化)。"
|
|
88
|
+
"需要 Pillow;不可用时自动退回「文字 + 立绘」两条消息"
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
eft_also_send_text: bool = Field(
|
|
92
|
+
default=False,
|
|
93
|
+
description="卡片模式下是否额外再发一条纯文字(方便复制、也照顾读屏)",
|
|
94
|
+
)
|
|
95
|
+
eft_card_max_achievements: int = Field(
|
|
96
|
+
default=6,
|
|
97
|
+
description="卡片上最多展开几个成就名",
|
|
98
|
+
)
|
|
99
|
+
eft_max_render_url: int = Field(
|
|
100
|
+
default=8000,
|
|
101
|
+
description=(
|
|
102
|
+
"立绘 URL 长度上限。原版 stash 硬编码 2048,"
|
|
103
|
+
"导致装备复杂的角色(实测 2157 字符)会被静默跳过;"
|
|
104
|
+
"QQ 侧没有这个限制,所以放宽"
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
eft_webp_to_png: bool = Field(
|
|
108
|
+
default=True,
|
|
109
|
+
description="把立绘从 WebP 转成 PNG 再发送(需要 Pillow)。部分 QQ 客户端不认 WebP",
|
|
110
|
+
)
|
|
111
|
+
eft_profile_cache_ttl: int = Field(
|
|
112
|
+
default=3600,
|
|
113
|
+
description=(
|
|
114
|
+
"玩家资料的本地缓存有效期(秒)。上游资料靠志愿者扫描上传、更新很慢,"
|
|
115
|
+
"重复查询走缓存可以秒回并减少对 tarkov.dev 的压力。设为 0 表示永不过期"
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
eft_profile_stale_ok: bool = Field(
|
|
119
|
+
default=True,
|
|
120
|
+
description=(
|
|
121
|
+
"上游拉取失败时,是否回退到过期的本地缓存。"
|
|
122
|
+
"开着的话上游挂了还能出旧数据,只是卡片上的「数据更新」会显示实际时间"
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
eft_profile_refresh_enabled: bool = Field(
|
|
126
|
+
default=True,
|
|
127
|
+
description=(
|
|
128
|
+
"定时预热玩家档案:每小时把最近查询过的号重新拉一遍,"
|
|
129
|
+
"让用户查询永远命中缓存。需要 nonebot-plugin-apscheduler"
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
eft_profile_refresh_interval_hours: float = Field(
|
|
133
|
+
default=1.0,
|
|
134
|
+
description="档案预热的间隔(小时)",
|
|
135
|
+
)
|
|
136
|
+
eft_profile_refresh_max_accounts: int = Field(
|
|
137
|
+
default=50,
|
|
138
|
+
description="每轮预热最多刷新几个账号,防止请求量失控",
|
|
139
|
+
)
|
|
140
|
+
eft_profile_track_size: int = Field(
|
|
141
|
+
default=200,
|
|
142
|
+
description="最多记住多少个最近查询过的账号",
|
|
143
|
+
)
|
|
144
|
+
eft_index_enabled: bool = Field(
|
|
145
|
+
default=True,
|
|
146
|
+
description=(
|
|
147
|
+
"启用昵称搜索。首次使用会下载约 67MB 的玩家索引并转成 SQLite"
|
|
148
|
+
"(约 139MB 磁盘),之后查询走本地索引。"
|
|
149
|
+
"关掉则 /player 只能按角色 ID 查询"
|
|
150
|
+
),
|
|
151
|
+
)
|
|
152
|
+
eft_index_ttl: int = Field(
|
|
153
|
+
default=24 * 3600,
|
|
154
|
+
description=(
|
|
155
|
+
"玩家索引超过多久算过期(秒),默认 1 天——上游就是每天更新一次。"
|
|
156
|
+
"定时任务据此判断要不要重建;用户查询不会因为过期就触发下载"
|
|
157
|
+
),
|
|
158
|
+
)
|
|
159
|
+
eft_index_refresh_enabled: bool = Field(
|
|
160
|
+
default=True,
|
|
161
|
+
description=(
|
|
162
|
+
"定时更新昵称索引数据库。只在空闲时后台重建,"
|
|
163
|
+
"用户查询永远不等下载。需要 nonebot-plugin-apscheduler"
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
eft_index_refresh_interval_hours: float = Field(
|
|
167
|
+
default=24.0,
|
|
168
|
+
description=(
|
|
169
|
+
"昵称索引的更新间隔(小时)。注意单次 regular 索引下载有 67MB,"
|
|
170
|
+
"别设得太频繁"
|
|
171
|
+
),
|
|
172
|
+
)
|
|
173
|
+
eft_index_timeout: float = Field(
|
|
174
|
+
default=600.0,
|
|
175
|
+
description="玩家索引下载超时(秒)。67MB 且 CDN 时快时慢,给得比较宽",
|
|
176
|
+
)
|
|
177
|
+
eft_index_wait_timeout: float = Field(
|
|
178
|
+
default=60.0,
|
|
179
|
+
description=(
|
|
180
|
+
"昵称没搜到、且本地索引已过期时,先等索引更新再重搜的超时(秒)。"
|
|
181
|
+
"超时会让用户稍后重试,但更新会在后台继续跑完"
|
|
182
|
+
),
|
|
183
|
+
)
|
|
184
|
+
eft_index_background_cooldown: int = Field(
|
|
185
|
+
default=600,
|
|
186
|
+
description=(
|
|
187
|
+
"后台静默更新索引的最小间隔(秒)。防止每次查询都触发一次下载"
|
|
188
|
+
),
|
|
189
|
+
)
|
|
190
|
+
eft_index_max_candidates: int = Field(
|
|
191
|
+
default=10,
|
|
192
|
+
description="昵称命中多个账号时,最多列出几个候选",
|
|
193
|
+
)
|
|
194
|
+
eft_name_wait_timeout: float = Field(
|
|
195
|
+
default=45.0,
|
|
196
|
+
description=(
|
|
197
|
+
"多候选时等待用户回复序号的时间(秒)。"
|
|
198
|
+
"需要 nonebot-plugin-waiter,没装则直接列出候选让用户改用 ID"
|
|
199
|
+
),
|
|
200
|
+
)
|
|
201
|
+
eft_circle_price_factor: float = Field(
|
|
202
|
+
default=1.0,
|
|
203
|
+
description=(
|
|
204
|
+
"买 1 件时的额外系数。单价本身已经按 avg24h/low24h 的差距估算过,"
|
|
205
|
+
"这里默认 1.0;想整体再保守一点可以调大"
|
|
206
|
+
),
|
|
207
|
+
)
|
|
208
|
+
eft_circle_price_factor_step: float = Field(
|
|
209
|
+
default=0.02,
|
|
210
|
+
description=(
|
|
211
|
+
"每多买一件,单价系数再加这么多(买得越多越会把便宜挂单吃光)。"
|
|
212
|
+
"实测飞机模型买 4 件实际单价 45,000,估算走 42,829 × 1.06 = 45,400"
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
eft_circle_price_ttl: int = Field(
|
|
216
|
+
default=6 * 3600,
|
|
217
|
+
description=(
|
|
218
|
+
"邪教圈献祭推荐用的物品行情缓存有效期(秒)。"
|
|
219
|
+
"tarkov.dev 的价格本身是按天更新的,设太短只是白下 17MB"
|
|
220
|
+
),
|
|
221
|
+
)
|
|
222
|
+
eft_circle_default_threshold: int = Field(
|
|
223
|
+
default=350_001,
|
|
224
|
+
description=(
|
|
225
|
+
"邪教圈献祭阈值。默认 350001 = 14 小时档(稀有战利品概率大增);"
|
|
226
|
+
"改成 400000 就是 6 小时档 + 25% 概率出任务/藏身处物品"
|
|
227
|
+
),
|
|
228
|
+
)
|
|
229
|
+
eft_circle_max_same_item: int = Field(
|
|
230
|
+
default=0,
|
|
231
|
+
description=(
|
|
232
|
+
"同一件物品最多献祭几份。0 = 不限(数学最优解几乎总是「同一件买满」)。"
|
|
233
|
+
"游戏内实测重复放同一件是允许的,所以默认不限;"
|
|
234
|
+
"如果嫌推荐太单调可以设成 2 或 1"
|
|
235
|
+
),
|
|
236
|
+
)
|
|
237
|
+
eft_circle_max_items: int = Field(
|
|
238
|
+
default=5,
|
|
239
|
+
description="邪教圈最多献祭几件(游戏硬上限是 5)",
|
|
240
|
+
)
|
|
241
|
+
eft_circle_pool: int = Field(
|
|
242
|
+
default=30,
|
|
243
|
+
description=(
|
|
244
|
+
"组合搜索的候选池大小。越大越接近最优解,但耗时按组合数增长"
|
|
245
|
+
"(30 件搜 5 件约 28 万种组合)"
|
|
246
|
+
),
|
|
247
|
+
)
|
|
248
|
+
eft_circle_card_enabled: bool = Field(
|
|
249
|
+
default=True,
|
|
250
|
+
description=(
|
|
251
|
+
"把献祭推荐渲染成图片卡片(需要 Pillow)。"
|
|
252
|
+
"不可用或合成失败时自动退回纯文本"
|
|
253
|
+
),
|
|
254
|
+
)
|
|
255
|
+
eft_circle_also_send_text: bool = Field(
|
|
256
|
+
default=False,
|
|
257
|
+
description="卡片模式下是否额外再发一条纯文字(方便复制)",
|
|
258
|
+
)
|
|
259
|
+
eft_circle_warm_enabled: bool = Field(
|
|
260
|
+
default=True,
|
|
261
|
+
description=(
|
|
262
|
+
"定时预热邪教圈方案:提前把三个模式算好放内存,用户查询直接命中。"
|
|
263
|
+
"需要 nonebot-plugin-apscheduler"
|
|
264
|
+
),
|
|
265
|
+
)
|
|
266
|
+
eft_circle_warm_interval_minutes: float = Field(
|
|
267
|
+
default=10.0,
|
|
268
|
+
description=(
|
|
269
|
+
"预热间隔(分钟)。重算本身只要 0.1 秒,"
|
|
270
|
+
"真正的开销是 17MB 物品数据的下载,那个由 eft_circle_price_ttl 控制"
|
|
271
|
+
),
|
|
272
|
+
)
|
|
273
|
+
eft_circle_warm_on_start: bool = Field(
|
|
274
|
+
default=True,
|
|
275
|
+
description="启动时先预热一轮,不用等第一个 10 分钟周期",
|
|
276
|
+
)
|
|
277
|
+
eft_eftforge_enabled: bool = Field(
|
|
278
|
+
default=True,
|
|
279
|
+
description=(
|
|
280
|
+
"玩家卡片优先用 eftforge 的 Atlas 接口取档案。"
|
|
281
|
+
"它更新更快、自带全身立绘(Kitbash! 画的),还能省掉 tarkov.dev "
|
|
282
|
+
"那 2MB 的成就名字表;不可用时自动回退 tarkov.dev"
|
|
283
|
+
),
|
|
284
|
+
)
|
|
285
|
+
eft_eftforge_base: str = Field(
|
|
286
|
+
default="https://www.eftforge.com",
|
|
287
|
+
description="eftforge 站点根地址",
|
|
288
|
+
)
|
|
289
|
+
eft_eftforge_key: str = Field(
|
|
290
|
+
default="",
|
|
291
|
+
description=(
|
|
292
|
+
"可选的 Atlas key(X-Atlas-Key)。带上之后配额从每 IP 30 次/分"
|
|
293
|
+
"升到 40 次/分,缓存也从 60 秒升到 10 分钟"
|
|
294
|
+
),
|
|
295
|
+
)
|
|
296
|
+
eft_eftforge_art_brightness: float = Field(
|
|
297
|
+
default=0.85,
|
|
298
|
+
description=(
|
|
299
|
+
"eftforge 胸像的亮度系数(0~1,越小越暗)。"
|
|
300
|
+
"游戏内直出的胸像很亮,铺在深色卡片上会显得突兀"
|
|
301
|
+
),
|
|
302
|
+
)
|
|
303
|
+
eft_eftforge_ttl: int = Field(
|
|
304
|
+
default=600,
|
|
305
|
+
description="eftforge 玩家档案的本地缓存有效期(秒)",
|
|
306
|
+
)
|
|
307
|
+
eft_eftforge_timeout: float = Field(
|
|
308
|
+
default=20.0,
|
|
309
|
+
description="eftforge 请求超时(秒)。它是第三方服务,超时要压短,挂了就回退",
|
|
310
|
+
)
|