%%%-----------------------------------
%%% @Module  : data_kf_1vn_m
%%% @Email   : ming_up@foxmail.com
%%% @Created : 2018.1.24
%%% @Description: 跨服1vN 手动配置
%%%-----------------------------------
-module(data_kf_1vn_m).

-include("common.hrl").
-include("server.hrl").
-include("scene.hrl").
-include("predefine.hrl").
-include("kf_1vn.hrl").
-compile(export_all).


get_config(Type) ->
    case Type of
        race_1_pre_scene -> data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_PRE_SCENE);
        race_1_scene -> data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_SCENE);
        race_2_pre_scene -> data_kf_1vn:get_value(?KF_1VN_CFG_RACE_2_PRE_SCENE);
        race_2_scene -> data_kf_1vn:get_value(?KF_1VN_CFG_RACE_2_SCENE);
        scenes -> [data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_PRE_SCENE), data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_SCENE),
                   data_kf_1vn:get_value(?KF_1VN_CFG_RACE_2_PRE_SCENE), data_kf_1vn:get_value(?KF_1VN_CFG_RACE_2_SCENE)];
        pre_scene -> [data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_PRE_SCENE), data_kf_1vn:get_value(?KF_1VN_CFG_RACE_2_PRE_SCENE)];
        pk_scenes -> [data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_SCENE), data_kf_1vn:get_value(?KF_1VN_CFG_RACE_2_SCENE)];
        race_1_max_times -> data_kf_1vn:get_value(?KF_1VN_CFG_RACE_1_TIMES);
        loading_time -> 6;                                                %% 战斗场景准备时间
        area_min_num -> data_kf_1vn:get_value(?KF_1VN_CFG_AREA_MIN_NUM);  %% 单个比赛区域最少人数
        voucher_id -> data_kf_1vn:get_value(?KF_1VN_CFG_VOUCHER);
        open_day -> data_kf_1vn:get_value(?KF_1VN_CFG_OPEN_DAY);          %% 开服天数后才开启
        min_auction_price -> 500;                                         %% 竞拍最小加价
        combat_calc -> data_kf_1vn:get_value(?KF_1VN_CFG_COMBAT_POWER);   %% 单位评分战力
        _ -> false
    end.

get_bet_cost(BetType) ->
    CostList = data_kf_1vn:get_value(?KF_1VN_CFG_BET_COST),
    Length = erlang:length(CostList),
    if
        BetType >= Length andalso BetType =< Length ->
            Cost = lists:nth(BetType, CostList);
        true ->
            [Cost|_] = CostList
    end,
    Cost.

%% 战力差别范围
get_race_1_match_args(MatchTurn) ->
    case MatchTurn of
        0 -> 0.1;
        1 -> 0.3;
        2 -> 0.5;
        _ -> 9999
    end.
