db_utils weigh change test
This commit is contained in:
parent
0c2e3754da
commit
4c2b3f589f
1 changed files with 2 additions and 2 deletions
|
@ -26,14 +26,14 @@ def get_random_character() -> Character | None:
|
||||||
if not characters:
|
if not characters:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
weights = [c['weight'] for c in characters]
|
weights = [config.RARITY_TO_WEIGHT[c['rarity']] for c in characters]
|
||||||
chosen = choices(characters, weights=weights, k=1)[0]
|
chosen = choices(characters, weights=weights, k=1)[0]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': chosen['id'],
|
'id': chosen['id'],
|
||||||
'name': chosen['name'],
|
'name': chosen['name'],
|
||||||
'rarity': chosen['rarity'],
|
'rarity': chosen['rarity'],
|
||||||
'weight': chosen['weight'],
|
'weight': config.RARITY_TO_WEIGHT[chosen['rarity']],
|
||||||
'image_url': chosen['file_id']
|
'image_url': chosen['file_id']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue