Skip to content

Commit

Permalink
1.0.1.0307
Browse files Browse the repository at this point in the history
  • Loading branch information
AcademicDog committed Mar 7, 2020
1 parent 9a026d7 commit e02dfc3
Show file tree
Hide file tree
Showing 18 changed files with 206 additions and 132 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

## v1.0.1.0307
#### Fixes (bugs & defects):
* 双开探索时,队长退出后等待1s再邀请队员。
* 重写了日志系统,使之更规范合理。
* 修复了双开御魂乘客、司机争相标记。
* 优化了最后截图保存,现在最后运行截图将会以时间作为文件名,而不是统一的full.png。
* 调整了UI菜单栏,增加了向说明页面的导向,添加donate按钮。
* 修复了探索打完BOSS后,没有宝箱使得无法有效退出的问题。

## v1.0.1.0304
#### New features:
* 探索双开
Expand Down
15 changes: 7 additions & 8 deletions explore/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def fight_moster(self, mood1, mood2):
mood1.moodsleep()
# 查看是否进入探索界面
self.yys.wait_game_img('img\\YING-BING.png')
self.log.writeinfo('进入探索页面')
self.log.info('进入探索页面')

# 寻找经验怪,未找到则寻找boss,再未找到则退出
fight_pos = self.find_exp_moster()
Expand All @@ -199,19 +199,19 @@ def fight_moster(self, mood1, mood2):
fight_pos = self.find_boss()
boss = True
if fight_pos == -1:
self.log.writeinfo('未找到经验怪和boss')
self.log.info('未找到经验怪和boss')
return -2
else:
self.log.writeinfo('未找到经验怪')
self.log.info('未找到经验怪')
return -1

# 攻击怪
self.click_until('怪', 'img/YING-BING.png', fight_pos, step_time=0.3, appear=False)
self.log.writeinfo('已进入战斗')
self.log.info('已进入战斗')

# 等待式神准备
self.yys.wait_game_img_knn('img\\ZHUN-BEI.png', thread=30)
logging.info('式神准备完成')
self.log.info('式神准备完成')

# 检查狗粮经验
self.check_exp_full()
Expand Down Expand Up @@ -250,16 +250,15 @@ def start(self):
if result == 1:
continue
elif result == 2:
time.sleep(1)
break
else:
self.log.writeinfo('移动至下一个场景')
self.log.info('移动至下一个场景')
self.next_scene()
i += 1

# 退出探索
self.switch_to_scene(3)
self.log.writeinfo('结束本轮探索')
self.log.info('结束本轮探索')
time.sleep(0.5)

# 检查游戏次数
Expand Down
2 changes: 1 addition & 1 deletion explore/explore_dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self):
for hwnd in hwndlist:
yys = GameControl(hwnd)
if yys.find_game_img('img/DUI.png', 1, (68, 242), (135, 306), thread=0.8):
self.driver = ExploreLeader(hwnd=hwnd)
self.driver = ExploreLeader(hwnd=hwnd, delay=True)
hwndlist.remove(hwnd)
logging.info('发现队长')
break
Expand Down
28 changes: 18 additions & 10 deletions explore/explore_leader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from explore.explore import ExploreFight
from tools.game_pos import TansuoPos
import tools.utilities as ut
from tools.logsystem import MyLog

import logging
import random
import time

Expand All @@ -12,12 +12,16 @@ class ExploreLeader(ExploreFight):
组队探索队长
'''

def __init__(self, hwnd=0):
def __init__(self, hwnd=0, delay=False):
'''
初始化
:param hwnd=0: 指定窗口句柄:0-否;其他-窗口句柄
:param mode=0: 狗粮模式:0-正常模式,1-组队后排狗粮
:param delay=False: 完成一轮探索后,是否等待1s再邀请下一轮
'''
ExploreFight.__init__(self, hwnd=hwnd, mode=1)
self.name = 'Leader: '
self.delay = delay
self.log = MyLog.dlogger

def prev_scene(self):
'''
Expand All @@ -38,9 +42,9 @@ def start(self):
mood3 = ut.Mood()
scene = self.get_scene()
if scene == 4:
logging.info('Leader: 已进入探索,就绪')
self.log.info('已进入探索,就绪')
else:
logging.warning('Leader: 请检查是否进入探索内,退出')
self.log.warning('请检查是否进入探索内,退出')
return

while self.run:
Expand All @@ -49,7 +53,7 @@ def start(self):
'img/DUI.png', 'img/YING-BING.png')
if maxVal_list[0] < 0.8 and maxVal_list[1] > 0.8:
# 队长退出,结束
logging.warning('Leader: 队员已退出,脚本结束')
self.log.warning('队员已退出,脚本结束')
self.yys.quit_game()

# 开始打怪
Expand All @@ -65,7 +69,7 @@ def start(self):
elif result == 2:
break
else:
self.log.writeinfo('Leader: 移动至下一个场景')
self.log.info('移动至下一个场景')
self.next_scene()
i += 1

Expand All @@ -77,11 +81,11 @@ def start(self):
fight_pos = self.yys.find_game_img('img/FIGHT.png')
# 攻击怪
self.yys.mouse_click_bg(fight_pos)
self.log.writeinfo('Leader: 已进入战斗')
self.log.info('已进入战斗')

# 等待式神准备
self.yys.wait_game_img_knn('img/ZHUN-BEI.png', thread=30)
logging.info('Leader: 式神准备完成')
self.log.info('式神准备完成')

# 检查狗粮经验
self.check_exp_full()
Expand All @@ -98,14 +102,18 @@ def start(self):
self.get_reward(mood2, state)

# 退出探索
self.log.writeinfo('Leader: 结束本轮探索')
self.log.info('结束本轮探索')
# 点击退出探索
self.click_until('退出按钮', 'img/QUE-REN.png',
*TansuoPos.quit_btn, 2)
# 点击确认
self.click_until('确认按钮', 'img/QUE-REN.png',
*TansuoPos.confirm_btn, 2, False)

# 等待司机退出1s
if self.delay:
time.sleep(1)

# 下一轮自动邀请
self.yys.wait_game_img('img/QUE-DING.png', self.max_win_time)
time.sleep(0.5)
Expand Down
16 changes: 8 additions & 8 deletions explore/explore_passenger.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from explore.explore import ExploreFight
from tools.game_pos import TansuoPos
from tools.logsystem import MyLog
import tools.utilities as ut

import logging
import time


Expand All @@ -16,7 +16,7 @@ def __init__(self, hwnd=0):
初始化
'''
ExploreFight.__init__(self, hwnd=hwnd)
self.name = 'Passenger: '
self.log = MyLog.plogger

def start(self):
'''
Expand All @@ -25,19 +25,19 @@ def start(self):
mood = ut.Mood(3)
scene = self.get_scene()
if scene == 4:
logging.info('Passenger: 已进入探索,就绪')
self.log.info('已进入探索,就绪')
else:
logging.warning('Passenger: 请检查是否进入探索内,退出')
self.log.warning('请检查是否进入探索内,退出')
return

while self.run:
# 检测当前场景
maxVal_list, maxLoc_list = self.yys.find_multi_img(
maxVal_list, _ = self.yys.find_multi_img(
'img/DUI.png', 'img/YING-BING.png')
# print(maxVal_list)
if maxVal_list[0] < 0.8 and maxVal_list[1] > 0.8:
# 队长退出,则跟着退出
logging.info('Passenger: 队长已退出,跟随退出')
self.log.info('队长已退出,跟随退出')
self.switch_to_scene(3)

# 等待邀请
Expand All @@ -47,15 +47,15 @@ def start(self):
# 点击接受邀请
if self.yys.find_game_img('img/JIE-SHOU.png'):
self.yys.mouse_click_bg((js_loc[0]+33, js_loc[1]+34))
self.log.writeinfo('Passenger: 接受邀请')
self.log.info('接受邀请')

# 检查游戏次数
self.check_times()

elif maxVal_list[0] > 0.8 and maxVal_list[1] < 0.8:
# 进入战斗,等待式神准备
self.yys.wait_game_img_knn('img/ZHUN-BEI.png', thread=30)
logging.info('Passenger: 式神准备完成')
self.log.info('式神准备完成')

# 检查狗粮经验
self.check_exp_full()
Expand Down
Loading

0 comments on commit e02dfc3

Please sign in to comment.