Skip to content

Commit 62cbb48

Browse files
committed
feat: 每日采购-采购普通商店-特别商店
1 parent a9d35eb commit 62cbb48

4 files changed

Lines changed: 225 additions & 77 deletions

File tree

agent/customs/special_treat/store.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from maa.custom_action import CustomAction
88
from maa.context import Context
99

10+
import time
11+
1012
from agent.customs.utils import Prompter
1113
from agent.customs.maahelper import ParamAnalyzer, Tasker
1214

@@ -93,3 +95,41 @@ def run(self, context: Context, argv: CustomAction.RunArg) -> bool:
9395
return True
9496
except Exception as e:
9597
return Prompter.error("购买指定商品", e)
98+
99+
100+
@AgentServer.custom_action("special_buy")
101+
class SpecialBuy(CustomAction):
102+
"""特殊商品购买自定义动作类。
103+
104+
处理商店中特殊商品的批量购买操作,按固定网格位置依次购买。
105+
"""
106+
107+
def run(self, context: Context, argv: CustomAction.RunArg) -> bool:
108+
"""执行特殊商品批量购买操作。
109+
110+
Args:
111+
context:MaaFW 上下文对象
112+
argv:自定义动作参数(本动作无需额外参数)
113+
114+
Returns:
115+
bool:购买操作是否成功
116+
"""
117+
try:
118+
# 按 2行3列 网格遍历购买商品
119+
for i in range(2): # 行
120+
for j in range(3): # 列
121+
Prompter.log(f"购买第 {i+1}{j+1} 列商品")
122+
Tasker(context).run(
123+
"每日采购_购买商品",
124+
{
125+
"每日采购_查看商品详情": {
126+
"recognition": "DirectHit",
127+
"target": [660 + j * 224, 174 + i * 220, 1, 1],
128+
},
129+
},
130+
)
131+
time.sleep(0.4)
132+
133+
return True
134+
except Exception as e:
135+
return Prompter.error("购买特殊商品", e)

assets/resource/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
## 主要内容
66

7+
- **新增选项**
8+
- 每日采购-采购普通商店-特别商店
79
- **问题修复**
810
- 修复无法从更新结束界面进入游戏的问题
911
- 修复进入主界面后无法关闭公告的问题

0 commit comments

Comments
 (0)