From 3f0bdb6aa3b5273d88fa006880659f4cab882279 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Mon, 24 Jul 2023 23:37:22 +0800 Subject: [PATCH] Fix: Handle missing EFFECT_NOTIFICATION when entering forgotten hall --- .../ENTER_FORGOTTEN_HALL_DUNGEON.png | Bin 5575 -> 8614 bytes .../assets/assets_forgotten_hall.py | 8 +++---- tasks/forgotten_hall/ui.py | 21 ++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/assets/share/forgotten_hall/ENTER_FORGOTTEN_HALL_DUNGEON.png b/assets/share/forgotten_hall/ENTER_FORGOTTEN_HALL_DUNGEON.png index 3a8628bf7b6367f6e85b3b2c2bab1fe1ea87e4ad..ee5d385cf71ec9b70e958bab20c619170c6595f5 100644 GIT binary patch delta 3361 zcmV++4c_v{E2cxRy$XL8(@8`@RCwC#-Cc}a)nNzlb7p3ZcVSiAV9Q@fun7^EREnYD z!2tT00RKP5|QS)u-KkmQ)vW@?MXQ1 zW!ltZm1AB}Y0+CXrIhCBvZ;9Fb2j3pOzf{dSh|YE?-P!dFB&gV4FzBT0Dt)42I`oJ zZ50DvDoA~EOo@y79l+eah$!m9jqP)Hvyncw_p4XzHZPj@-B$^-rw1wYZLf91-v$5x zSYFY$BL=5}DYzBq`o}@@ov4N*#0d;EFBsh z+CPO_D0-Ik0Dl7jK%eK>9>mUATeN;v>|RpaoZg~}rBqn?Z0;?p%=ASn zEZF(cImhMn~tC+#3HpznFP%FE6fc21 zF){JPzdb(la@!|9(Gh^(c;k(G|Nif)x9OHGTb_RUzh`cIY;5eY$98@6qkp}1>rIzk zRzH6H_}JL!bo`AmhLoBY#&_3h^^uWl8;wTsf>m9=Wk{7nV}C4e|NhCGOSL0f00sbn zK6f!ArY>h;%uWX+l@Z@lrwj&?Y3;J~R< zry7k$qtPghh`r|j<@ERozyJV1&q*T|XOG;CaPmV}41b|stA!A!no}ves#E9kS21rv ztWc19TMt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}<#1R4MUxU`|Sd{wIK zJmFNDXS!~TRKE3V!HL;Deq(uHp8tkxHk)V9o(&y5mqoX(y-J30AYc_FX9`p5C{ z@w@K&-1Oc^9gZJA9)ChuwQ6;RB-uRIT(DbRyk}1U1^@sSRjiPHV{vj$c|E76_8 zFF9cA)~ydb@P7|`_wJpTm}u?BjWISFjp5KK%B;z`%wL8)klY{P^*`d-tqabLF;e+v@fDbbo>8&b{AR$5Rc; z&EkYuT2{<7PEiSI{%@x*v*nV|hXL3=zyJWy4?0$^D%uA)mUd!Q3}&%HHD*;%&s+PJ z>=&Fev46j7-O?OyXMytl96pXJ$LQ1)fB^ttX(!>_^xO5sn3*k{d+z*1xY&`#(;Q05 zsbuVyjnnKh_adg&c}&z5w}wUl1^|F1AZAi)%)Hr=g`hhF43N!!!^nXc`>Db*j=I!WPF=1BO_;+sA?Y`q} ztlWK_yU~fuwD4lxFp% delta 272 zcmZ4Hd|Z3OUM>x;FP<)rAr-gY+}g<7pdjE7c;2G3^WFabMA7rpjzk%Jh+`LReDyp+ zY_lVGKIh~BZvOf@?HEP|1_t?^UX}UJWS?)`Zhz*LEl^;_!Dn1R>PM8z6>dfz28IJO zj5c#UcvHj{zW}IyMiT=Y1A_wtGXp~dh{XU>!oVZ}Bv=f91V;jp5I6uN6dHia5iE2q zCfM|Vb!Vt3fsJ~6+6Qd^4gTe~DWM4f0N_Uz diff --git a/tasks/forgotten_hall/assets/assets_forgotten_hall.py b/tasks/forgotten_hall/assets/assets_forgotten_hall.py index 4cec7cb3d..5407fb5b6 100644 --- a/tasks/forgotten_hall/assets/assets_forgotten_hall.py +++ b/tasks/forgotten_hall/assets/assets_forgotten_hall.py @@ -27,10 +27,10 @@ ENTER_FORGOTTEN_HALL_DUNGEON = ButtonWrapper( name='ENTER_FORGOTTEN_HALL_DUNGEON', share=Button( file='./assets/share/forgotten_hall/ENTER_FORGOTTEN_HALL_DUNGEON.png', - area=(1233, 653, 1241, 680), - search=(1213, 633, 1261, 700), - color=(219, 221, 221), - button=(1233, 653, 1241, 680), + area=(989, 649, 1231, 684), + search=(969, 629, 1251, 704), + color=(214, 214, 217), + button=(989, 649, 1231, 684), ), ) ENTRANCE_CHECKED = ButtonWrapper( diff --git a/tasks/forgotten_hall/ui.py b/tasks/forgotten_hall/ui.py index 363a1767d..ddd4b518c 100644 --- a/tasks/forgotten_hall/ui.py +++ b/tasks/forgotten_hall/ui.py @@ -151,19 +151,24 @@ class ForgottenHallUI(DungeonUI): else: self.device.screenshot() - if np.mean(get_color(self.device.image, ENTER_FORGOTTEN_HALL_DUNGEON.area)) > 128: + if self._forgotten_hall_enter_appear(): logger.info("First character is chosen") break if interval.reached(): self.device.click(FIRST_CHARACTER) interval.reset() + def _forgotten_hall_enter_appear(self): + # White button, with a color of (214, 214, 214) + color = get_color(self.device.image, ENTER_FORGOTTEN_HALL_DUNGEON.area) + return np.mean(color) > 180 + def _enter_forgotten_hall_dungeon(self, skip_first_screenshot=True): """ called after team is set """ - interval = Timer(1) - joystick = MapControlJoystick(self.config, self.device) + interval = Timer(3) + timeout = Timer(3) while 1: # enter ui -> popup if skip_first_screenshot: skip_first_screenshot = False @@ -172,11 +177,19 @@ class ForgottenHallUI(DungeonUI): if self.appear(EFFECT_NOTIFICATION): break + if self.match_template_color(DUNGEON_ENTER_CHECKED): + if timeout.reached(): + logger.info('Wait dungeon EFFECT_NOTIFICATION timeout') + break + else: + timeout.reset() - if interval.reached() and np.mean(get_color(self.device.image, ENTER_FORGOTTEN_HALL_DUNGEON.area)) > 128: + if interval.reached() and self._forgotten_hall_enter_appear(): + self.device.image_save() self.device.click(ENTER_FORGOTTEN_HALL_DUNGEON) interval.reset() + joystick = MapControlJoystick(self.config, self.device) skip_first_screenshot = True while 1: # pop up -> dungeon inside if skip_first_screenshot: