def _output_CATCH_MONSTER_STAGE_CHALLENGE(split_date,out_put_file_path):
    """
        经验关卡挑战数据
         # 参与人数 参与次数  完成人数 总完成次数 到达要求人数 参与率 成功率
    """
    print("CATCH_MONSTER_STAGE_CHALLENGE")
    stage_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_GET_CATCH_MONSTER_RESULT, 'Err')
    stage_logs.extend(cur_action_log_dict.get(action_str, []))

    # 胜利失败关卡日志字典
    open_level = game_config.get_game_config_val_int("OpenLevelStageMonster")
    can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level]))

    result = []
    cur_date = split_date.strftime('%m/%d/%Y')
    # 参与人数
    challenge_user_count = len(set([l['uid'] for l in stage_logs]))
    # 参与次数
    challenge_count = len(stage_logs)
    # 总完成次数
    challenge_win_count = len([l for l in stage_logs if l['action'] == game_define.EVENT_ACTION_GET_CATCH_MONSTER_RESULT])
    # 完成人数
    challenge_win_user_count = len(set([l['uid'] for l in stage_logs if l['action'] == game_define.EVENT_ACTION_GET_CATCH_MONSTER_RESULT]))
    #胜率
    win_rate = str(division(challenge_win_count, challenge_count)*100)+'%'

    # 参与率
    join_rate = str(round(float(challenge_user_count)/float(can_join_user_num), 2)*100)+'%'
    result.append([cur_date,challenge_user_count, challenge_count,  challenge_win_user_count, challenge_win_count, can_join_user_num, join_rate, win_rate])

    out_put_file = open(out_put_file_path + 'CATCH_MONSTER_STAGE_CHALLENGE', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #2
0
def _output_FINGER_GUESS(out_put_file_path):
    """
        猜拳
        参与人数	总次数	到达要求人数	参与率
    """
    print("FINGER_GUESS")
    finger_guess_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(
        game_define.EVENT_ACTION_FINGER_GUESS_EXCHANGE, 'Err')
    finger_guess_logs.extend(cur_action_log_dict.get(action_str, []))

    join_user_num = len(set([log['uid'] for log in finger_guess_logs]))

    finger_guess_count = len(finger_guess_logs)

    open_level = game_config.get_game_config_val_int("OpenLevelFingerGuess")
    can_join_user_num = len(
        set([
            _uid for _uid, _lv in cur_user_level_dict.items()
            if _lv >= open_level
        ]))

    rate = round(float(join_user_num) / float(can_join_user_num), 2)

    result = [join_user_num, finger_guess_count, can_join_user_num, rate]

    out_put_file = open(out_put_file_path + 'FINGER_GUESS', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #3
0
def _output_WORLD_BOSS_STAGE_CHALLENGE(split_date,out_put_file_path):
    """
        经验关卡挑战数据
         # 参与人数 参与次数  完成人数 总完成次数 到达要求人数 参与率 成功率

    """
    print("WORLD_BOSS_STAGE_CHALLENGE")
    stage_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_WORLD_BOSS_ATTACK, 'Err')
    stage_logs.extend(cur_action_log_dict.get(action_str, []))

    # 胜利失败关卡日志字典
    open_level = game_config.get_game_config_val_int("OpenLevelWorldBoss")
    can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level]))
    result = []
    cur_date = split_date.strftime('%m/%d/%Y')
    # 参与人数
    challenge_user_count = len(set([l['uid'] for l in stage_logs]))
    # 参与次数
    challenge_count = len(stage_logs)
    # 总完成次数
    challenge_win_count = len([l for l in stage_logs if l['action'] == game_define.EVENT_ACTION_WORLD_BOSS_ATTACK])
    # 完成人数
    challenge_win_user_count = len(set([l['uid'] for l in stage_logs if l['action'] == game_define.EVENT_ACTION_WORLD_BOSS_ATTACK]))
    #胜率str(win_rate * 100)+"%"
    win_rate = str(division(challenge_win_count, challenge_count)*100)+"%"

    # 参与率
    join_rate = str(round(float(challenge_user_count)/float(can_join_user_num), 2)*100)+'%'
    result.append([cur_date,challenge_user_count, challenge_count,  challenge_win_user_count, challenge_win_count, can_join_user_num, join_rate, win_rate])

    out_put_file = open(out_put_file_path + 'WORLD_BOSS_STAGE_CHALLENGE', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #4
0
def _output_FISHING(out_put_file_path):
    """
        钓鱼
        参与人数	总钓鱼次数	到达要求人数	参与率
    """
    print("FISHING")
    fishing_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(
        game_define.EVENT_ACTION_FISHING_ONCE, 'Err')
    fishing_logs.extend(cur_action_log_dict.get(action_str, []))
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(
        game_define.EVENT_ACTION_FISHING_LOOP, 'Err')
    fishing_logs.extend(cur_action_log_dict.get(action_str, []))

    join_user_num = len(set([log['uid'] for log in fishing_logs]))

    fishing_count = sum([log['cost_fishing_count'] for log in fishing_logs])

    open_level = game_config.get_game_config_val_int("OpenLevelFishing")
    can_join_user_num = len(
        set([
            _uid for _uid, _lv in cur_user_level_dict.items()
            if _lv >= open_level
        ]))

    rate = round(float(join_user_num) / float(can_join_user_num), 2)

    result = [join_user_num, fishing_count, can_join_user_num, rate]

    out_put_file = open(out_put_file_path + 'FISHING', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #5
0
def _output_GYM_STAGE_CHALLENGE(split_date,out_put_file_path):
    """
        经验关卡挑战数据
         # 参与人数 参与次数  完成人数 总完成次数 到达要求人数 参与率 成功率
    """
    print("GYM_STAGE_CHALLENGE")
    stage_logs = []
    mop_stage_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_GYM_FAIL, 'Err')
    stage_logs.extend(cur_action_log_dict.get(action_str, []))
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_GYM_WIN, 'Err')
    stage_logs.extend(cur_action_log_dict.get(action_str, []))
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_GYM_MOP, 'Err')
    mop_stage_logs.extend(cur_action_log_dict.get(action_str, []))
    # if len(stage_logs) > 1:
    #  print ("GYM_STAGE_CHALLENGE len is : "+ str(len(stage_logs)) + str(stage_logs[0]))
    # 胜利失败关卡日志字典
    open_level = game_config.get_game_config_val_int("OpenLevelGym")
    can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level]))

    result = []
    cur_date = split_date.strftime('%m/%d/%Y')
    # 参与人数
    challenge_user_count = len(set([l['uid'] for l in stage_logs]))
    # 参与次数
    challenge_count = len(stage_logs)
    # 总完成次数
    challenge_win_count = len([l for l in stage_logs if l['action'] == game_define.EVENT_ACTION_GYM_WIN])
    # 完成人数
    challenge_win_user_count = len(set([l['uid'] for l in stage_logs if l['action'] == game_define.EVENT_ACTION_GYM_WIN]))
    # 扫荡次数
    mop_count = len(mop_stage_logs)
    #胜率
    win_rate = str(division(challenge_win_count, challenge_count)*100)+'%'

    # 参与率
    join_rate = str(round(float(challenge_user_count)/float(can_join_user_num), 2)*100)+'%'
    result.append([cur_date,challenge_user_count, challenge_count,  challenge_win_user_count, challenge_win_count, can_join_user_num, mop_count, join_rate, win_rate])

    out_put_file = open(out_put_file_path + 'GYM_STAGE_CHALLENGE', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #6
0
def _output_QUESTION(out_put_file_path):
    """
        问答
        参与人数	总次数	到达要求人数	参与率
    """
    print("QUESTION")
    question_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_QUIZ_ANSWER_TRUE, 'Err')
    question_logs.extend(cur_action_log_dict.get(action_str, []))

    join_user_num = len(set([log['uid'] for log in question_logs]))

    _count = len(question_logs)

    open_level = game_config.get_game_config_val_int("OpenLevelQuiz")
    can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level]))

    rate = round(float(join_user_num)/ float(can_join_user_num), 2)

    result = [join_user_num, _count, can_join_user_num, rate]

    out_put_file = open(out_put_file_path + 'QUESTION', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #7
0
def _output_FINGER_GUESS(out_put_file_path):
    """
        猜拳
        参与人数	总次数	到达要求人数	参与率
    """
    print("FINGER_GUESS")
    finger_guess_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_FINGER_GUESS_EXCHANGE, 'Err')
    finger_guess_logs.extend(cur_action_log_dict.get(action_str, []))

    join_user_num = len(set([log['uid'] for log in finger_guess_logs]))

    finger_guess_count = len(finger_guess_logs)

    open_level = game_config.get_game_config_val_int("OpenLevelFingerGuess")
    can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level]))

    rate = round(float(join_user_num)/ float(can_join_user_num), 2)

    result = [join_user_num, finger_guess_count, can_join_user_num, rate]

    out_put_file = open(out_put_file_path + 'FINGER_GUESS', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()
Example #8
0
def _output_GOLD_STAGE_CHALLENGE(split_date,out_put_file_path):
    """
        经验关卡挑战数据
         # 参与人数 参与次数  完成人数 总完成次数 到达要求人数 参与率 成功率

    """
    print("GOLD_STAGE_CHALLENGE")
    normal_stage_logs = []
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_STAGE_GOLD_WIN, 'Err')
    normal_stage_logs.extend(cur_action_log_dict.get(action_str, []))
    action_str = game_define.EVENT_LOG_ACTION_SQL_NAME_DICT.get(game_define.EVENT_ACTION_STAGE_GOLD_FAIL, 'Err')
    normal_stage_logs.extend(cur_action_log_dict.get(action_str, []))

    # 胜利失败关卡日志字典
    stage_id_logs_dict = dict()
    for _log in normal_stage_logs:
        _stage_id = _log['stage_index']
        _dat_lst = stage_id_logs_dict.get(_stage_id, [])
        _dat_lst.append(_log)
        stage_id_logs_dict[_stage_id] = _dat_lst

    open_level = game_config.get_game_config_val_int("OpenLevelStageGold")
    can_join_user_num = len(set([_uid for _uid, _lv in cur_user_level_dict.items() if _lv >= open_level]))

    result = []
    for _stage_id, logs in stage_id_logs_dict.items():
        cur_date = split_date.strftime('%m/%d/%Y')
        # 参与人数
        challenge_user_count = len(set([l['uid'] for l in logs]))
        # 参与次数
        challenge_count = len(logs)
        # 总完成次数
        challenge_win_count = len([l for l in logs if l['action'] == game_define.EVENT_ACTION_STAGE_GOLD_WIN])
        # 完成人数
        challenge_win_user_count = len(set([l['uid'] for l in logs if l['action'] == game_define.EVENT_ACTION_STAGE_GOLD_WIN]))
        #胜率
        win_rate = str(round(float(challenge_win_count)/float(challenge_count), 2)*100)+'%'

        # 参与率
        join_rate = str(round(float(challenge_user_count)/float(can_join_user_num), 2)*100)+'%'
        result.append([cur_date,_stage_id, challenge_user_count, challenge_count,  challenge_win_user_count, challenge_win_count, can_join_user_num, join_rate, win_rate])

    #排序
    result.sort(lambda x,y:cmp(x[1],y[1]))
    #副本名称
    for each_lst in result:
        # 副本信息
        stage_config = game_config.get_stages_config(int(each_lst[1]))
        # 副本名称
        stage_name = stage_config['stageInfo']+"_"+str(stage_config['id'])
        each_lst[1] = stage_name

    out_put_file = open(out_put_file_path + 'GOLD_STAGE_CHALLENGE', 'w')
    pickle.dump(result, out_put_file)
    out_put_file.close()



# if __name__ == "__main__":
#     start(sys.argv)

# start(['2015-06-05', '2015-06-05'])