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 "ForceCollect": false
}, },
"Mail": { "Mail": {
"Collect": true, "ClaimMerit": true,
"Filter": "Merit > Coolant", "ClaimMaintenance": false,
"Delete": false "ClaimTradeLicense": false,
"DeleteCollected": true
}, },
"SupplyPack": { "SupplyPack": {
"Collect": true, "Collect": true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
from module.base.base import ModuleBase from module.base.base import ModuleBase
from module.freebies.battle_pass import BattlePass from module.freebies.battle_pass import BattlePass
from module.freebies.data_key import DataKey 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.freebies.supply_pack import SupplyPack
from module.logger import logger from module.logger import logger
@ -19,9 +19,8 @@ class Freebies(ModuleBase):
logger.hr('Data key', level=1) logger.hr('Data key', level=1)
DataKey(self.config, self.device).run() DataKey(self.config, self.device).run()
# if self.config.Mail_Collect: logger.hr('Mail', level=1)
# logger.hr('Mail', level=1) MailWhite(self.config, self.device).run()
# Mail(self.config, self.device).run()
if self.config.SupplyPack_Collect: if self.config.SupplyPack_Collect:
logger.hr('Supply pack', level=1) 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.combat.assets import GET_ITEMS_1, GET_ITEMS_2
from module.freebies.assets import * from module.freebies.assets import *
from module.logger import logger 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.setting import Setting
from module.ui.ui import UI from module.ui.ui import UI
@ -177,8 +177,8 @@ class MailWhite(UI):
def mail_claim( def mail_claim(
self, self,
merit=True, merit=True,
maintenance=True, maintenance=False,
trade_license=True, trade_license=False,
delete=True, delete=True,
): ):
""" """
@ -212,10 +212,36 @@ class MailWhite(UI):
self._mail_quit() self._mail_quit()
def run(self): 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__': # Claim
self = MailWhite('alas') self.mail_claim(
self.device.screenshot() merit=merit,
self.mail_claim() maintenance=maintenance,
trade_license=trade_license,
delete=delete,
)
return True