Add: Claim mails in task freebies

- TODO: [JP][TW] Update mail assets
This commit is contained in:
LmeSzinc 2024-07-18 22:48:14 +08:00
parent 06143434a8
commit e66b2a84b0
10 changed files with 103 additions and 56 deletions

View File

@ -1531,9 +1531,10 @@
"ForceCollect": false
},
"Mail": {
"Collect": true,
"Filter": "Merit > Coolant",
"Delete": false
"ClaimMerit": true,
"ClaimMaintenance": false,
"ClaimTradeLicense": false,
"DeleteCollected": true
},
"SupplyPack": {
"Collect": true,

View File

@ -8085,17 +8085,21 @@
}
},
"Mail": {
"Collect": {
"ClaimMerit": {
"type": "checkbox",
"value": true
},
"Filter": {
"type": "textarea",
"value": "Merit > Coolant"
},
"Delete": {
"ClaimMaintenance": {
"type": "checkbox",
"value": false
},
"ClaimTradeLicense": {
"type": "checkbox",
"value": false
},
"DeleteCollected": {
"type": "checkbox",
"value": true
}
},
"SupplyPack": {

View File

@ -562,10 +562,10 @@ DataKey:
Collect: true
ForceCollect: false
Mail:
Collect: true
Filter: |-
Merit > Coolant
Delete: false
ClaimMerit: true
ClaimMaintenance: false
ClaimTradeLicense: false
DeleteCollected: true
SupplyPack:
Collect: true
DayOfWeek:

View File

@ -315,9 +315,10 @@ class GeneratedConfig:
DataKey_ForceCollect = False
# Group `Mail`
Mail_Collect = True
Mail_Filter = 'Merit > Coolant'
Mail_Delete = False
Mail_ClaimMerit = True
Mail_ClaimMaintenance = False
Mail_ClaimTradeLicense = False
Mail_DeleteCollected = True
# Group `SupplyPack`
SupplyPack_Collect = True

View File

@ -1926,15 +1926,19 @@
"name": "Mail Settings",
"help": ""
},
"Collect": {
"name": "Collect Mail Rewards",
"help": "Only collects the top 3 mail entries"
"ClaimMerit": {
"name": "Claim Merit Mails",
"help": ""
},
"Filter": {
"name": "Mail Filter",
"help": "Filter as to which mail types should be collected\nSupports Merit, Coolant, Coin, DecorCoin, Cube, Oil, and/or Gem"
"ClaimMaintenance": {
"name": "Claim Maintenance Mails",
"help": "Mail.ClaimMaintenance.help"
},
"Delete": {
"ClaimTradeLicense": {
"name": "Claim Trade License Mails",
"help": ""
},
"DeleteCollected": {
"name": "Delete Collected Mail Rewards",
"help": "Delete the already collected mail entries\nMark any entries \"important\" in-game to avoid accidental deletion"
}

View File

@ -1926,17 +1926,21 @@
"name": "Mail._info.name",
"help": "Mail._info.help"
},
"Collect": {
"name": "Mail.Collect.name",
"help": "Mail.Collect.help"
"ClaimMerit": {
"name": "Mail.ClaimMerit.name",
"help": "Mail.ClaimMerit.help"
},
"Filter": {
"name": "Mail.Filter.name",
"help": "Mail.Filter.help"
"ClaimMaintenance": {
"name": "Mail.ClaimMaintenance.name",
"help": "Mail.ClaimMaintenance.help"
},
"Delete": {
"name": "Mail.Delete.name",
"help": "Mail.Delete.help"
"ClaimTradeLicense": {
"name": "Mail.ClaimTradeLicense.name",
"help": "Mail.ClaimTradeLicense.help"
},
"DeleteCollected": {
"name": "Mail.DeleteCollected.name",
"help": "Mail.DeleteCollected.help"
}
},
"SupplyPack": {

View File

@ -1926,15 +1926,19 @@
"name": "领取邮件",
"help": ""
},
"Collect": {
"name": "领取邮件",
"ClaimMerit": {
"name": "领取功勋邮件",
"help": ""
},
"Filter": {
"name": "邮件过滤器",
"help": "默认只领取演习功勋邮件"
"ClaimMaintenance": {
"name": "领取维护邮件",
"help": ""
},
"Delete": {
"ClaimTradeLicense": {
"name": "领取月卡邮件",
"help": ""
},
"DeleteCollected": {
"name": "删除已读邮件",
"help": ""
}

View File

@ -1926,15 +1926,19 @@
"name": "領取郵件",
"help": ""
},
"Collect": {
"name": "領取郵件",
"ClaimMerit": {
"name": "領取功勳郵件",
"help": ""
},
"Filter": {
"name": "郵件過濾器",
"help": "默認只領取演習功勳郵件"
"ClaimMaintenance": {
"name": "領取維护郵件",
"help": ""
},
"Delete": {
"ClaimTradeLicense": {
"name": "領取月卡郵件",
"help": ""
},
"DeleteCollected": {
"name": "刪除已讀郵件",
"help": ""
}

View File

@ -1,7 +1,7 @@
from module.base.base import ModuleBase
from module.freebies.battle_pass import BattlePass
from module.freebies.data_key import DataKey
from module.freebies.mail import Mail
from module.freebies.mail_white import MailWhite
from module.freebies.supply_pack import SupplyPack
from module.logger import logger
@ -19,9 +19,8 @@ class Freebies(ModuleBase):
logger.hr('Data key', level=1)
DataKey(self.config, self.device).run()
# if self.config.Mail_Collect:
# logger.hr('Mail', level=1)
# Mail(self.config, self.device).run()
logger.hr('Mail', level=1)
MailWhite(self.config, self.device).run()
if self.config.SupplyPack_Collect:
logger.hr('Supply pack', level=1)

View File

@ -2,7 +2,7 @@ from module.base.decorator import cached_property
from module.combat.assets import GET_ITEMS_1, GET_ITEMS_2
from module.freebies.assets import *
from module.logger import logger
from module.ui.page import GOTO_MAIN_WHITE, page_mail, page_main
from module.ui.page import GOTO_MAIN_WHITE, page_mail, page_main, page_main_white
from module.ui.setting import Setting
from module.ui.ui import UI
@ -177,8 +177,8 @@ class MailWhite(UI):
def mail_claim(
self,
merit=True,
maintenance=True,
trade_license=True,
maintenance=False,
trade_license=False,
delete=True,
):
"""
@ -212,10 +212,36 @@ class MailWhite(UI):
self._mail_quit()
def run(self):
pass
merit = self.config.Mail_ClaimMerit
maintenance = self.config.Mail_ClaimMaintenance
trade_license = self.config.Mail_ClaimTradeLicense
delete = self.config.Mail_DeleteCollected
logger.info(f'Mail reward: merit={merit}, maintenance={maintenance}, '
f'trade_license={trade_license}, delete={delete}')
if not merit and not maintenance and not trade_license:
logger.warning('Nothing to claim')
return False
if self.config.SERVER not in ['cn', 'en']:
logger.warning(f'Mail is not supported in {self.config.SERVER}, please contact server maintainers')
return False
# Must using white UI
self.ui_ensure(page_main)
if self.appear(page_main_white.check_button, offset=(30, 30)):
logger.info('At page_main_white')
pass
elif self.appear(page_main.check_button, offset=(5, 5)):
logger.warning('At page_main, cannot enter mail page from old UI')
return False
else:
logger.warning('Unknown page_main, cannot enter mail page')
return False
if __name__ == '__main__':
self = MailWhite('alas')
self.device.screenshot()
self.mail_claim()
# Claim
self.mail_claim(
merit=merit,
maintenance=maintenance,
trade_license=trade_license,
delete=delete,
)
return True