Skip to content

Commit

Permalink
Feature: better new ship handle
Browse files Browse the repository at this point in the history
  • Loading branch information
guoh064 committed Aug 29, 2024
1 parent 9df0c4b commit 0d2db64
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"ResearchRecord": "do_not",
"CommissionRecord": "do_not",
"CombatRecord": "do_not",
"NewShipRecord": "do_not",
"OpsiRecord": "do_not",
"MeowfficerBuy": "do_not",
"MeowfficerTalent": "do_not"
Expand Down
33 changes: 28 additions & 5 deletions module/combat/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,23 +373,46 @@ def handle_exp_info(self):

return False

def handle_get_ship(self, drop=None):
def handle_get_ship(self, drop=None, skip_first_screenshot=True):
"""
Args:
drop (DropImage):
Returns:
bool:
"""
if self.appear_then_click(GET_SHIP, interval=1):
if not self.appear(GET_SHIP, interval=5):
return False

if 'save' in self.config.DropRecord_NewShipRecord:
confirm_timer = Timer(3)
else:
confirm_timer = Timer(1)

confirm_timer.start()
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()

# End
if confirm_timer.reached():
break

if self.appear(NEW_SHIP):
logger.info('Get a new SHIP')
if drop:
drop.handle_add(self)
with self.stat.new(
genre='new_ship',
method=self.config.DropRecord_NewShipRecord
) as drop2:
drop2.handle_add(self, before=1.0)
self.config.GET_SHIP_TRIGGERED = True
return True

return False
break
self.device.click(GET_SHIP)
return True

def handle_combat_mis_click(self):
"""
Expand Down
8 changes: 8 additions & 0 deletions module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@
"save"
]
},
"NewShipRecord": {
"type": "select",
"value": "do_not",
"option": [
"do_not",
"save"
]
},
"OpsiRecord": {
"type": "select",
"value": "do_not",
Expand Down
3 changes: 3 additions & 0 deletions module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ DropRecord:
CombatRecord:
value: do_not
option: [ do_not, save ]
NewShipRecord:
value: do_not
option: [ do_not, save ]
OpsiRecord:
value: do_not
option: [ do_not, save, upload, save_and_upload ]
Expand Down
1 change: 1 addition & 0 deletions module/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class GeneratedConfig:
DropRecord_ResearchRecord = 'do_not' # do_not, save, upload, save_and_upload
DropRecord_CommissionRecord = 'do_not' # do_not, save, upload, save_and_upload
DropRecord_CombatRecord = 'do_not' # do_not, save
DropRecord_NewShipRecord = 'do_not' # do_not, save
DropRecord_OpsiRecord = 'do_not' # do_not, save, upload, save_and_upload
DropRecord_MeowfficerBuy = 'do_not' # do_not, save
DropRecord_MeowfficerTalent = 'do_not' # do_not, save, upload, save_and_upload
Expand Down
6 changes: 6 additions & 0 deletions module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@
"do_not": "Do nothing",
"save": "Save"
},
"NewShipRecord": {
"name": "New Ship Record",
"help": "",
"do_not": "Do nothing",
"save": "Save"
},
"OpsiRecord": {
"name": "OpSi Record",
"help": "",
Expand Down
6 changes: 6 additions & 0 deletions module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@
"do_not": "do_not",
"save": "save"
},
"NewShipRecord": {
"name": "DropRecord.NewShipRecord.name",
"help": "DropRecord.NewShipRecord.help",
"do_not": "do_not",
"save": "save"
},
"OpsiRecord": {
"name": "DropRecord.OpsiRecord.name",
"help": "DropRecord.OpsiRecord.help",
Expand Down
6 changes: 6 additions & 0 deletions module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@
"do_not": "无操作",
"save": "保存"
},
"NewShipRecord": {
"name": "新船只掉落截图",
"help": "",
"do_not": "无操作",
"save": "保存"
},
"OpsiRecord": {
"name": "大世界掉落截图",
"help": "",
Expand Down
6 changes: 6 additions & 0 deletions module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@
"do_not": "無操作",
"save": "保存"
},
"NewShipRecord": {
"name": "新船掉落截圖",
"help": "",
"do_not": "無操作",
"save": "保存"
},
"OpsiRecord": {
"name": "大世界掉落截圖",
"help": "",
Expand Down

0 comments on commit 0d2db64

Please sign in to comment.