|
一楼为 自动刷玲珑内丹,每5-8分钟一个,python程序
# 黑神话悟空一天自动升级200灵光点,python程序
# https://www.66.ca/forum.php?mod=viewthread&tid=592925
# 1:下载安装python 地址:https://www.python.org/downloads/
####在windows工具栏搜索cmd,->管理员身份运行cmd, 安装python库,命令为: pip install pyautogui
# 2: 缩地到 盘丝岭->盘丝洞->碎玉池, 修改 上香->修行->法术整备->灰蛰 把 设置->修行->变化->增加变身攻击 加满
#### 修改 设置->键盘与鼠标: 疾奔->Ctrl 跳跃->Shift
# 3: 把程序保存为main.py, 按Windows键 在windows工具栏搜索cmd,->(重要)以管理员身份运行cmd,使用以下命令运行程序自动升级:
### D:\你自己电脑的python目录\python.exe D:\你自己电脑的程序目录\main.py
# 4: 使用Alt+Tab快捷键切换到cmd,使用 Ctrl+c 停止程序,或者直接关掉cmd停止程序。
- import time
- import pyautogui
- import win32gui
- import win32com.client
- class ModifiedRPGBot:
- def __init__(self):
- # 定义主要时间间隔为变量, 时间单位 “秒”
- self.initial_delay = 1
- self.interact_delay = 1
- self.escape_delay = 3
- self.move_d_time = 1.9
- self.move_w_time_1 = 2.3
- self.move_a_time_1 = 0.7
- self.move_w_time_2 = 1.7
- self.move_a_time_2 = 0.5
- self.action_delay = 1
- self.final_delay = 4
- self.cooldown_time = 17 # 根据电脑配置适当修改,建议15 - 25
- self.game_window_title = "b1" # 游戏窗口标题
- self.actions = [
- self.move_and_interact,
- self.complex_movement,
- self.repeated_action,
- self.final_action
- ]
- self.initial_setup()
- def list_window_names(self):
- def win_enum_handler(hwnd, ctx):
- if win32gui.IsWindowVisible(hwnd):
- window_text_name = win32gui.GetWindowText(hwnd)
- print(hex(hwnd), '"' + window_text_name + '"')
- if self.game_window_title in window_text_name:
- self.game_window_title = window_text_name
- win32gui.EnumWindows(win_enum_handler, None)
- def focus_game_window(self):
- print("正在寻找游戏窗口...")
- print("当前所有可见窗口:")
- self.list_window_names()
- game_window = win32gui.FindWindow(None, self.game_window_title)
- if game_window:
- print(f"找到游戏窗口: {self.game_window_title}")
- try:
- shell = win32com.client.Dispatch("WScript.Shell")
- shell.SendKeys('%')
- win32gui.SetForegroundWindow(game_window)
- print("已将游戏窗口置于前台")
- time.sleep(0.5)
- except Exception as e:
- print(f"将窗口置于前台时出错: {e}")
- else:
- print(f"找不到游戏窗口: {self.game_window_title}")
- print("请检查游戏是否运行,以及窗口标题是否正确")
- user_input = input("是否继续运行脚本?(y/n): ")
- if user_input.lower() != 'y':
- print("脚本已停止")
- exit(1)
- def initial_setup(self):
- self.focus_game_window()
- time.sleep(self.initial_delay)
- self.final_action()
- def move_and_interact(self):
- pyautogui.press('w')
- time.sleep(self.interact_delay)
- pyautogui.press('e')
- time.sleep(self.escape_delay)
- pyautogui.press('esc')
- time.sleep(self.interact_delay)
- def complex_movement(self):
- pyautogui.keyDown('ctrlleft')
- self.timed_key_press('d', self.move_d_time)
- self.timed_key_press('w', self.move_w_time_1)
- self.timed_key_press('a', self.move_a_time_1)
- self.timed_key_press('w', self.move_w_time_2)
- pyautogui.press('2')
- time.sleep(self.interact_delay)
- self.timed_key_press('a', self.move_a_time_2)
- pyautogui.keyUp('ctrlleft')
- def repeated_action(self):
- for _ in range(4):
- for _ in range(3):
- pyautogui.press('4')
- time.sleep(self.action_delay)
- time.sleep(self.final_delay)
- def final_action(self):
- pyautogui.press('q')
- time.sleep(self.cooldown_time)
- def timed_key_press(self, key, duration):
- pyautogui.keyDown(key)
- time.sleep(duration)
- pyautogui.keyUp(key)
- self.initial_delay = 1
- def run(self):
- while True:
- for action in self.actions:
- action()
- if __name__ == "__main__":
- bot = ModifiedRPGBot()
- bot.run()
复制代码 |
|