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_
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()
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_
def get(c): """returns a clan by its clan id""" return query(all()).where(lambda x: x.id == c).first_or_default(None)
def get_paths(): """returns advanced schools list""" return query(__api.ds.schools) \ .where(lambda x: 'alternate' in x.tags) \ .to_list()
def get_advanced(): """returns advanced schools list""" return query(__api.ds.schools) \ .where(lambda x: 'advanced' in x.tags) \ .to_list()
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()
def get(c): """return a school by its id""" return query(__api.ds.schools).where(lambda x: x.id == c).first_or_default(None)
def get(c): """return a school by its id""" return query( __api.ds.schools).where(lambda x: x.id == c).first_or_default(None)
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)