From 54cd0f7c908fd574af5c681e6cdaece52c385a12 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 15 Jul 2023 01:26:00 +0800 Subject: [PATCH] Opt: Faster relic salvage --- assets/share/item/relics/ORDER_ASCENDING.png | Bin 0 -> 5896 bytes ...REVERSE_ORDER.png => ORDER_DESCENDING.png} | Bin assets/share/item/relics/SALVAGE.SEARCH.png | Bin 0 -> 9603 bytes tasks/item/assets/assets_item_relics.py | 18 +++++++--- tasks/item/relics.py | 31 +++++++++++------- 5 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 assets/share/item/relics/ORDER_ASCENDING.png rename assets/share/item/relics/{REVERSE_ORDER.png => ORDER_DESCENDING.png} (100%) create mode 100644 assets/share/item/relics/SALVAGE.SEARCH.png diff --git a/assets/share/item/relics/ORDER_ASCENDING.png b/assets/share/item/relics/ORDER_ASCENDING.png new file mode 100644 index 0000000000000000000000000000000000000000..5f3495c42ae3ccff1a0afee5199e9ed0de28b346 GIT binary patch literal 5896 zcmeI0`8O0^AIGmj#xC24>`R4g(O1fzjFM$AmXfW=F8dG-BBdN z0pL55X5eEIyTh(Dx$}q-sW!CwA<-!a2nb@JZA_+FOmBhJb0%h$me6n-BrDt5RJc)d z@Bj@wEqo^PBGyjzRk&G%(S7+9-m(0u06)_5^8U~LIzlSppc~c0h(60K60?xy0InfI zZzv4$M(M(v+w0K~Huw|;AJYQE_mNvDND8W!+>=+CTWt}gC zf;VI!>7u3(M5Pv38U-Q5A-Jy~6Qd#^L4hkJLz{k*(S)GuDS>ySNi?I1B|s;siFX1% zc?eMFVd*00(T8@Tv~UZ>!pQ&*AK#UDr|$|YHvT)O&-&`r4FAkmrw?jYuuDv~ z)N=xkDp;)d?vHTn{Y@S>q8GPVY)b-PgGTSCtTnP z86<+iq|Y0u1a4e@%}E;rnCxU_P&)v`Htt5Lh>?M=#GF|G>V9$DFNlL_e}e*WGc!oE zT$PIM3o8c4kotwY4hMr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7mVaT1gUGc9FulAorHdM?FRYB}B#q5_Q!Bdrs9(au$ z?7|wHE$etb1C>_m)tep>Rm2R!&B@LMzzgRx_a4e#R6j-zdPv%3y07F82|ygu#0TQr zB3UJUE|IW#+(H2Aj8JEL^#}(Vv*v?UYWd9(vvhuo+WZG>@$oF82i;V%w>a*44s|AS zDHRnKhEWp;TdA?J5mavGIXr3A_c`s!ax}GkBqggqdT0Ih|3Z8le0GQ|`A$>YtI4ui zBw?6mExyMo!9tJYrG*$YW_AZks;ez(S8$~| z#n6ibiwg`&mY^L3`!UzzZsqRoPMSxMXhIZ$`;F7@Y7LW33cz6S=17)_re;D~+DuDf zL&Nh#<(_wWxw*OS!vud>X@cqMk`FomS1ovbLPnhV6s#4FHBWs9A=PlJfTH~0kWAzU~mc! zextfIg8LN@8y%gz8`CS$e%O_#5P8tC-wrtuah~-%>Sc_iCRF=m_>Pc`-SCH32)SlvJtG~qVYNLU2eR~UGC~g-srh&gw;tM4LmTLGy75J#~oP~cc zOzNi4Rev*SvT?TQJw7Q~nR^J3F9X84#Eh*h*mzw>t&g1;M z&3Y4bmGOGbKXWAmB^JA%Ci&<-S!wX{r$?bUDFS1)(Y!g9XpkUd$R(^}Lc3K>ij*kJ zEdHsq&O|MoNX}jvg!F&EY2psdNixv?yt(xM;aK{0ioXfK0MR1lh!+H<1^^XB^_Nxh HZ$JDG${a>W literal 0 HcmV?d00001 diff --git a/tasks/item/assets/assets_item_relics.py b/tasks/item/assets/assets_item_relics.py index ec21d95ac..4a74732bc 100644 --- a/tasks/item/assets/assets_item_relics.py +++ b/tasks/item/assets/assets_item_relics.py @@ -23,10 +23,20 @@ GOTO_SALVAGE = ButtonWrapper( button=(668, 652, 690, 674), ), ) -REVERSE_ORDER = ButtonWrapper( - name='REVERSE_ORDER', +ORDER_ASCENDING = ButtonWrapper( + name='ORDER_ASCENDING', share=Button( - file='./assets/share/item/relics/REVERSE_ORDER.png', + file='./assets/share/item/relics/ORDER_ASCENDING.png', + area=(720, 649, 737, 667), + search=(700, 629, 757, 687), + color=(176, 176, 178), + button=(720, 649, 737, 667), + ), +) +ORDER_DESCENDING = ButtonWrapper( + name='ORDER_DESCENDING', + share=Button( + file='./assets/share/item/relics/ORDER_DESCENDING.png', area=(720, 649, 738, 667), search=(700, 629, 758, 687), color=(179, 180, 180), @@ -38,7 +48,7 @@ SALVAGE = ButtonWrapper( share=Button( file='./assets/share/item/relics/SALVAGE.png', area=(1038, 646, 1062, 670), - search=(1018, 626, 1082, 690), + search=(936, 642, 1213, 675), color=(122, 115, 98), button=(1038, 646, 1062, 670), ), diff --git a/tasks/item/relics.py b/tasks/item/relics.py index 9ea73e688..0f10852a2 100644 --- a/tasks/item/relics.py +++ b/tasks/item/relics.py @@ -1,39 +1,42 @@ from module.base.timer import Timer from module.logger import logger from tasks.base.assets.assets_base_page import CLOSE -from tasks.base.assets.assets_base_popup import CONFIRM_POPUP +from tasks.base.assets.assets_base_popup import CONFIRM_POPUP, GET_REWARD from tasks.item.assets.assets_item_relics import * from tasks.item.keywords import KEYWORD_ITEM_TAB from tasks.item.ui import ItemUI class RelicsUI(ItemUI): + def _is_in_salvage(self) -> bool: + return self.appear(ORDER_ASCENDING) or self.appear(ORDER_DESCENDING) + def salvage_relic(self, skip_first_screenshot=True) -> bool: logger.hr('Salvage Relic', level=2) self.item_goto(KEYWORD_ITEM_TAB.Relics, wait_until_stable=False) - interval = Timer(1) while 1: # relic tab -> salvage if skip_first_screenshot: skip_first_screenshot = False else: self.device.screenshot() - if self.appear(REVERSE_ORDER): + if self._is_in_salvage(): break - if self.appear_then_click(GOTO_SALVAGE): + if self.appear_then_click(GOTO_SALVAGE, interval=2): continue skip_first_screenshot = True + interval = Timer(1) while 1: # salvage -> first relic selected if skip_first_screenshot: skip_first_screenshot = False else: self.device.screenshot() - if self.appear_then_click(REVERSE_ORDER): # this should judge before break condition - continue - if self.appear(SALVAGE): + if SALVAGE.match_template_color(self.device.image): break + if self.appear_then_click(ORDER_DESCENDING, interval=2): + continue if interval.reached() and self.image_color_count(FIRST_RELIC, (233, 192, 108)): self.device.click(FIRST_RELIC) interval.reset() @@ -46,15 +49,16 @@ class RelicsUI(ItemUI): else: self.device.screenshot() - if self.handle_reward(): + if self.appear(GET_REWARD): logger.info("Relic salvaged") break - if self.appear_then_click(SALVAGE): + if self.appear_then_click(SALVAGE, interval=2): continue - if self.appear_then_click(CONFIRM_POPUP): + if self.appear_then_click(CONFIRM_POPUP, interval=2): continue skip_first_screenshot = True + interval = Timer(1) while 1: # rewards claimed -> relic tab page if skip_first_screenshot: skip_first_screenshot = False @@ -64,6 +68,11 @@ class RelicsUI(ItemUI): if self.appear(GOTO_SALVAGE): logger.info("Salvage page exited") break - if self.appear_then_click(CLOSE, interval=1): + if self.handle_reward(interval=2): + continue + if interval.reached() and self._is_in_salvage(): + logger.info(f'_is_in_salvage -> {CLOSE}') + self.device.click(CLOSE) + interval.reset() continue return True