Mobile step 6: client-side auto hunt with AUTO button
Engine-free AutoHunt state machine (search/engage/loot/return/paused) driven from the game loop through the existing manual paths: move target, target packet, normal attack, quickslot skills, item pick-up and belt potions. player.SetAutoHunt/GetAutoHuntState/SetAutoHuntOption with autohunt.cfg; AUTO button on the combat wheel (tap toggles, long press opens settings). Tests: ava2.auto_hunt, extended ava2.touch_game; 54/54. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ed2c185135
commit
64d25e3571
@@ -8,6 +8,7 @@ import wndMgr
|
||||
import touch
|
||||
import constInfo
|
||||
import ui_mobile_widgets as widgets
|
||||
import ui_mobile_autohunt
|
||||
|
||||
class MobileCombatWheel(ui.Window):
|
||||
"""
|
||||
@@ -17,10 +18,12 @@ class MobileCombatWheel(ui.Window):
|
||||
- 攻击键外两圈共 8 个快捷格 = 当前快捷页的 8 格(PC 任务栏 1-4 / F1-F4 同一份数据),
|
||||
第 4 页留给底部药水栏,所以这里只在第 1-3 页间切换
|
||||
- 小按钮:快捷页切换、上下马(原版 Ctrl+G 的 /ride)、拾取(原版 ` / Z 键)
|
||||
- AUTO 键(第 6 步自动狩猎,ui_mobile_autohunt.py):轻点开关,长按设置
|
||||
"""
|
||||
ATTACK_RADIUS = 60
|
||||
SLOT_DIAMETER = 50
|
||||
SMALL_DIAMETER = 40
|
||||
AUTO_DIAMETER = 46
|
||||
# (半径, 角度):角度从 +x 逆时针,内外圈各 4 格,外圈错开半格;相邻格间距大于格子直径
|
||||
SLOT_LAYOUT = [(108, 90), (108, 120), (108, 150), (108, 180),
|
||||
(172, 97.5), (172, 122.5), (172, 147.5), (172, 172.5)]
|
||||
@@ -87,6 +90,10 @@ class MobileCombatWheel(ui.Window):
|
||||
self.mount_button.SetLabel("Ride")
|
||||
self.pickup_button = self.__MakeSmall(cx - 86 - d / 2, cy + 82 - d / 2, ui.__mem_func__(self.__OnPickUp))
|
||||
self.pickup_button.SetLabel("Pick")
|
||||
self.auto_button = ui_mobile_autohunt.AutoHuntButton(self.AUTO_DIAMETER)
|
||||
self.auto_button.SetParent(self)
|
||||
self.auto_button.SetPosition(cx + 70 - self.AUTO_DIAMETER / 2, cy - 160 - self.AUTO_DIAMETER / 2)
|
||||
self.auto_button.Show()
|
||||
|
||||
self.page = -1
|
||||
self.lastRefresh = 0
|
||||
@@ -135,6 +142,7 @@ class MobileCombatWheel(ui.Window):
|
||||
if pressed != self.attack_pressed:
|
||||
self.attack_pressed = pressed
|
||||
self.attack_disc.SetStyle(widgets.STYLE_ATTACK_DOWN if pressed else widgets.STYLE_ATTACK)
|
||||
self.auto_button.OnUpdate()
|
||||
|
||||
# 与 uitaskbar.TaskBar.OnUpdate 相同的 500 ms 刷新(冷却、数量、激活状态)
|
||||
if app.GetGlobalTime() - self.lastRefresh > 500:
|
||||
|
||||
Reference in New Issue
Block a user