Skip to content

Commit 5c323d6

Browse files
committed
feat: Enhance PC Logic Adapter with new state conversion and decision-making features
1 parent df31f5f commit 5c323d6

10 files changed

Lines changed: 780 additions & 40 deletions

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,14 @@ TFT Hextech Helper 是一款基于 Electron + React + TypeScript 开发的云顶
179179

180180
- `npm run data:refresh`:拉取官方 TFT 数据(英雄/装备/羁绊/阵容)并刷新本地快照
181181
- `npm run pc:logic -- <state-json-path>`:对离线局面运行 PC 逻辑引擎,输出动作计划
182+
- `npm run state:convert -- <liveclient+ocr.json> <observed-state.json>`:将原始对局抓取数据转换为逻辑引擎输入
182183
- `npm run test:unit`:执行迁移新增核心单元测试(决策引擎 + 数据管线)
183184
- `npm run typecheck:migration`:仅检查迁移新增模块的 TypeScript 类型
184185

186+
示例输入/输出:
187+
- 原始抓取样例:`examples/liveclient-ocr-raw.sample.json`
188+
- 可直接用于 `pc:logic` 的样例:`examples/pc-observed-state.real-match.json`
189+
185190
## 版权说明
186191

187192
本项目采用 **CC BY-NC-ND 4.0** 协议,这意味着:
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"metadata": {
3+
"description": "Realistic mixed payload: Riot LiveClient allgamedata + OCR extraction",
4+
"references": [
5+
"https://juejin.cn/post/7370244444282667034",
6+
"https://github.com/jfd02/TFT-OCR-BOT"
7+
]
8+
},
9+
"liveclient": {
10+
"activePlayer": {
11+
"level": 6,
12+
"currentGold": 38,
13+
"championStats": {
14+
"currentHealth": 64
15+
}
16+
}
17+
},
18+
"ocr": {
19+
"stageText": "3-2",
20+
"stageType": "PVP",
21+
"bench": [
22+
{
23+
"id": "TFT16_Aphelios",
24+
"name": "厄斐琉斯",
25+
"star": 2,
26+
"cost": 2,
27+
"location": "SLOT_1",
28+
"items": [],
29+
"traits": ["巨神峰", "狙神"]
30+
},
31+
{
32+
"id": "TFT16_Bard",
33+
"name": "巴德",
34+
"star": 1,
35+
"cost": 3,
36+
"location": "SLOT_2",
37+
"items": [],
38+
"traits": ["星界游神", "神谕者"]
39+
},
40+
{
41+
"id": "TFT16_DrMundo",
42+
"name": "蒙多医生",
43+
"star": 1,
44+
"cost": 3,
45+
"location": "SLOT_3",
46+
"items": [],
47+
"traits": ["祖安", "斗士"]
48+
}
49+
],
50+
"board": [
51+
{
52+
"id": "TFT16_Sion",
53+
"name": "赛恩",
54+
"star": 2,
55+
"cost": 2,
56+
"location": "R4_C4",
57+
"items": ["日炎斗篷"],
58+
"traits": ["诺克萨斯", "斗士"]
59+
},
60+
{
61+
"id": "TFT16_Shen",
62+
"name": "",
63+
"star": 2,
64+
"cost": 1,
65+
"location": "R4_C3",
66+
"items": [],
67+
"traits": ["艾欧尼亚", "护卫"]
68+
},
69+
{
70+
"id": "TFT16_Illaoi",
71+
"name": "俄洛伊",
72+
"star": 1,
73+
"cost": 1,
74+
"location": "R4_C2",
75+
"items": [],
76+
"traits": ["比尔吉沃特", "斗士"]
77+
},
78+
{
79+
"id": "TFT16_Aphelios",
80+
"name": "厄斐琉斯",
81+
"star": 1,
82+
"cost": 2,
83+
"location": "R1_C6",
84+
"items": ["鬼索的狂暴之刃"],
85+
"traits": ["巨神峰", "狙神"]
86+
},
87+
{
88+
"id": "TFT16_Bard",
89+
"name": "巴德",
90+
"star": 1,
91+
"cost": 3,
92+
"location": "R1_C2",
93+
"items": [],
94+
"traits": ["星界游神", "神谕者"]
95+
},
96+
{
97+
"id": "TFT16_Warwick",
98+
"name": "沃里克",
99+
"star": 1,
100+
"cost": 4,
101+
"location": "R3_C1",
102+
"items": [],
103+
"traits": ["祖安", "裁决战士"]
104+
}
105+
],
106+
"shop": [
107+
{ "slot": 0, "name": "厄斐琉斯", "cost": 2 },
108+
{ "slot": 1, "name": "巴德", "cost": 3 },
109+
{ "slot": 2, "name": "沃利贝尔", "cost": 5 },
110+
{ "slot": 3, "name": "", "cost": 1 },
111+
{ "slot": 4, "name": "赛恩", "cost": 2 }
112+
],
113+
"items": ["无尽之刃", "锁子甲", "女神之泪"]
114+
}
115+
}
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
{
2+
"timestamp": 1772419318704,
3+
"client": "RIOT_PC",
4+
"target": "PC_LOGIC",
5+
"stageText": "3-2",
6+
"stageType": "PVP",
7+
"level": 6,
8+
"currentXp": 0,
9+
"totalXp": 0,
10+
"gold": 38,
11+
"hp": 64,
12+
"bench": [
13+
{
14+
"id": "TFT16_Aphelios",
15+
"name": "厄斐琉斯",
16+
"star": 2,
17+
"cost": 2,
18+
"location": "SLOT_1",
19+
"items": [],
20+
"traits": [
21+
"巨神峰",
22+
"狙神"
23+
]
24+
},
25+
{
26+
"id": "TFT16_Bard",
27+
"name": "巴德",
28+
"star": 1,
29+
"cost": 3,
30+
"location": "SLOT_2",
31+
"items": [],
32+
"traits": [
33+
"星界游神",
34+
"神谕者"
35+
]
36+
},
37+
{
38+
"id": "TFT16_DrMundo",
39+
"name": "蒙多医生",
40+
"star": 1,
41+
"cost": 3,
42+
"location": "SLOT_3",
43+
"items": [],
44+
"traits": [
45+
"祖安",
46+
"斗士"
47+
]
48+
}
49+
],
50+
"board": [
51+
{
52+
"id": "TFT16_Sion",
53+
"name": "赛恩",
54+
"star": 2,
55+
"cost": 2,
56+
"location": "R4_C4",
57+
"items": [
58+
"日炎斗篷"
59+
],
60+
"traits": [
61+
"诺克萨斯",
62+
"斗士"
63+
]
64+
},
65+
{
66+
"id": "TFT16_Shen",
67+
"name": "",
68+
"star": 2,
69+
"cost": 1,
70+
"location": "R4_C3",
71+
"items": [],
72+
"traits": [
73+
"艾欧尼亚",
74+
"护卫"
75+
]
76+
},
77+
{
78+
"id": "TFT16_Illaoi",
79+
"name": "俄洛伊",
80+
"star": 1,
81+
"cost": 1,
82+
"location": "R4_C2",
83+
"items": [],
84+
"traits": [
85+
"比尔吉沃特",
86+
"斗士"
87+
]
88+
},
89+
{
90+
"id": "TFT16_Aphelios",
91+
"name": "厄斐琉斯",
92+
"star": 1,
93+
"cost": 2,
94+
"location": "R1_C6",
95+
"items": [
96+
"鬼索的狂暴之刃"
97+
],
98+
"traits": [
99+
"巨神峰",
100+
"狙神"
101+
]
102+
},
103+
{
104+
"id": "TFT16_Bard",
105+
"name": "巴德",
106+
"star": 1,
107+
"cost": 3,
108+
"location": "R1_C2",
109+
"items": [],
110+
"traits": [
111+
"星界游神",
112+
"神谕者"
113+
]
114+
},
115+
{
116+
"id": "TFT16_Warwick",
117+
"name": "沃里克",
118+
"star": 1,
119+
"cost": 4,
120+
"location": "R3_C1",
121+
"items": [],
122+
"traits": [
123+
"祖安",
124+
"裁决战士"
125+
]
126+
}
127+
],
128+
"shop": [
129+
{
130+
"slot": 0,
131+
"cost": 2,
132+
"unit": {
133+
"id": "厄斐琉斯",
134+
"name": "厄斐琉斯",
135+
"star": 1,
136+
"cost": 2,
137+
"items": [],
138+
"traits": []
139+
}
140+
},
141+
{
142+
"slot": 1,
143+
"cost": 3,
144+
"unit": {
145+
"id": "巴德",
146+
"name": "巴德",
147+
"star": 1,
148+
"cost": 3,
149+
"items": [],
150+
"traits": []
151+
}
152+
},
153+
{
154+
"slot": 2,
155+
"cost": 5,
156+
"unit": {
157+
"id": "沃利贝尔",
158+
"name": "沃利贝尔",
159+
"star": 1,
160+
"cost": 5,
161+
"items": [],
162+
"traits": []
163+
}
164+
},
165+
{
166+
"slot": 3,
167+
"cost": 1,
168+
"unit": {
169+
"id": "",
170+
"name": "",
171+
"star": 1,
172+
"cost": 1,
173+
"items": [],
174+
"traits": []
175+
}
176+
},
177+
{
178+
"slot": 4,
179+
"cost": 2,
180+
"unit": {
181+
"id": "赛恩",
182+
"name": "赛恩",
183+
"star": 1,
184+
"cost": 2,
185+
"items": [],
186+
"traits": []
187+
}
188+
}
189+
],
190+
"items": [
191+
"无尽之刃",
192+
"锁子甲",
193+
"女神之泪"
194+
],
195+
"metadata": {
196+
"description": "Realistic mixed payload: Riot LiveClient allgamedata + OCR extraction",
197+
"references": [
198+
"https://juejin.cn/post/7370244444282667034",
199+
"https://github.com/jfd02/TFT-OCR-BOT"
200+
],
201+
"source": "liveclient+ocr"
202+
}
203+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"test:unit": "node --import tsx --test tests/backend/**/*.test.ts",
2020
"pc:logic": "tsx scripts/run-pc-logic.ts",
2121
"data:refresh": "tsx scripts/refresh-tft-data.ts",
22+
"state:convert": "tsx scripts/convert-liveclient-to-observed.ts",
2223
"postinstall": "electron-builder install-app-deps",
2324
"pack": "npm run build && electron-builder --dir",
2425
"dist": "electron-vite build && electron-builder --win --mac --linux",

0 commit comments

Comments
 (0)