From 958ffb6dbfb70e569c2a33ffa9f68733fe3d7839 Mon Sep 17 00:00:00 2001 From: Hengyu Date: Fri, 11 Aug 2023 01:16:25 +0800 Subject: [PATCH] Upd: count blessing number before recognition --- .../share/rogue/blessing/BOTTOM_WHITE_BAR.png | Bin 0 -> 13183 bytes tasks/rogue/assets/assets_rogue_blessing.py | 10 +++++++++ tasks/rogue/blessing.py | 21 +++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 assets/share/rogue/blessing/BOTTOM_WHITE_BAR.png diff --git a/assets/share/rogue/blessing/BOTTOM_WHITE_BAR.png b/assets/share/rogue/blessing/BOTTOM_WHITE_BAR.png new file mode 100644 index 0000000000000000000000000000000000000000..74bf6c46f77322f41be665c40d1a39f7ec3256e4 GIT binary patch literal 13183 zcmeHNWmwZ)*q?!*Jj4SENQ!_(iKN6(Q0Y+V6p-%jO_WecK|orhM9P6<)Bu$pA>AN3 zYK$C=F?i43&+qs5%d-ov0gL}R_ql&{k9WG-Ds-3FFF_y>IyKct&ma&g@Z;G(G-tux z10MA=;O?S_s*_kV`?z~MxO-evQ&zs_;pJ}U=wb_j z1WaT-_cuy9V1dpa*fJO>jcp-PUBV#O`ATUz7>&O$CPJ*j8JQlmM!dabaQVu=nX39N zuZJ(GX1$&Ne5=O(;rq8H(fVdGn>4o4a#HDEKb$Gw4l46puWy76K8ixcGj zvj}B|DM0bxQzK_Pt^*6Y@G`Xfcbn^JU&z54mk_)7#87YYM(oO zQ>S~w5OVDUdW*hFp_53sL4~?m2f&^W5jV15JO6Ej=P?RL?+~G08ot8Ux~&Ym)!4 z`|oW1o#&nZ<$_SMV!h31cX9E0W@-i>vnuwSX74``2s^R==ZTDB0(NwB*=TyB0YAtC*sgF4JM9MuqrJqvzyk;*sfif>K=2Ht zCpCWo0%=%bGyD3HRkMu-0(tZ~?9TUx)c^dvT-r>Z`ID=mnf0vIg+~wm;cu2_RJySE zit|z~Tgt<$dd;$9=aJvfv48$IeU9|Z9cuyqgC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dy%}^ck4N(v&j&J?N^raiZ2>sXDpmz3aO+lot<`jl0n9*yoPk zAE~s(IQ7)XXi9)#iY0l?kT)Dq$~&^+`=j9|F>|%VgEnpH)FZcjam81&W(Tw7HTggi z?1TxF@i||d%sj}#CZNg72*t4v?2Jc%xlzjX02ZNb%-zuulnh*d6D&{?a8-?ss(jog zC@TO)3`g|aP_484&0BMEB}(8^Fp#WT3!ju;cHVUl9?7aTD~F$+0Q~`B203_JD%FJb zQba)F7GS{1nHlaT5CXqq=;4n%8L&smv|yqMGF>%VH}rQ2rIioCEbsX&yECwcuC8TE zPl+LopqKtOhaspqrD6u)yBV`)pb=xpyvmU^hw$+8GJ1nTFO5|PB~l~ISOyYW8*EF6 zuBftHXG?eY)92*5W>4qxY?8M7p{xJm?l>X*4*1kgKcoppma2VO46b;i98Bi?$G%qt zAWdQsJZptF_co`40pKWO6A}Z0f$4>xNii8}`9KG$jIExM<4C>KF7VS6VHpzYniM&~ zLXWSGP2~6E1=EJZu3Y7)k?J^~an!ow!HZGpL1${8R^BeRNhpWt1cAB~y13AP1JN_F z+Xb=)8)mz!y@U(J6OH-qOnc9{RcR_g2<8p=beqbvN#Vd@GKawM`8-I)g_%5&x36T! zGJF+7dv3JD*4#!FF9dhn)#DslPsLfN5K2Hnwu$d5;(s?O*zgD&@i)6n3in}^ry?p< z`Wrgyo?om)&rh|MS^S=G9*~H&kwYGd8Wd!N7@~ySyz5gDOHqN|IK`OM>Cqs}|9FW{m6aLm|jHywsom7HdpJmiH5bgI4@HvowM=^eDzir*{M+rQTcH$_M8i+cQ2{LAt5 zv_}Ht>*ojCi&J}B} literal 0 HcmV?d00001 diff --git a/tasks/rogue/assets/assets_rogue_blessing.py b/tasks/rogue/assets/assets_rogue_blessing.py index dbb7c53da..8b33eff29 100644 --- a/tasks/rogue/assets/assets_rogue_blessing.py +++ b/tasks/rogue/assets/assets_rogue_blessing.py @@ -33,6 +33,16 @@ BLESSING_STABLE_FLAG = ButtonWrapper( button=(846, 520, 896, 542), ), ) +BOTTOM_WHITE_BAR = ButtonWrapper( + name='BOTTOM_WHITE_BAR', + share=Button( + file='./assets/share/rogue/blessing/BOTTOM_WHITE_BAR.png', + area=(166, 520, 1114, 542), + search=(146, 500, 1134, 562), + color=(210, 211, 211), + button=(166, 520, 1114, 542), + ), +) CONFIRM = ButtonWrapper( name='CONFIRM', share=Button( diff --git a/tasks/rogue/blessing.py b/tasks/rogue/blessing.py index def18136f..948aff672 100644 --- a/tasks/rogue/blessing.py +++ b/tasks/rogue/blessing.py @@ -5,7 +5,7 @@ import numpy as np from dev_tools.keyword_extract import UI_LANGUAGES from module.base.filter import Filter from module.base.timer import Timer -from module.base.utils import area_offset +from module.base.utils import area_offset, get_color from module.logger import logger from module.ocr.ocr import Ocr, OcrResultButton, DigitCounter from tasks.rogue.assets.assets_rogue_blessing import * @@ -83,6 +83,8 @@ class RogueBuffOcr(Ocr): "[沦沧]肌髓": "沦浃肌髓", "进发": "迸发", "永缩体": "永坍缩体", + "完美体验:绒默": "完美体验:缄默", + "^灾$": "禳灾", } for pattern, replace in replace_pattern_dict.items(): result = re.sub(pattern, replace, result) @@ -90,14 +92,21 @@ class RogueBuffOcr(Ocr): class RogueBlessingUI(RogueUI): + def get_blessing_count(self) -> int: + """ + Returns: The number of blessing + """ + color = get_color(self.device.image, BOTTOM_WHITE_BAR.area) + mean = np.mean(color) + return int(mean // 60) # the magic number that maps blessing num with mean_color + def buffs_recognition(self): ocr = RogueBuffOcr(OCR_ROGUE_BUFF) results = ocr.matched_ocr(self.device.image, [RogueBlessing, RogueResonance]) - - if results: - logger.info(f"Buffs recognized: {len(results)}") - else: - logger.warning("No buff recognized") + blessing_count = self.get_blessing_count() + if blessing_count != len(results): + logger.warning(f"The OCR result does not match the blessing count. " + f"Expect {blessing_count}, but recognized {len(results)} only.") self.blessings = results return results