From 8cab5e0626c05904eb5a5cb6f68f69931f88656f Mon Sep 17 00:00:00 2001 From: Hengyu Date: Thu, 21 Dec 2023 01:51:59 +0800 Subject: [PATCH] Fix: change to match template on detecting whether curio is selected --- assets/share/rogue/curio/CURIO_SELECTED.png | Bin 0 -> 6395 bytes tasks/rogue/assets/assets_rogue_curio.py | 10 ++++++++++ tasks/rogue/blessing/curio.py | 7 ++++--- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 assets/share/rogue/curio/CURIO_SELECTED.png diff --git a/assets/share/rogue/curio/CURIO_SELECTED.png b/assets/share/rogue/curio/CURIO_SELECTED.png new file mode 100644 index 0000000000000000000000000000000000000000..d10f1b19bbc59f8aecf5006e55bc1ce89a732697 GIT binary patch literal 6395 zcmeH~i8s{W`@r9}EM+HKqOn9-N)*bHB}3M+hipZbLG~d-2}u|s27@dy3|cIc3@Tg3 zk}3PX4l%|)jrBX9f8uw}@0^}?(4btoaae2H#J~q6J`SdfZY(R2LS*k z+LZn$3q4I~iy6_;6l(z3J_rC#^ZqyJfSf!*0AMrm($zILf8-zRAN0sSK-^GQS3Drl z-^0uIApnGrp)AAf(kW*(rzsCPZFEL9K4kem1waxQmM$*)BCgkf>vJw1?e@4AY&LxS z+<9Q@wr7KEVAPAbLK&>*?Uyg^C0RSFu8U2S)kQ^+Nu-0}gC=4g@vslp&l$tbBb~NX z!%Po`qpniAx0adz}Q+%7h_+qWI!K-V*)}`>=2yV zE)Fm{yLwucA$@0`#t@^t8`Nw%+2>IkgaTj_s}Bo7+NGt?DC; zb?+I33%PS&Rb?m6@HjqQ4G=ixBAEY8uqmFE@pcyruj>W%7u;?sBcMJO0b~jz z$Q7*oI;KQ?`|b}BZhD(<3oH$wSETJv4WERys|F}!Om_n&ip^L>Uu7}y!x>6S~aN!0Q* zve>f5KEL|yA}GDwtX3+5huRkIrv3q8cLyWAe&PIue5v~vIe4AZ!IB(5UN4xkU64X3 z8J;%u0gr>_ODsz?30z)z#?q?@=#QxdmX9$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o1ug4N{>#Ou`JL^4eZAVp^Bu`V zQ&b9{Gn|^FMvP_V(0uYYfMlShV6xpoj)ol{QZFrL5Kslv{KA&s8UH)&t`WMTqSChJ zj$X#!sr`tS>FJ3H$H?75nbM3v(pX&vfo596m=n=%x(q<;8Q6Z;%^)N0hgZUXM;}xX zwf57pZ~jC&tA=dpCUq91{QeAI%#A)I`Tw!XBsUs`dhm_Lk z8|#w}w*nWIBMa2vhkrk~8%UIXX=#q!Ug}kXo#U3(w}?S1q-fI)lQV=?yZOPZO`tEA z5=3qk3zb=&kltc5xl zjUL(8w$U>2PyP}3N8lfUe+2#!_($L$f&Y5~+43jM0B~}`0L(M^g;8x)>i>(uP~TLq JTF2$t{{Rb|Sa1LU literal 0 HcmV?d00001 diff --git a/tasks/rogue/assets/assets_rogue_curio.py b/tasks/rogue/assets/assets_rogue_curio.py index 115214bd4..44bad1b09 100644 --- a/tasks/rogue/assets/assets_rogue_curio.py +++ b/tasks/rogue/assets/assets_rogue_curio.py @@ -13,6 +13,16 @@ CURIO_ENFORCE = ButtonWrapper( button=(465, 114, 815, 545), ), ) +CURIO_SELECTED = ButtonWrapper( + name='CURIO_SELECTED', + share=Button( + file='./assets/share/rogue/curio/CURIO_SELECTED.png', + area=(1024, 116, 1040, 134), + search=(1004, 96, 1060, 154), + color=(127, 117, 110), + button=(1024, 116, 1040, 134), + ), +) OCR_ROGUE_CURIO = ButtonWrapper( name='OCR_ROGUE_CURIO', share=Button( diff --git a/tasks/rogue/blessing/curio.py b/tasks/rogue/blessing/curio.py index 9fd297174..273dec1d0 100644 --- a/tasks/rogue/blessing/curio.py +++ b/tasks/rogue/blessing/curio.py @@ -4,10 +4,10 @@ import numpy as np from module.base.filter import MultiLangFilter from module.base.timer import Timer -from module.base.utils import get_color +from module.base.utils import area_offset, area_pad from module.logger import logger from module.ocr.ocr import Ocr, OcrResultButton -from tasks.rogue.assets.assets_rogue_curio import CURIO_ENFORCE, OCR_ROGUE_CURIO +from tasks.rogue.assets.assets_rogue_curio import CURIO_ENFORCE, OCR_ROGUE_CURIO, CURIO_SELECTED from tasks.rogue.assets.assets_rogue_ui import BLESSING_CONFIRM, BLESSING_ENHANCED, BLESSING_LOST, BLESSING_OBTAINED from tasks.rogue.blessing.preset import CURIO_PRESET from tasks.rogue.blessing.selector import RogueSelector @@ -53,7 +53,8 @@ class RogueCurioSelector(RogueSelector): def ui_select(self, target: OcrResultButton | None, skip_first_screenshot=True): def is_curio_selected(): - return np.mean(get_color(self.main.device.image, tuple(target.area))) > 60 # shiny background + CURIO_SELECTED.matched_button.search = area_pad(area_offset(target.area, (0, -50)), -50) + return self.main.appear(CURIO_SELECTED) def is_select_curio_complete(): """