Esempio n. 1
0
def get_requirements(sid):
    """returns the requirements to join the given school"""
    school_ = get(sid)
    if not school_:
        log.api.error(u"school not found: %s", sid)
        return []

    requirements_by_data_ = school_.require

    # fixme. since i can't rewrite all alternate path
    # I decided to patch these requirement by code

    import api.character.schools
    from dal.requirements import Requirement
    coded_requirements_ = []

    if is_path(sid):
        # An alternate path can only be joined
        # on the same school rank that its technique replaces

        path_rank_ = query(school_.techs).select(a_('rank')).first_or_default(0)

        if path_rank_ > 0:

            r = Requirement()
            r.field = api.character.schools.get_current()
            r.type = 'school'
            r.min = path_rank_ - 1
            r.max = path_rank_ - 1
            r.trg = None
            r.text = __api.tr("Replaces School Rank: {0}").format(path_rank_)

            coded_requirements_.append(r)

    return requirements_by_data_ + coded_requirements_
Esempio n. 2
0
def get_emphasis_to_choose(sid):
    """returns player choose emphasis"""
    school = get(sid)
    if not school:
        return []
    return query(school.skills) \
        .where(lambda x: x.emph and x.emph.startswith('*')) \
        .to_list()
Esempio n. 3
0
def get_emphasis_to_choose(sid):
    """returns player choose emphasis"""
    school = get(sid)
    if not school:
        return []
    return query(school.skills) \
        .where(lambda x: x.emph and x.emph.startswith('*')) \
        .to_list()
Esempio n. 4
0
def get_requirements(sid):
    """returns the requirements to join the given school"""
    school_ = get(sid)
    if not school_:
        log.api.error(u"school not found: %s", sid)
        return []

    requirements_by_data_ = school_.require

    # fixme. since i can't rewrite all alternate path
    # I decided to patch these requirement by code

    import api.character.schools
    from dal.requirements import Requirement
    coded_requirements_ = []

    if is_path(sid):
        # An alternate path can only be joined
        # on the same school rank that its technique replaces

        path_rank_ = query(school_.techs).select(
            a_('rank')).first_or_default(0)

        if path_rank_ > 0:

            r = Requirement()
            r.field = api.character.schools.get_current()
            r.type = 'school'
            r.min = path_rank_ - 1
            r.max = path_rank_ - 1
            r.trg = None
            r.text = __api.tr("Replaces School Rank: {0}").format(path_rank_)

            coded_requirements_.append(r)

    return requirements_by_data_ + coded_requirements_
Esempio n. 5
0
def get(c):
    """returns a clan by its clan id"""
    return query(all()).where(lambda x: x.id == c).first_or_default(None)
Esempio n. 6
0
def get_paths():
    """returns advanced schools list"""
    return query(__api.ds.schools) \
        .where(lambda x: 'alternate' in x.tags) \
        .to_list()
Esempio n. 7
0
def get_advanced():
    """returns advanced schools list"""
    return query(__api.ds.schools) \
        .where(lambda x: 'advanced' in x.tags) \
        .to_list()
Esempio n. 8
0
def get_base():
    """returns basic schools list"""
    return query(__api.ds.schools) \
        .where(lambda x: 'advanced' not in x.tags) \
        .where(lambda x: 'alternate' not in x.tags) \
        .to_list()
Esempio n. 9
0
def get(c):
    """return a school by its id"""
    return query(__api.ds.schools).where(lambda x: x.id == c).first_or_default(None)
Esempio n. 10
0
def get_paths():
    """returns advanced schools list"""
    return query(__api.ds.schools) \
        .where(lambda x: 'alternate' in x.tags) \
        .to_list()
Esempio n. 11
0
def get_advanced():
    """returns advanced schools list"""
    return query(__api.ds.schools) \
        .where(lambda x: 'advanced' in x.tags) \
        .to_list()
Esempio n. 12
0
def get_base():
    """returns basic schools list"""
    return query(__api.ds.schools) \
        .where(lambda x: 'advanced' not in x.tags) \
        .where(lambda x: 'alternate' not in x.tags) \
        .to_list()
Esempio n. 13
0
def get(c):
    """return a school by its id"""
    return query(
        __api.ds.schools).where(lambda x: x.id == c).first_or_default(None)
Esempio n. 14
0
def pack_by_id(pack_id):
    """return a pack by its id"""
    return query(
        packs()).where(lambda x: x.id == pack_id).first_or_default(None)