def get_all_players(roles=None, *, rolemap=None): from src.status import is_dying if rolemap is None: rolemap = var.ROLES if roles is None: roles = set(rolemap.keys()) pl = set() for role in roles: for user in rolemap[role]: pl.add(user) if rolemap is not var.ROLES: return pl return {p for p in pl if not is_dying(var, p)}
def get_players(roles=None, *, mainroles=None): from src.status import is_dying if mainroles is None: mainroles = var.MAIN_ROLES if roles is None: roles = set(mainroles.values()) pl = set() for user, role in mainroles.items(): if role in roles: pl.add(user) if mainroles is not var.MAIN_ROLES: # we weren't given an actual player list (possibly), # so the elements of pl are not necessarily in var.ALL_PLAYERS return list(pl) return [p for p in var.ALL_PLAYERS if p in pl and not is_dying(var, p)]