Skip to content

Commit

Permalink
Upd: add CommonDD option (#3786)
Browse files Browse the repository at this point in the history
* Upd: add dd combination z20_or_z21

* Upd: add dd option favourite

* Opt: use fation to filter Z20 or Z21
  • Loading branch information
Air111 authored Jun 13, 2024
1 parent f3c48d1 commit a70d4c4
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 27 deletions.
38 changes: 24 additions & 14 deletions module/campaign/gems_farming.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,15 @@ def vanguard_change(self):

return success

def _dock_reset(self):
self.dock_filter_set()
self.dock_favourite_set(False)
self.dock_sort_method_dsc_set()

def _ship_change_confirm(self, button):

self.dock_select_one(button)
self.dock_filter_set()
self.dock_sort_method_dsc_set()
self._dock_reset()
self.dock_select_confirm(check_button=page_fleet.check_button)

def get_common_rarity_cv(self):
Expand Down Expand Up @@ -255,8 +259,9 @@ def get_common_rarity_dd(self):
return ships

scanner.set_limitation(fleet=0)
self.dock_favourite_set(self.config.GemsFarming_CommonDD == 'favourite')

if self.config.GemsFarming_CommonDD == 'any':
if self.config.GemsFarming_CommonDD in ['any', 'favourite', 'z20_or_z21']:
return scanner.scan(self.device.image, output=False)

candidates = self.find_candidates(self.get_templates(self.config.GemsFarming_CommonDD), scanner)
Expand Down Expand Up @@ -289,14 +294,7 @@ def get_templates(common_dd):
"""
Returns the corresponding template list based on CommonDD
"""
if common_dd == 'any':
return [
TEMPLATE_CASSIN_1, TEMPLATE_CASSIN_2,
TEMPLATE_DOWNES_1, TEMPLATE_DOWNES_2,
TEMPLATE_AULICK,
TEMPLATE_FOOTE
]
elif common_dd == 'aulick_or_foote':
if common_dd == 'aulick_or_foote':
return [
TEMPLATE_AULICK,
TEMPLATE_FOOTE
Expand Down Expand Up @@ -333,7 +331,7 @@ def flagship_change_execute(self):
return True
else:
logger.info('Change flagship failed, no CV in common rarity.')
self.dock_filter_set()
self._dock_reset()
self.ui_back(check_button=page_fleet.check_button)
return False

Expand All @@ -348,8 +346,20 @@ def vanguard_change_execute(self):
"""
self.ui_click(FLEET_ENTER,
appear_button=page_fleet.check_button, check_button=DOCK_CHECK, skip_first_screenshot=True)

if self.config.GemsFarming_CommonDD == 'any':
faction = ['eagle', 'iron']
elif self.config.GemsFarming_CommonDD == 'favourite':
faction = 'all'
elif self.config.GemsFarming_CommonDD == 'z20_or_z21':
faction = 'iron'
elif self.config.GemsFarming_CommonDD in ['aulick_or_foote', 'cassin_or_downes']:
faction = 'eagle'
else:
logger.error(f'Invalid CommonDD setting: {self.config.GemsFarming_CommonDD}')
raise ScriptError('Invalid GemsFarming_CommonDD')
self.dock_filter_set(
index='dd', rarity='common', faction='eagle', extra='can_limit_break')
index='dd', rarity='common', faction=faction, extra='can_limit_break')
self.dock_favourite_set(False)

ship = self.get_common_rarity_dd()
Expand All @@ -360,7 +370,7 @@ def vanguard_change_execute(self):
return True
else:
logger.info('Change vanguard ship failed, no DD in common rarity.')
self.dock_filter_set()
self._dock_reset()
self.ui_back(check_button=page_fleet.check_button)
return False

Expand Down
4 changes: 3 additions & 1 deletion module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -1618,8 +1618,10 @@
"value": "any",
"option": [
"any",
"favourite",
"aulick_or_foote",
"cassin_or_downes"
"cassin_or_downes",
"z20_or_z21"
]
},
"CommissionLimit": {
Expand Down
2 changes: 1 addition & 1 deletion module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ GemsFarming:
option: [ disabled, ship, ship_equip ]
CommonDD:
value: any
option: [ any, aulick_or_foote , cassin_or_downes ]
option: [ any, favourite, aulick_or_foote , cassin_or_downes, z20_or_z21 ]
CommissionLimit: true

# ==================== Event ====================
Expand Down
2 changes: 1 addition & 1 deletion module/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class GeneratedConfig:
GemsFarming_ChangeFlagship = 'ship' # ship, ship_equip
GemsFarming_CommonCV = 'any' # any, langley, bogue, ranger, hermes
GemsFarming_ChangeVanguard = 'ship' # disabled, ship, ship_equip
GemsFarming_CommonDD = 'any' # any, aulick_or_foote, cassin_or_downes
GemsFarming_CommonDD = 'any' # any, favourite, aulick_or_foote, cassin_or_downes, z20_or_z21
GemsFarming_CommissionLimit = True

# Group `EventGeneral`
Expand Down
8 changes: 5 additions & 3 deletions module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@
},
"ChangeVanguard": {
"name": "Change Vanguard",
"help": "Change vanguard if flagship or vanguard are emotion exhausted.If you choose not to change, your fleet will ignore the low emotion warning and continue combat.\nSwitch out to new level 100(70) common vanguard after current flagship has reached level 32+ (Only CN players'0 limit break ship can reach level 100)\n\nThe vanguard's equipment is replaced when being switched out by first recording the current setup. Only populated equipment slots will be replaced.",
"help": "Change vanguard if flagship or vanguard are emotion exhausted. If you choose not to change, your fleet will ignore the low emotion warning and continue combat.\nSwitch out to new level 100(70) common vanguard from eagle or ironblood after current flagship has reached level 32+ (Only CN players'0 limit break ship can reach level 100)\n\nThe vanguard's equipment is replaced when being switched out by first recording the current setup. Only populated equipment slots will be replaced.",
"disabled": "Don't Change",
"ship": "Change Ship",
"ship_equip": "Change Ship + Gears"
Expand All @@ -1155,8 +1155,10 @@
"name": "Flagship Common DD Preference",
"help": "",
"any": "any",
"aulick_or_foote": "aulick or foote",
"cassin_or_downes": "cassin or downes"
"favourite": "Favourite Ships Only",
"aulick_or_foote": "Aulick or Foote",
"cassin_or_downes": "Cassin or Downes",
"z20_or_z21": "Z20 or Z21"
},
"CommissionLimit": {
"name": "Prevent Too Many Urgent Commissions",
Expand Down
8 changes: 5 additions & 3 deletions module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,11 @@
"CommonDD": {
"name": "GemsFarming.CommonDD.name",
"help": "GemsFarming.CommonDD.help",
"any": "any",
"aulick_or_foote": "aulick or foote",
"cassin_or_downes": "cassin or downes"
"any": "GemsFarming.CommonDD.any",
"favourite": "GemsFarming.CommonDD.favourite",
"aulick_or_foote": "GemsFarming.CommonDD.aulick_or_foote",
"cassin_or_downes": "GemsFarming.CommonDD.cassin_or_downes",
"z20_or_z21": "GemsFarming.CommonDD.z20_or_z21"
},
"CommissionLimit": {
"name": "GemsFarming.CommissionLimit.name",
Expand Down
6 changes: 4 additions & 2 deletions module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@
},
"ChangeVanguard": {
"name": "更换前排",
"help": "当前排红脸时更换前排,选择不更换则会强制红脸出击\n换前排通过找一艘心情不低于10、等级100的白鹰白皮驱逐完成,所以尽量保证有足够多的驱逐。国服以外则为等级70的白鹰白船驱逐。\n\n换装备只会更换正在装备中的栏位,即使是白装也会更换。前排会更换全部5个装备。",
"help": "当前排红脸时更换前排,选择不更换则会强制红脸出击\n换前排通过找一艘心情不低于10、等级100的白鹰或铁血的白皮驱逐完成,所以尽量保证有足够多的驱逐。国服以外则为等级70的白鹰白船驱逐。\n\n换装备只会更换正在装备中的栏位,即使是白装也会更换。前排会更换全部5个装备。",
"disabled": "不更换",
"ship": "更换舰船",
"ship_equip": "更换舰船 + 装备"
Expand All @@ -1155,8 +1155,10 @@
"name": "指定前排",
"help": "",
"any": "任意",
"favourite": "仅常用",
"aulick_or_foote": "奥利克或富特",
"cassin_or_downes": "卡辛或唐斯"
"cassin_or_downes": "卡辛或唐斯",
"z20_or_z21": "Z20或Z21"
},
"CommissionLimit": {
"name": "防止紧急委托数量过多",
Expand Down
6 changes: 4 additions & 2 deletions module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@
},
"ChangeVanguard": {
"name": "更換前排",
"help": "當前排紅臉時更換前排,選擇不更換則會強制紅臉出擊\n換前排通過找一艘心情不低於10、等級70的白鷹白船驅逐完成,所以盡量保證有足夠多的驅逐。國服則為等級100的白鷹白船驅逐。\n\n換裝備只會更換正在裝備中的欄位,即使是白裝也會更換。前排會更換全部5個裝備。",
"help": "當前排紅臉時更換前排,選擇不更換則會強制紅臉出擊\n換前排通過找一艘心情不低於10、等級70的白鷹或鐵血的白船驅逐完成,所以盡量保證有足夠多的驅逐。國服則為等級100的白鷹白船驅逐。\n\n換裝備只會更換正在裝備中的欄位,即使是白裝也會更換。前排會更換全部5個裝備。",
"disabled": "不更换",
"ship": "更換艦船",
"ship_equip": "更換艦船 + 裝備"
Expand All @@ -1155,8 +1155,10 @@
"name": "指定前排",
"help": "",
"any": "任意",
"favourite": "僅常用",
"aulick_or_foote": "奧利克或富特",
"cassin_or_downes": "卡辛或唐斯"
"cassin_or_downes": "卡辛或唐斯",
"z20_or_z21": "Z20或Z21"
},
"CommissionLimit": {
"name": "防止緊急委託數量過多",
Expand Down

0 comments on commit a70d4c4

Please sign in to comment.