From 765eeb5472e2a3d3286c691884df374b06ca5bb5 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:36:54 +0800 Subject: [PATCH] Add: Check combat auto and 2X speed --- assets/share/combat/state/COMBAT_AUTO.png | Bin 0 -> 9659 bytes assets/share/combat/state/COMBAT_PAUSE.png | Bin 0 -> 6449 bytes assets/share/combat/state/COMBAT_SPEED_2X.png | Bin 0 -> 9172 bytes module/base/button.py | 4 + tasks/combat/assets/assets_combat_state.py | 35 ++++++++ tasks/combat/state.py | 80 ++++++++++++++++++ 6 files changed, 119 insertions(+) create mode 100644 assets/share/combat/state/COMBAT_AUTO.png create mode 100644 assets/share/combat/state/COMBAT_PAUSE.png create mode 100644 assets/share/combat/state/COMBAT_SPEED_2X.png create mode 100644 tasks/combat/assets/assets_combat_state.py create mode 100644 tasks/combat/state.py diff --git a/assets/share/combat/state/COMBAT_AUTO.png b/assets/share/combat/state/COMBAT_AUTO.png new file mode 100644 index 0000000000000000000000000000000000000000..5d5d06ee59f62e951e44fe2a1f75e6c87c787b8c GIT binary patch literal 9659 zcmeI1`8$+t*vE(JiOO1*5^A&(LK0belBLL&8C%F+b_QdH8I?lFl8|i_Wtkad-(~cl3jaum>lB8lHi_XT0KWZuwLIPX82~7Q<>?Z%$rF47 zaC#vqe5?Is%n|Sj5ut2D(D&zrBZfIK)9)|UdHfw4V;cv0cw^cGH5(j*KQ0aOE@D>2@ zhK1h-0?>Sb<&C@AhXB8eQ^v#qzw=HP^8j9R0WvNboa4UL2zUf~W^skP?JM9t_7+g# zU|T8IQ=1xP1Ma8IhX5f7)=2`l9s!D252LWb92N4{+(Q(gIm3d?EoWS zz+=*my~-%>d)p&F;5%`!8|+(Bs1Igcnv$oF96d@s@BE?p>P(#Wp30QpWE^s9|0!n_ zz6uD)yp>VXmLItr;N%-pYLP(39lWjN%OJ~eI$uWYCS1l(Un_rjMI?63`c<77@O~$( z-Xi(V+3wV7;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a5>TsHpFFLb^IyYz3kE(j$m|M6< z@!$AI;2(j11pX2DN8lfUe+2#!_@5@Q?zg-5Yunvr0ha}$)73CBGk@e7UNyN=tZN_n EABdlJ;Q#;t literal 0 HcmV?d00001 diff --git a/assets/share/combat/state/COMBAT_SPEED_2X.png b/assets/share/combat/state/COMBAT_SPEED_2X.png new file mode 100644 index 0000000000000000000000000000000000000000..148361d62f4f67f2fc4842fee77d949c5c317bf1 GIT binary patch literal 9172 zcmeI1^;cBi_wX;EQj#JmARvlL2#6r5k`jU_Eez7#HN=4WCZq-2ekm`1+r`b< z%GSXW0DQ*N-+1ePJz$ibKCq!LNtru_oE|BsgbS$l98g)YNQ zx-=D?wvWRUD(PW!-}n&L&%?tEBXr(LY;aB#)CBkv@c5IFlSW(`?z9iwPZLB(e>Zk1 z+YWfD9V{(5$_dp}Y3oJ?5#LmqxpJF!3H8(ZYC8aIl7M|69^d6oiOQV;V!&ls@D6?F z?8T>gt-E@_?O0%jn;u6=6r&Av3BK)O0J@lg?{BIsD1bNsZ~*(i;0B7Rfc4#%vR8r8 zqOTK7z-acZA~GO~2uS8rzC--10Wj71pv_O*@)P)0`ixufN=q40kU_18GI0>{D&Q5Z zA4BuZ6bMRw!QTVimLLY?Id1fl+*T*~_GqAarU>K`j8Gv0T2S%5iE0C)42byOtlrz3 zGjm*XKOHJwyl1*kYel}motBu&b3+A3qTY8M09cREKh7oOVsJ|fvrASu2f}W9_PPD0 zGq)_)*7SK}B=Hr1_EkS&9JIKIA#v#>`tI3mUt|P~>jE~@N5-O9@^6L|zkQD)z!Im= zI5M)dx}@1}QBYFidCjtrkLDv}FGOdZXCff`mv7IpzMFt+%ClrxOU|b=*Y{3dW!lj= z)Rh;)P6s%i^UmPFv*`QixyKdn_-}@9>3>FOacgvf>$GDPxVq!#=vM+owm1{c$iI41 z0i_|DEw5@xYfug?kPRZ@2x|QSFW?zuM<9}wG8UkviGbe3+<5?K zTxNb(7{{dEK?VQ{-#$F}{+#ss4~Ehf>a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O<7L}{HPXidMxF`$pm9O<1Qg-w_lI3PJl zM>;-tQHWfe7(OF4*$YoZu8)|o(m|z` zbkk>32j%B&do<^VDl4CAj=l1d!coaJaXrB*X@d!Q;CLVD+*@=8qE(S4A3k!TzzFONQpL9|uIrZuY!*j=~A|6A-Ykx!VHQwIC ze(CoM=lgka%ps7b+9ApOA>H#RS)V#*>G0m(Ua2OJgDCN7X*Rb;9S14dTf*1n6(+n6 z_p!3xKIZQBcGVfwhtc!t_H8jTR}Va2*5qy3cDYl>-edUCc}V%cdZve8t){Qi>rdu( zE5fYvlxHgtpn{(FMN!(_x`|PzOYr8iZnlfHtWXZYydl;+eoLk9FnV5J2f;kZ4)!8o zPyo&W-c(U4%2TpE@-DQze_6vMcaD|j)$Sl+WQ_$1N*Kn%M7!(qFg0Z1I}z2QytqP3 z+oJt->c9P$keul8xO;kfT7toZDddTsUJkUC)emZZE(yV#SCrN5A9qQ(Y?`*w8W{bT z4if7_9Usmk0<-Ba zY}UR+(+gj}Ts{OP%Q?$qv=s1UCbf*h`k&m*qZej# z1J|VmI!T}HMp>sM{aprb6l3x|FcEEM*N1v;w%fs^o zZ634m1(q?4h-I}-E50+VYu}FIv0UiinyAe#eZ<5lPyG1)bP*a6V8*|i5SCPn$1qd= z6z=PIFlbt0LSb@QGZCKFHx^86^_o{1ba;d#ct;Hlr`@8Vkrl^Mj306=G)M5H%ifvC zSvgVjtPw4nS1zW{F0XE8a&Sm4P74;0obl0BU2=g|x4%<#ju+S!WDcy$)FN}8MG3s%tPo^-7wj7R tuple[int, int, int, int]: return self.matched_button.button + @property + def button_offset(self) -> tuple[int, int]: + return self.matched_button._button_offset + @property def width(self) -> int: return area_size(self.area)[0] diff --git a/tasks/combat/assets/assets_combat_state.py b/tasks/combat/assets/assets_combat_state.py new file mode 100644 index 000000000..4103c6487 --- /dev/null +++ b/tasks/combat/assets/assets_combat_state.py @@ -0,0 +1,35 @@ +from module.base.button import Button, ButtonWrapper + +# This file was auto-generated, do not modify it manually. To generate: +# ``` python -m dev_tools.button_extract ``` + +COMBAT_AUTO = ButtonWrapper( + name='COMBAT_AUTO', + share=Button( + file='./assets/share/combat/state/COMBAT_AUTO.png', + area=(1113, 22, 1183, 58), + search=(1093, 2, 1203, 78), + color=(135, 137, 131), + button=(1113, 22, 1183, 58), + ), +) +COMBAT_PAUSE = ButtonWrapper( + name='COMBAT_PAUSE', + share=Button( + file='./assets/share/combat/state/COMBAT_PAUSE.png', + area=(1218, 27, 1245, 53), + search=(1198, 7, 1265, 73), + color=(125, 129, 134), + button=(1218, 27, 1245, 53), + ), +) +COMBAT_SPEED_2X = ButtonWrapper( + name='COMBAT_SPEED_2X', + share=Button( + file='./assets/share/combat/state/COMBAT_SPEED_2X.png', + area=(1029, 22, 1099, 58), + search=(1009, 2, 1119, 78), + color=(138, 143, 146), + button=(1029, 22, 1099, 58), + ), +) diff --git a/tasks/combat/state.py b/tasks/combat/state.py new file mode 100644 index 000000000..7080fae57 --- /dev/null +++ b/tasks/combat/state.py @@ -0,0 +1,80 @@ +import cv2 +from scipy import signal + +from module.base.timer import Timer +from module.base.utils import rgb2gray +from tasks.base.ui import UI +from tasks.combat.assets.assets_combat_state import COMBAT_AUTO, COMBAT_PAUSE, COMBAT_SPEED_2X + + +class CombatState(UI): + _combat_click_interval = Timer(1, count=2) + + def is_combat_executing(self) -> bool: + appear = self.appear(COMBAT_PAUSE) + if appear: + if COMBAT_PAUSE.button_offset[0] <= 5: + return True + + return False + + def is_combat_auto(self) -> bool: + image = rgb2gray(self.image_crop(COMBAT_AUTO)) + line = cv2.reduce(image, 1, cv2.REDUCE_AVG).flatten() + # [122 122 122 182 141 127 139 135 130 135 136 141 147 149 149 150 147 145 + # 148 150 150 150 150 150 144 138 134 141 136 133 173 183 130 128 127 126] + parameters = { + # Border is about 188-190 + 'height': 160, + # Background is about 120-122 + 'prominence': 35, + } + peaks, _ = signal.find_peaks(line, **parameters) + return len(peaks) == 2 + + def is_combat_speed_2x(self) -> bool: + image = rgb2gray(self.image_crop(COMBAT_SPEED_2X)) + line = cv2.reduce(image, 1, cv2.REDUCE_AVG).flatten() + # [122 122 122 182 141 127 139 135 130 135 136 141 147 149 149 150 147 145 + # 148 150 150 150 150 150 144 138 134 141 136 133 173 183 130 128 127 126] + parameters = { + # Border is about 188-190 + 'height': 160, + # Background is about 120-122 + 'prominence': 35, + } + peaks, _ = signal.find_peaks(line, **parameters) + return len(peaks) == 2 + + def handle_combat_state(self, auto=True, speed_2x=True): + """ + Set combat auto and 2X speed. Enable both by default. + + Returns: + bool: If clicked + """ + if not self.is_combat_executing(): + return False + + if speed_2x and not self.is_combat_speed_2x(): + if self._combat_click_interval.reached(): + self.device.click(COMBAT_SPEED_2X) + self._combat_click_interval.reset() + return True + if not speed_2x and self.is_combat_speed_2x(): + if self._combat_click_interval.reached(): + self.device.click(COMBAT_SPEED_2X) + self._combat_click_interval.reset() + return True + if auto and not self.is_combat_auto(): + if self._combat_click_interval.reached(): + self.device.click(COMBAT_AUTO) + self._combat_click_interval.reset() + return True + if not auto and self.is_combat_auto(): + if self._combat_click_interval.reached(): + self.device.click(COMBAT_AUTO) + self._combat_click_interval.reset() + return True + + return False