mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-31 09:29:37 +00:00
Readd campaign's get_drop
This commit is contained in:
@@ -251,3 +251,6 @@ class DropsCampaign:
|
||||
|
||||
def _on_minutes_changed(self) -> None:
|
||||
invalidate_cache(self, "progress", "remaining_minutes")
|
||||
|
||||
def get_drop(self, drop_id: str) -> Optional[TimedDrop]:
|
||||
return self.timed_drops.get(drop_id)
|
||||
|
||||
@@ -828,13 +828,11 @@ class Twitch:
|
||||
# try it with the currently selected game first
|
||||
if self.game is not None:
|
||||
for campaign in self.inventory[self.game]:
|
||||
drop = campaign.timed_drops.get(drop_id)
|
||||
if drop is not None:
|
||||
if (drop := campaign.get_drop(drop_id)) is not None:
|
||||
return drop
|
||||
# fallback to checking all campaigns
|
||||
for campaign in chain(*self.inventory.values()):
|
||||
drop = campaign.timed_drops.get(drop_id)
|
||||
if drop is not None:
|
||||
if (drop := campaign.get_drop(drop_id)) is not None:
|
||||
return drop
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user