Пример #1
0
def mastery_from_desc() -> Question:
    mastery: Mastery = random.choice(riotapi.get_masteries())
    desc: str = censor_name(util.SANITIZER.handle(mastery.descriptions[-1]),
                            *mastery.name.split())

    return Question("What's the name of this mastery?",
                    desc,
                    mastery.name,
                    extra=f" ({mastery.tree.value} Tree)")
    def _init_masteries(all_masteries):
        if not all_masteries:
            riotapi_masteries = {mastery.id: mastery for mastery in riotapi.get_masteries()}

            all_masteries = json.load(open(os.path.join(buildcalculator_director, 'masteries.json')))
            all_masteries = {int(id_): data for id_, data in all_masteries.items()}
            for id_, m in all_masteries.items():
                for key, values in m.items():
                    if key != 'tree' and key != 'name':
                        m[key] = {int(i): data for i, data in values.items()}
        else:
            MasteryPage._masteries_by_id = all_masteries

        MasteryPage._masteries_by_id = {id_: _Mastery(riotapi_masteries[id_], data) for id_, data in all_masteries.items()}
        MasteryPage._masteries_by_name = {mastery.name: mastery for _, mastery in MasteryPage._masteries_by_id.items()}
Пример #3
0
def test_masteries():
    int_test_handler.test_result(riotapi.get_masteries())
Пример #4
0
def tree_from_mastery() -> Question:
    mastery: Mastery = random.choice(riotapi.get_masteries())

    return Question(f"What tree is {mastery.name} from?", None,
                    mastery.tree.value)
Пример #5
0
def test_masteries():
    int_test_handler.test_result(riotapi.get_masteries())