Skip to content

Commit

Permalink
Merge pull request #72 from infstellar/dev
Browse files Browse the repository at this point in the history
Dev -> Main
  • Loading branch information
infstellar authored Jun 25, 2023
2 parents c6b7ba2 + a225cbb commit a1aad0b
Show file tree
Hide file tree
Showing 84 changed files with 1,602 additions and 1,104 deletions.
21 changes: 4 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,6 @@ source/cvAutoTrack_5.7z
source/CVAUTOTRACK732.dll
source/cvAutoTrack_7.7z
source/cvAutoTrack_7.2.3/CVAUTOTRACK.dll
.idea/genshin_impact_assistant.iml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/libraries/base_library.xml
.idea/libraries/base_library1.xml
.idea/libraries/base_library2.xml
.idea/libraries/base_library3.xml
.idea/libraries/base_library4.xml
.idea/libraries/base_library5.xml
.idea/libraries/base_library6.xml
.idea/libraries/base_library7.xml
.idea/libraries/gui.xml
.idea/libraries/jpg_0928.xml
config/tastic/*.json
config/settings/*.json
config/auto_collector/*.json
Expand All @@ -182,6 +167,7 @@ source/test235.py
source/test236.py


# config
config/tactic/*.json
!config/tactic/team_example_1.json
!config/tactic/team_example_3.json
Expand All @@ -202,14 +188,15 @@ out/*
assets/dm/*
config/settings/damo.json
config/settings/dm.json


config/collection_path/*
!config/collection_path/.gitkeep

# Mission groups
config/mission/*.json

# Logs
Logs/*

# test file
source/test/test242.py
source/test/test251.py
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"dtype",
"Elast",
"Epress",
"excepthook",
"fastdeploy",
"fromarray",
"funclib",
Expand Down
2 changes: 1 addition & 1 deletion assets/imgs
4 changes: 4 additions & 0 deletions config/json_doc/Combat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ vision:
- Dendro
- Anemo
- ''
n:
type: int
priority:
type: int
4 changes: 4 additions & 0 deletions config/json_doc/Combat.zh_CN.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
AdaptiveTeamSetup:
doc: 自动识别角色并生成队伍
annotation: 启用后,优先寻找tactic文件夹中适合的战斗策略,如果没有,则自动生成策略。如果希望强制使用自定义的战斗策略请关闭此项。

E_long_cd_time:
annotation: 长Ecd时间,没有则为0
doc: 长元素战技cd时间
Expand Down
2 changes: 1 addition & 1 deletion config/json_template/General.jsontemplate
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"DeterminingStrictWeight":0.9,
"InteractionMode": "Desktop",
"Python32Path": "",
"Version":"v0.7.3.900"
"Version":"v0.8.5.0"
}
2 changes: 1 addition & 1 deletion genshin_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def server_thread():
input(source.util.t2t('程序暂停。按任意键退出'))

try:
import source.common.generic_event
import source.generic_event
except Exception as error:
source.util.logger.critical(source.util.t2t("导入依赖时错误"))
IMPORT_ERROR_2.log()
Expand Down
16 changes: 8 additions & 8 deletions source/api/pdocr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def get_text_position(self,
def get_all_texts(self, img, mode=0):
res = self.analyze(img)
if mode==1:
return ','.join(str(i) for i in res.text).replace(',','')
return res.text
return ','.join(str(self._replace_texts(i)) for i in res.text).replace(',','')
return [self._replace_texts(i) for i in res.text]

def is_img_num(self, im_src):
pdocr_timer_performance.reset()
Expand Down Expand Up @@ -188,12 +188,12 @@ def is_img_num_plus(self, im_src):

if __name__ == '__main__':
ocr = PaddleOcrFastDeploy()
imsrc = cv2.imread("D:\\test2.jpg")
r = ocr.get_text_position(imsrc, "VsCode")
print(r)# boxes, rec_scores, text
imsrc = cv2.imread("D:\\test.jpg")
r = ocr.get_text_position(imsrc, "VsCode")
print(r)# boxes, rec_scores, text
# imsrc = cv2.imread("D:\\test2.jpg")
# r = ocr.get_text_position(imsrc, "VsCode")
# print(r)# boxes, rec_scores, text
# imsrc = cv2.imread("D:\\test.jpg")
# r = ocr.get_text_position(imsrc, "VsCode")
print(ocr._replace_texts('纳西姐'))# boxes, rec_scores, text



Expand Down
File renamed without changes.
Empty file added source/combat/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
from source.manager import asset
from source.common.base_threading import AdvanceThreading
from source.interaction.interaction_core import itt
from source.operator.switch_character_operator import SwitchCharacterOperator
from source.combat.switch_character_operator import SwitchCharacterOperator
from source.path_lib import CONFIG_PATH_SETTING

CHARACTER_DIED = 1
MODE_NORMAL = 'Normal'
MODE_SHIELD = 'Shield'
MODE_CORE = "Core"
MODE_RECOVER = 'Recover'



Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from source.common import character
from source.funclib import combat_lib
from source.operator import tactic_operator
from source.combat import tactic_operator
from source.common.base_threading import BaseThreading
from source.interaction.interaction_core import itt
from common.timer_module import Timer, AdvanceTimer
from source.util import *
from source.manager import asset
from source.operator.aim_operator import AimOperator
from source.combat.aim_operator import AimOperator
from source.api.pdocr_complete import ocr
from source.funclib import movement
from source.ui.ui import ui_control
Expand Down Expand Up @@ -216,7 +216,7 @@ def _switch_character(self, x: int) -> bool:
movement.jump_timer_reset()
movement.jump_in_loop(jump_dt=3)
if i > 45:
movement.move([movement.AHEAD,movement.LEFT,movement.RIGHT,movement.BACK][i], distance=3)
movement.move([movement.AHEAD,movement.LEFT,movement.RIGHT,movement.BACK][i%4], distance=3)
if i > 55:
logger.warning('角色切换失败')
logger.trace(f"sco loop cost: {time.time()-pt}")
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion source/commission/assets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from source.manager.asset import Text
from source.manager.asset import Text, ImgIcon

IconCommissionCommissionComplete = ImgIcon()

BasicKnowledgeOfTheKnights = Text(zh="西风骑士的基础知识",en="Basic Knowledge of the Knights")
CrisisOfShields = Text(zh="持盾的危机", en="Crisis of Shields")
Expand Down
2 changes: 1 addition & 1 deletion source/commission/commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from source.manager.asset import Text
from source.commission.assets import *
from source.commission.util import *
from source.flow.cvars import *
from source.flow.utils.cvars import *

class Commission(CommissionTemplate):
"""
Expand Down
3 changes: 3 additions & 0 deletions source/commission/commission_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from source.task.task_template import TaskTemplate
from source.commission.commission_parser import CommissionParser
from source.commission.commission_acquisition import get_commission_object
from source.ui.ui import ui_control
from source.ui import page as UIPage

class CommissionExecutor(TaskTemplate, CommissionParser):
def __init__(self):
Expand All @@ -20,6 +22,7 @@ def loop(self):
if i["done"]: # this commission obj has been done.
logger.info(f"{i['type']} has been done.")
continue
ui_control.ensure_page(UIPage.page_main)
self._add_sub_threading(co)
co.continue_threading() # start commission obj
while 1:
Expand Down
23 changes: 16 additions & 7 deletions source/commission/commission_index.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
"""This file is generated automatically. Do not manually modify it."""
COMMISSION_INDEX = {'ASmallStepForHilichurls_N1000P1000': {'type': 'ASmallStepForHilichurls', 'position': [-1000, 1000]}, 'BasicKnowledgeOfTheKnights_P2682N5673': {'type': 'BasicKnowledgeOfTheKnights', 'position': [2682, -5673]}, 'BigPudgyProblem_P2469N4886': {'type': 'BigPudgyProblem', 'position': [2469, -4886]}, 'BigPudgyProblem_P2526N5796': {'type': 'BigPudgyProblem', 'position': [2526, -5796]}, 'LanguageExchange_P3060N5078': {'type': 'LanguageExchange', 'position': [3060, -5078]}, 'PigeonsGoAWOL_P2671N5095': {'type': 'PigeonsGoAWOL', 'position': [2671, -5095]}, 'TheUnnoticedGuy_P2568N5889': {'type': 'TheUnnoticedGuy', 'position': [2568, -5889]}}
COMMISSION_INDEX = {'BasicKnowledgeOfTheKnights_P2682N5673': {'type': 'BasicKnowledgeOfTheKnights', 'position': [2682, -5673]}, 'FloralFresh_P2556N5813': {'type': 'FloralFresh', 'position': [2556, -5813]}, 'FreshFlora_P2648N5726': {'type': 'FreshFlora', 'position': [2648, -5726]}, 'LanguageExchange_P3060N5078': {'type': 'LanguageExchange', 'position': [3060, -5078]}, 'LanguageExchange_P960N6796': {'type': 'LanguageExchange', 'position': [960, -6796]}, 'PigeonsGoAWOL_P2671N5095': {'type': 'PigeonsGoAWOL', 'position': [2671, -5095]}, 'ReliableHelper_P2966N4774': {'type': 'ReliableHelper', 'position': [2966, -4774]}, 'TheUnnoticedGuy_P2568N5889': {'type': 'TheUnnoticedGuy', 'position': [2568, -5889]}, 'TheWannabeKnight_P2251N5771': {'type': 'TheWannabeKnight', 'position': [2251, -5771]}}
def get_commission_object(commission_name:str):
if commission_name == 'BasicKnowledgeOfTheKnights_P2682N5673':
import source.commission.commissions.BasicKnowledgeOfTheKnights_P2682N5673
return source.commission.commissions.BasicKnowledgeOfTheKnights_P2682N5673.BasicKnowledgeOfTheKnights_P2682N5673()
if commission_name == 'BigPudgyProblem_P2469N4886':
import source.commission.commissions.BigPudgyProblem_P2469N4886
return source.commission.commissions.BigPudgyProblem_P2469N4886.BigPudgyProblem_P2469N4886()
if commission_name == 'BigPudgyProblem_P2526N5796':
import source.commission.commissions.BigPudgyProblem_P2526N5796
return source.commission.commissions.BigPudgyProblem_P2526N5796.BigPudgyProblem_P2526N5796()
if commission_name == 'FloralFresh_P2556N5813':
import source.commission.commissions.FloralFresh_P2556N5813
return source.commission.commissions.FloralFresh_P2556N5813.FloralFresh_P2556N5813()
if commission_name == 'FreshFlora_P2648N5726':
import source.commission.commissions.FreshFlora_P2648N5726
return source.commission.commissions.FreshFlora_P2648N5726.FreshFlora_P2648N5726()
if commission_name == 'LanguageExchange_P3060N5078':
import source.commission.commissions.LanguageExchange_P3060N5078
return source.commission.commissions.LanguageExchange_P3060N5078.LanguageExchange_P3060N5078()
if commission_name == 'LanguageExchange_P960N6796':
import source.commission.commissions.LanguageExchange_P960N6796
return source.commission.commissions.LanguageExchange_P960N6796.LanguageExchange_P960N6796()
if commission_name == 'PigeonsGoAWOL_P2671N5095':
import source.commission.commissions.PigeonsGoAWOL_P2671N5095
return source.commission.commissions.PigeonsGoAWOL_P2671N5095.PigeonsGoAWOL_P2671N5095()
if commission_name == 'ReliableHelper_P2966N4774':
import source.commission.commissions.ReliableHelper_P2966N4774
return source.commission.commissions.ReliableHelper_P2966N4774.ReliableHelper_P2966N4774()
if commission_name == 'TheUnnoticedGuy_P2568N5889':
import source.commission.commissions.TheUnnoticedGuy_P2568N5889
return source.commission.commissions.TheUnnoticedGuy_P2568N5889.TheUnnoticedGuy_P2568N5889()
if commission_name == 'TheWannabeKnight_P2251N5771':
import source.commission.commissions.TheWannabeKnight_P2251N5771
return source.commission.commissions.TheWannabeKnight_P2251N5771.TheWannabeKnight_P2251N5771()
10 changes: 7 additions & 3 deletions source/commission/commission_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ def traverse_mondstant(self):

itt.move_and_click(list(i))
itt.delay("animation")
for i in range(3):
com_type = self._detect_commission_type()
if com_type != None:
break
else:
itt.delay("2animation")
itt.delay("animation")
itt.delay("animation")
com_type = self._detect_commission_type()
itt.delay("animation")

while 1:
itt.key_press('esc')
itt.delay("2animation")
Expand Down
17 changes: 13 additions & 4 deletions source/commission/commission_template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from source.util import *
from source.commission.util import *
from source.mission.mission_template import MissionExecutor
from source.map.position.position import *
from source.interaction.interaction_core import itt
Expand Down Expand Up @@ -30,10 +30,19 @@ def talk_until_switch(self, stop_func=None):
if stop_func is None:stop_func=self.checkup_stop_func
return super().talk_until_switch(stop_func)

def is_mission_succ(self):
pass
# itt.capture()
def rec_commission_complete(self):
r = itt.appear(IconCommissionCommissionComplete)
if r:
logger.info(t2t('commission complete'))
return r

def fight_until_commission_complete(self):
self.start_combat()
while 1:
time.sleep(0.2)
if self.rec_commission_complete(): break
self.stop_combat()

def is_commission_complete(self):
if self.is_commission_start == False:
if self.is_in_commission():
Expand Down
22 changes: 0 additions & 22 deletions source/commission/commissions/BigPudgyProblem_P2469N4886.py

This file was deleted.

22 changes: 0 additions & 22 deletions source/commission/commissions/BigPudgyProblem_P2526N5796.py

This file was deleted.

4 changes: 2 additions & 2 deletions source/commission/commissions/LanguageExchange_P3060N5078.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from source.commission.commission import *

class LanguageExchange_P3060N5078(CommissionTemplate):
class LanguageExchange_P3060N5078(Commission):
def __init__(self):
CommissionTemplate.__init__(self, "LanguageExchange", [3060,-5078], is_CFCF=True, is_TMCF=True)
super().__init__("LanguageExchange", [3060,-5078], is_CFCF=True, is_TMCF=True)

def exec_mission(self):
self.move_along("LanguageExchange20230414230230i0", is_precise_arrival=True)
Expand Down
42 changes: 42 additions & 0 deletions source/commission/commissions/LanguageExchange_P960N6796.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions source/commission/general/DangerousHaul.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def exec_mission(self):
if not combat_lib.CSDL.get_combat_state():
self.stop_combat()
break
if self.rec_commission_complete():
self.stop_combat()
break
self.commission_succ()
# self.pause_threading()

Expand Down
2 changes: 1 addition & 1 deletion source/commission/general/IncreasingDanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def exec_mission(self):
movement.jump_in_loop(6)
if self._aim_to_commission_icon():
if attack_timer.reached_and_reset():itt.left_click()
if self.is_commission_complete():
if self.rec_commission_complete():
self.stop_combat()
break
self.commission_succ()
Expand Down
19 changes: 12 additions & 7 deletions source/commission/general/OnlyFight.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
from source.commission.commission_template import CommissionTemplate
from source.commission.commission import *
from source.mission.mission_template import ERR_FAIL


class FightOnlyGeneral(CommissionTemplate):
class FightOnlyGeneral(Commission):
def __init__(self, commission_type, commission_position):
super().__init__(commission_type, commission_position)

def exec_mission(self):
r = self.move_straight(self.commission_position, is_tp=True)
if r == ERR_FAIL:return
self.circle_search(self.commission_position, stop_rule="Combat")
r = self.collect(is_combat=True, is_activate_pickup=self.is_pickup_spoils)
if r == ERR_FAIL:return
r = self.move_straight(self.commission_position, is_tp=True, stop_rule=STOP_RULE_COMBAT)
self.handle_tmf_stuck_then_raise(r)

self.circle_search(self.commission_position, stop_rule=STOP_RULE_COMBAT)

self.fight_until_commission_complete()

if self.is_pickup_spoils:
r = self.collect(is_activate_pickup=self.is_pickup_spoils)
if r == ERR_FAIL:return
self.commission_succ()


Loading

0 comments on commit a1aad0b

Please sign in to comment.