Fix sets not being compatible with random selections in Python 3.12.
This commit is contained in:
parent
2e8b85ab98
commit
3ee40f1162
@ -360,9 +360,9 @@ class JubeatBase(CoreHandler, CardManagerHandler, PASELIHandler, Base):
|
||||
normalindex = 2
|
||||
premiumindex = 1
|
||||
if normalemblems:
|
||||
normalindex = random.sample(normalemblems, 1)[0]
|
||||
normalindex = random.sample(list(normalemblems), 1)[0]
|
||||
if premiumemblems:
|
||||
premiumindex = random.sample(premiumemblems, 1)[0]
|
||||
premiumindex = random.sample(list(premiumemblems), 1)[0]
|
||||
|
||||
return normalindex, premiumindex
|
||||
|
||||
|
@ -95,10 +95,12 @@ class JubeatClan(
|
||||
# range, but it will be a different ID depending on the prefecture set in settings. This means its not safe to send
|
||||
# these song IDs, so we explicitly exclude them.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("daily")
|
||||
all_songs = set(
|
||||
song.id
|
||||
for song in data.local.music.get_all_songs(cls.game, cls.version)
|
||||
if song.id not in cls.FIVE_PLAYS_UNLOCK_EVENT_SONG_IDS
|
||||
all_songs = list(
|
||||
set(
|
||||
song.id
|
||||
for song in data.local.music.get_all_songs(cls.game, cls.version)
|
||||
if song.id not in cls.FIVE_PLAYS_UNLOCK_EVENT_SONG_IDS
|
||||
)
|
||||
)
|
||||
if len(all_songs) >= 2:
|
||||
daily_songs = random.sample(all_songs, 2)
|
||||
|
@ -151,7 +151,7 @@ class JubeatFesto(
|
||||
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
|
||||
# Generate a new list of two FC challenge songs.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("daily")
|
||||
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
|
||||
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
|
||||
if len(all_songs) >= 2:
|
||||
daily_songs = random.sample(all_songs, 2)
|
||||
data.local.game.put_time_sensitive_settings(
|
||||
|
@ -335,7 +335,7 @@ class JubeatProp(
|
||||
if data.local.network.should_schedule(cls.game, cls.version, "league_course", "weekly"):
|
||||
# Generate a new league course list, save it to the DB.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("weekly")
|
||||
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
|
||||
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
|
||||
if len(all_songs) >= 3:
|
||||
league_songs = random.sample(all_songs, 3)
|
||||
data.local.game.put_time_sensitive_settings(
|
||||
@ -382,7 +382,7 @@ class JubeatProp(
|
||||
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
|
||||
# Generate a new list of two FC challenge songs.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("daily")
|
||||
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
|
||||
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
|
||||
if len(all_songs) >= 2:
|
||||
daily_songs = random.sample(all_songs, 2)
|
||||
data.local.game.put_time_sensitive_settings(
|
||||
|
@ -64,7 +64,7 @@ class JubeatQubell(
|
||||
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
|
||||
# Generate a new list of two FC challenge songs.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("daily")
|
||||
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
|
||||
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
|
||||
if len(all_songs) >= 2:
|
||||
daily_songs = random.sample(all_songs, 2)
|
||||
data.local.game.put_time_sensitive_settings(
|
||||
|
@ -42,7 +42,7 @@ class JubeatSaucer(
|
||||
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
|
||||
# Generate a new list of two FC challenge songs.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("daily")
|
||||
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
|
||||
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
|
||||
if all_songs:
|
||||
today_song = random.sample(all_songs, 1)[0]
|
||||
data.local.game.put_time_sensitive_settings(
|
||||
|
@ -54,7 +54,7 @@ class JubeatSaucerFulfill(
|
||||
if data.local.network.should_schedule(cls.game, cls.version, "fc_challenge", "daily"):
|
||||
# Generate a new list of two FC challenge songs.
|
||||
start_time, end_time = data.local.network.get_schedule_duration("daily")
|
||||
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
|
||||
all_songs = list(set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version)))
|
||||
if len(all_songs) >= 2:
|
||||
daily_songs = random.sample(all_songs, 2)
|
||||
data.local.game.put_time_sensitive_settings(
|
||||
|
Loading…
Reference in New Issue
Block a user