Skip to content

Commit

Permalink
1.0.1.0220
Browse files Browse the repository at this point in the history
  • Loading branch information
AcademicDog committed Feb 19, 2020
1 parent 27abc3a commit 61f88c6
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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,以减小文件体积。
Expand Down
5 changes: 5 additions & 0 deletions conf_example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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-否
Expand Down
34 changes: 34 additions & 0 deletions gameLib/fighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions gui/tkui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
'''
御灵参数
Expand Down Expand Up @@ -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: ' +
Expand All @@ -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')
Expand Down
3 changes: 3 additions & 0 deletions mitama/fighter_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def start(self):
YuhunPos.kaishizhandou_btn, mood2.get1mood()/1000)
self.log.writeinfo('Driver: 已进入战斗')

# 在战斗中,标记己方式神
self.mitama_team_click()

# 已经进入战斗,司机自动点怪
self.click_monster()

Expand Down
3 changes: 3 additions & 0 deletions mitama/fighter_passenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def start(self):
# 检测是否进入战斗
self.check_battle()

# 在战斗中,标记己方式神
self.mitama_team_click()

# 已经进入战斗,乘客自动点怪
self.click_monster()

Expand Down
3 changes: 3 additions & 0 deletions mitama/single_fight.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def start(self):
# 检测是否进入战斗
self.check_battle()

# 在战斗中,标记己方式神
self.mitama_team_click()

# 在战斗中,自动点怪
self.click_monster()

Expand Down
5 changes: 4 additions & 1 deletion ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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:
Expand Down

0 comments on commit 61f88c6

Please sign in to comment.