Ejemplo n.º 1
0
def get_rank_data(lowest_rank):
    # lowest_rank 最低排名,可以视为按照score从高到底排序后,最多要取多少人
    score_data = ArenaScoreManager.get_all_desc(lowest_rank)

    # 对于相同积分的人,用战斗力排序
    rank_data = []
    for char_id, score in score_data:
        rank_data.append( (char_id, score, Char(char_id).power) )

    rank_data.sort(key=lambda item: (-item[1], -item[2]))
    return rank_data
Ejemplo n.º 2
0
def main(signum):
    logger = Logger('reset_arena_day.log')

    arena_scores = ArenaScoreManager.get_all()
    amount = len(arena_scores)
    logger.write("Reset Arena Day: Start. chars amount: {0}".format(amount))

    try:
        for char_id, score in arena_scores:
            attachment = _get_reward_by_score(score)
            if not attachment:
                continue

            char_id = int(char_id)
            mail = Mail(char_id)
            mail.add(MAIL_ARENA_DAY_REWARD_TITLE, MAIL_ARENA_DAY_REWARD_CONTENT, attachment=attachment)
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Reset Arena Day: Complete")
    finally:
        logger.close()
Ejemplo n.º 3
0
def main(signum):
    logger = Logger('reset_arena_day.log')

    arena_scores = ArenaScoreManager.get_all()
    amount = len(arena_scores)
    logger.write("Reset Arena Day: Start. chars amount: {0}".format(amount))

    try:
        for char_id, score in arena_scores:
            attachment = _get_reward_by_score(score)
            if not attachment:
                continue

            char_id = int(char_id)
            mail = Mail(char_id)
            mail.add(MAIL_ARENA_DAY_REWARD_TITLE,
                     MAIL_ARENA_DAY_REWARD_CONTENT,
                     attachment=attachment)
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Reset Arena Day: Complete")
    finally:
        logger.close()