签到活动:幸运墙+每日单抽
All checks were successful
ci/woodpecker/push/check_format Pipeline was successful

This commit is contained in:
zhbaor 2025-01-22 17:26:14 +08:00
parent bcb7b09881
commit bc9734e30f
10 changed files with 48 additions and 32 deletions

BIN
mower/resources/contract.png (Stored with Git LFS)

Binary file not shown.

BIN
mower/resources/sign_in/orundum/banner.png (Stored with Git LFS)

Binary file not shown.

BIN
mower/resources/sign_in/orundum/choose.png (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
mower/resources/sign_in/orundum/entry.png (Stored with Git LFS)

Binary file not shown.

View file

@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from .sign_in import SignIn
from .headhunting import Headhunting
from .orundum import Orundum
class SignInManager:
@ -27,8 +28,8 @@ class SignInManager:
def run(self) -> bool:
result = True
if datetime.now() < datetime(2025, 1, 23):
solver_list = [SignIn()]
if datetime.now() < datetime(2025, 2, 5):
solver_list = [Orundum(), Headhunting()]
for solver in solver_list:
solver.scheduler_stop_time = self.scheduler_stop_time
result = result and solver.run()

View file

@ -18,18 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from datetime import timedelta
from mower.utils import config
from mower.utils.email import notify
from mower.utils.graph import SceneGraphSolver
from mower.utils.log import logger
from mower.utils.scene import Scene
activity_name = "狂欢游乐好运墙"
from .utils import index_entry
activity_name = "龙门幸运墙"
class Orundum(SceneGraphSolver):
solver_name = "幸运墙"
solver_max_duration = timedelta(minutes=1)
solver_max_duration = timedelta(minutes=2)
def run(self):
self.in_progress = False
@ -37,18 +37,15 @@ class Orundum(SceneGraphSolver):
def transition(self) -> bool:
if (scene := self.scene()) == Scene.INDEX:
score, scope = config.recog.match("sign_in/orundum/entry")
if score >= 0.8:
self.tap(scope)
if pos := index_entry("sign_in/orundum/entry", "幸运墙登录活动"):
self.ctap(pos)
else:
notify(f"未找到{activity_name}签到入口")
return True
elif scene == Scene.SIGN_IN_ORUNDUM:
if self.animation():
return
if self.find("sign_in/orundum/complete"):
if self.in_progress:
logger.info("等待物资领取界面弹出")
self.sleep()
else:
notify(f"今日{activity_name}奖励已领完")
return True
for x in range(445, 1520, 213):

View file

@ -0,0 +1,18 @@
from mower.utils import config
from mower.utils import typealias as tp
from mower.utils.image import cropimg
from mower.utils.rapidocr import ocr_rec
def index_entry(res: tp.Res, text: str) -> tp.Scope | None:
score, scope = config.recog.match(res)
if score < 0.8:
return None
img = cropimg(config.recog.gray, scope)
h, w = img.shape
lh = h // 2
line1 = cropimg(img, ((0, 0), (w, lh)))
line2 = cropimg(img, ((0, lh), (w, h)))
if text != ocr_rec(line1) + ocr_rec(line2):
return None
return scope

View file

@ -172,10 +172,10 @@ color = {
"sign_in/banner": (92, 144),
"sign_in/collect": (1428, 875),
"sign_in/moon_festival/moon_cake": (1216, 503),
"sign_in/orundum/banner": (93, 814),
"sign_in/orundum/choose": (1590, 798),
"sign_in/orundum/complete": (1641, 800),
"sign_in/orundum/confirm": (1625, 798),
"sign_in/orundum/banner": (98, 921),
"sign_in/orundum/choose": (1560, 775),
"sign_in/orundum/complete": (1561, 776),
"sign_in/orundum/confirm": (1561, 778),
"skip": (1803, 32),
"sss/EC_up": (1049, 490),
"sss/action": (1641, 967),