Relax 'can_watch' restrictions to allow progressing BADGE campaigns;
Also removes game match requirements from 'get_active_drop'
This commit is contained in:
1 parent
334291d1b2
commit
0804a75c2c
1 file changed
+5
-16
@@ -989,17 +989,12 @@ class Twitch:
|
|||||||
"""
|
"""
|
||||||
if not self.wanted_games:
|
if not self.wanted_games:
|
||||||
return False
|
return False
|
||||||
# exit early if
|
# exit early if stream is offline or drops aren't enabled
|
||||||
if (
|
if (not channel.online or not channel.drops_enabled):
|
||||||
not channel.online # stream is offline
|
|
||||||
or not channel.drops_enabled # drops aren't enabled
|
|
||||||
# there's no game or it's not one of the games we've selected
|
|
||||||
or (game := channel.game) is None or game not in self.wanted_games
|
|
||||||
):
|
|
||||||
return False
|
return False
|
||||||
# check if we can progress any campaign for the played game
|
# check if we can progress any campaign for the played game
|
||||||
for campaign in self.inventory:
|
for campaign in self.inventory:
|
||||||
if campaign.game == game and campaign.can_earn(channel):
|
if campaign.can_earn(channel):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -1582,16 +1577,10 @@ class Twitch:
|
|||||||
if watching_channel is None:
|
if watching_channel is None:
|
||||||
# if we aren't watching anything, we can't earn any drops
|
# if we aren't watching anything, we can't earn any drops
|
||||||
return None
|
return None
|
||||||
watching_game: Game | None = watching_channel.game
|
|
||||||
if watching_game is None:
|
|
||||||
# if the channel isn't playing anything in particular, we can't determine the drop
|
|
||||||
return None
|
|
||||||
drops: list[TimedDrop] = []
|
drops: list[TimedDrop] = []
|
||||||
for campaign in self.inventory:
|
for campaign in self.inventory:
|
||||||
if (
|
# can be earned on this channel
|
||||||
campaign.game == watching_game # campaign's game matches watching game
|
if (campaign.can_earn(watching_channel)):
|
||||||
and campaign.can_earn(watching_channel) # can be earned on this channel
|
|
||||||
):
|
|
||||||
# add only the drops we can actually earn
|
# add only the drops we can actually earn
|
||||||
drops.extend(drop for drop in campaign.drops if drop.can_earn(watching_channel))
|
drops.extend(drop for drop in campaign.drops if drop.can_earn(watching_channel))
|
||||||
if drops:
|
if drops:
|
||||||
|
|||||||
Reference in new issue
Block a user