1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2026-01-07 16:15:13 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
bbf3bf7c36
perf(bounty): improve ending logic 2023-11-20 17:06:08 +08:00
5e4abc147e
feat(bounty): detect ticket and end when zero 2023-11-20 16:50:18 +08:00

View File

@ -39,7 +39,7 @@ class Bounty(BountyUI):
@property @property
def is_ticket_enough(self) -> bool: def is_ticket_enough(self) -> bool:
return self.config.stored.BountyTicket.value >= self.current_count return self.current_ticket >= self.current_count
@property @property
def current_bounty(self): def current_bounty(self):
@ -53,10 +53,16 @@ class Bounty(BountyUI):
def current_count(self): def current_count(self):
return self.task[0][3] return self.task[0][3]
@property
def current_ticket(self):
return self.config.stored.BountyTicket.value
def handle_bounty(self, status): def handle_bounty(self, status):
match status: match status:
case BountyStatus.OCR: case BountyStatus.OCR:
if self.get_ticket(): if self.get_ticket():
if self.current_ticket == 0 or not self.task:
return BountyStatus.FINISH
return BountyStatus.SELECT return BountyStatus.SELECT
case BountyStatus.SELECT: case BountyStatus.SELECT:
if not self.is_ticket_enough: if not self.is_ticket_enough:
@ -70,8 +76,6 @@ class Bounty(BountyUI):
case BountyStatus.SWEEP: case BountyStatus.SWEEP:
if self.do_sweep(self.current_count): if self.do_sweep(self.current_count):
self.task.pop(0) self.task.pop(0)
if not self.task:
return BountyStatus.FINISH
return BountyStatus.END return BountyStatus.END
return BountyStatus.ENTER return BountyStatus.ENTER
case BountyStatus.END: case BountyStatus.END: