From 61f88c61ed578e2d9284bf30662387708060d488 Mon Sep 17 00:00:00 2001 From: YangHu Date: Wed, 19 Feb 2020 16:03:04 +0800 Subject: [PATCH] 1.0.1.0220 --- CHANGELOG.md | 7 +++++++ conf_example.ini | 5 +++++ gameLib/fighter.py | 34 ++++++++++++++++++++++++++++++++++ gui/tkui.py | 17 +++++++++++++++-- mitama/fighter_driver.py | 3 +++ mitama/fighter_passenger.py | 3 +++ mitama/single_fight.py | 3 +++ ui.py | 5 ++++- 8 files changed, 74 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a3e1bc..77c876b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## v1.0.1.0220 +#### New features: +* 根据[#22](https://github.com/AcademicDog/onmyoji_bot/issues/22),增加了御魂标记己方式神的选项。 +#### Fixes (bugs & defects): +* 修复了上一个版本无法选择所上卡片的bug。 +* 修复了UI中某些元素没对齐的bug。 + ## v1.0.1.0219 #### Fixes (bugs & defects): * 抛弃PyQt,用tkinter重写ui,以减小文件体积。 diff --git a/conf_example.ini b/conf_example.ini index c1a8e1a..7495bec 100644 --- a/conf_example.ini +++ b/conf_example.ini @@ -5,6 +5,11 @@ run_section = 0 #run_mode 运行模式:对于御魂0-单刷;1-司机;2-乘客;3-双开 run_mode = 0 +[mitama] +######御魂参数##### +#mitama_team_mark 御魂标记己方式神:0-不标记;1-标记第1个式神,2~5-以此类推 +mitama_team_mark = 0 + [watchdog] ######守护参数###### #watchdog_enable 是否超时自动关闭阴阳师:True-是;False-否 diff --git a/gameLib/fighter.py b/gameLib/fighter.py index 2925616..46eaeb2 100644 --- a/gameLib/fighter.py +++ b/gameLib/fighter.py @@ -30,6 +30,7 @@ def __init__(self, name='', emyc=0, hwnd=0): quit_game_enable = conf.getboolean('watchdog', 'watchdog_enable') self.max_op_time = conf.getint('watchdog', 'max_op_time') self.max_win_time = conf.getint('watchdog', 'max_win_time') + self.mitama_team_mark = conf.getint('mitama', 'mitama_team_mark') # 启动日志 self.log = WriteLog() @@ -64,6 +65,39 @@ def check_end(self): self.yys.wait_game_img('img\\JIE-SU.png', self.max_win_time) self.log.writeinfo(self.name + "战斗结束") + def mitama_team_click(self): + ''' + 御魂标记己方式神 + ''' + num = self.mitama_team_mark + if num > 0: + # 100 1040 + # 125 50 + # 御魂场景获取标记位置 + min = (num - 1) * 105 + (num - 1) * 100 + 95 + max = min + 50 + pos = (min, 355), (max, 425) + + start_time = time.time() + while time.time() - start_time <= 3: + x1 = pos[0][0] - 100 + y1 = pos[0][1] - 250 + x2 = pos[1][0] + 100 + y2 = pos[1][1] + exp_pos = self.yys.find_color( + ((x1, y1), (x2, y2)), (134, 227, 96), 5) + # print('颜色位置', exp_pos) + if exp_pos != -1: + self.log.writeinfo(self.name + '标记式神成功') + return True + else: + # 点击指定位置并等待下一轮 + self.yys.mouse_click_bg(*pos) + self.log.writeinfo(self.name + '标记式神') + time.sleep(0.4) + + self.log.writewarning(self.name + '标记式神失败') + def click_monster(self): # 点击怪物 pass diff --git a/gui/tkui.py b/gui/tkui.py index 738ffc2..ad32edf 100644 --- a/gui/tkui.py +++ b/gui/tkui.py @@ -132,7 +132,7 @@ def create_frame0(self): value=3).grid(row=1, column=1, sticky=tk.W) # 游戏副本 - submode = tk.LabelFrame(self.frame0, text='副本(调试中)', padx=5, pady=5) + submode = tk.LabelFrame(self.frame0, text='副本(调试中)') submode.pack(padx=5, pady=5, fill=tk.BOTH, expand=True) tk.Radiobutton(submode, text='八岐大蛇', variable=self.run_mode, value=0).grid(row=0, column=0, sticky=tk.W) @@ -141,6 +141,17 @@ def create_frame0(self): tk.Radiobutton(submode, text='卑弥呼', variable=self.run_mode, value=2).grid(row=1, column=0, sticky=tk.W) + # 标记式神 + mitama_mark = tk.Frame(self.frame0, padx=5, pady=5) + mitama_mark.pack(fill=tk.X, expand=True) + tk.Label(mitama_mark, text='标记己方式神:').pack(side=tk.LEFT) + self.mitama_team_mark = ttk.Combobox(mitama_mark, width = 10) + self.mitama_team_mark['value'] = ( + '不标记', '第1个式神', '第2个式神', '第3个式神', '第4个式神', '第5个式神') + self.mitama_team_mark.pack(fill=tk.X, expand=True, padx=2) + self.mitama_team_mark.current(0) + self.mitama_team_mark.config(state='readonly') + def create_frame1(self): ''' 御灵参数 @@ -251,6 +262,8 @@ def show_params(self): str(self.max_win_time.get())) self.params.insert(tk.END, '\nmax_op_time: ' + str(self.max_op_time.get())) + self.params.insert(tk.END, '\nmitama_team_mark: ' + + str(self.mitama_team_mark.current())) self.params.insert(tk.END, '\nfight_boss_enable: ' + str(self.fight_boss_enable.get())) self.params.insert(tk.END, '\nslide_shikigami: ' + @@ -260,7 +273,7 @@ def show_params(self): self.params.insert(tk.END, '\nzhunbei_delay: ' + str(self.zhunbei_delay.get())) self.params.insert(tk.END, '\nchange_shikigami: ' + - str(self.change_shikigami)) + str(self.cmb.current())) self.params.insert(tk.END, '\ndebug_enable: ' + str(self.debug_enable.get())+'\n') self.params.insert(tk.END, '##########################\n\n') diff --git a/mitama/fighter_driver.py b/mitama/fighter_driver.py index 0c5b71b..3881911 100644 --- a/mitama/fighter_driver.py +++ b/mitama/fighter_driver.py @@ -31,6 +31,9 @@ def start(self): YuhunPos.kaishizhandou_btn, mood2.get1mood()/1000) self.log.writeinfo('Driver: 已进入战斗') + # 在战斗中,标记己方式神 + self.mitama_team_click() + # 已经进入战斗,司机自动点怪 self.click_monster() diff --git a/mitama/fighter_passenger.py b/mitama/fighter_passenger.py index 9512fd1..66195dc 100644 --- a/mitama/fighter_passenger.py +++ b/mitama/fighter_passenger.py @@ -24,6 +24,9 @@ def start(self): # 检测是否进入战斗 self.check_battle() + # 在战斗中,标记己方式神 + self.mitama_team_click() + # 已经进入战斗,乘客自动点怪 self.click_monster() diff --git a/mitama/single_fight.py b/mitama/single_fight.py index c874355..e10a0a3 100644 --- a/mitama/single_fight.py +++ b/mitama/single_fight.py @@ -26,6 +26,9 @@ def start(self): # 检测是否进入战斗 self.check_battle() + # 在战斗中,标记己方式神 + self.mitama_team_click() + # 在战斗中,自动点怪 self.click_monster() diff --git a/ui.py b/ui.py index 297de38..953a1ab 100644 --- a/ui.py +++ b/ui.py @@ -43,6 +43,8 @@ def set_conf(self): # 御魂参数 self.conf.set('DEFAULT', 'run_mode', str(self.run_mode.get())) + self.conf.set('mitama', 'mitama_team_mark', + str(self.mitama_team_mark.current())) # 探索参数 self.conf.set('explore', 'fight_boss_enable', @@ -54,12 +56,13 @@ def set_conf(self): self.conf.set('explore', 'zhunbei_delay', str(self.zhunbei_delay.get())) self.conf.set('explore', 'change_shikigami', - str(self.change_shikigami)) + str(self.cmb.current())) def get_conf(self): # 添加配置 try: self.conf.add_section('watchdog') + self.conf.add_section('mitama') self.conf.add_section('explore') self.conf.add_section('others') except: