mirror of
https://github.com/hypervortex/VH-Bombsquad-Modded-Server-Files
synced 2025-11-07 17:36:08 +00:00
Added new files
This commit is contained in:
parent
867634cc5c
commit
3a407868d4
1775 changed files with 550222 additions and 0 deletions
53
dist/ba_data/python/ba/_tournament.py
vendored
Normal file
53
dist/ba_data/python/ba/_tournament.py
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
"""Functionality related to tournament play."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
|
||||
def get_tournament_prize_strings(entry: dict[str, Any]) -> list[str]:
|
||||
"""Given a tournament entry, return strings for its prize levels."""
|
||||
# pylint: disable=too-many-locals
|
||||
from ba._generated.enums import SpecialChar
|
||||
from ba._gameutils import get_trophy_string
|
||||
|
||||
range1 = entry.get('prizeRange1')
|
||||
range2 = entry.get('prizeRange2')
|
||||
range3 = entry.get('prizeRange3')
|
||||
prize1 = entry.get('prize1')
|
||||
prize2 = entry.get('prize2')
|
||||
prize3 = entry.get('prize3')
|
||||
trophy_type_1 = entry.get('prizeTrophy1')
|
||||
trophy_type_2 = entry.get('prizeTrophy2')
|
||||
trophy_type_3 = entry.get('prizeTrophy3')
|
||||
out_vals = []
|
||||
for rng, prize, trophy_type in (
|
||||
(range1, prize1, trophy_type_1),
|
||||
(range2, prize2, trophy_type_2),
|
||||
(range3, prize3, trophy_type_3),
|
||||
):
|
||||
prval = (
|
||||
''
|
||||
if rng is None
|
||||
else ('#' + str(rng[0]))
|
||||
if (rng[0] == rng[1])
|
||||
else ('#' + str(rng[0]) + '-' + str(rng[1]))
|
||||
)
|
||||
pvval = ''
|
||||
if trophy_type is not None:
|
||||
pvval += get_trophy_string(trophy_type)
|
||||
|
||||
# If we've got trophies but not for this entry, throw some space
|
||||
# in to compensate so the ticket counts line up.
|
||||
if prize is not None:
|
||||
pvval = _ba.charstr(SpecialChar.TICKET_BACKING) + str(prize) + pvval
|
||||
out_vals.append(prval)
|
||||
out_vals.append(pvval)
|
||||
return out_vals
|
||||
Loading…
Add table
Add a link
Reference in a new issue