%%%--------------------------------------
%%% @Module  : pp_activitycalen
%%% @Author  : xiaoxiang
%%% @Created : 2017-03-01
%%% @Description:  活动日历
%%%--------------------------------------
-module(pp_activitycalen).
-export([
        handle/3
    ]).
-compile(export_all).
-include("server.hrl").
-include("figure.hrl").
-include("common.hrl").
-include ("def_module.hrl").
-include ("def_daily.hrl").
-include ("daily.hrl").
-include ("activitycalen.hrl").

% 查询活动活跃度次数
handle(15701, Player, [Type]) ->
    #player_status{id = RoleId, figure = #figure{lv = Lv,vip=VipLv}} = Player,
    [{_,TCoin},{_,THonor}|_] = lib_daily:get_count(RoleId, [{?MOD_ACTIVITY, ?DEFAULT_SUB_MODULE, ?ACTIVITY_COIN_DAILY},{?MOD_ACTIVITY, ?DEFAULT_SUB_MODULE, ?ACTIVITY_HONOUR_DAILY}]),
    PowerLive = lib_counter:get_count(RoleId, ?MOD_ACTIVITY, ?POWER_LIVE_DAILY),
    IsSupVip = lib_sup_vip:is_sup_vip(Player),
    Res = lib_dungeon_main_line:get_open_main_line(Player#player_status.id, Lv),
    OtherData = #other_data{is_sup_vip = IsSupVip, main_line_times = Res},
    mod_activitycalen:ask_activity_num(RoleId, Lv, VipLv, 0, Type,TCoin,THonor,PowerLive, OtherData);

%% 查询活动状态
handle(15702, Player, _Data) ->
    % ?PRINT("15702,  ~n", []),
    lib_activitycalen:ask_activity_status(Player);

%% 查询活跃度奖励
handle(15703, Player, _Data) ->
    % ?PRINT("15703,  ~n", []),
    lib_activitycalen:ask_live_reward(Player);

% 领取奖励
handle(15705, Player, [Id]) ->
    % ?PRINT("15705, Id:~p  ~n", [Id]),
    lib_activitycalen:get_live_reward(Player, Id);

%% 查询玩家活跃度形象
handle(15709, Player, []) ->
    lib_liveness:get_player_liveness(Player);

%% 玩家活跃度升级
handle(15710, Player, []) ->
    lib_liveness:liveness_lv_up(Player);

%% 查询活动
handle(15715, Player, [Module, ModuleSub]) ->
    mod_activitycalen:ask_activity(Player#player_status.id, Module, ModuleSub);

%% 倒计时进入活动，发起协议记录状态
handle(15717, Player, [Module]) ->
    lib_activitycalen_api:enter_activity_record(Module, Player#player_status.id, 1),
    {ok, Player};

%% 以下是活动预约相关
handle(15718, Player, []) ->
    lib_activity_reserve:get_act_reserve_status(Player),
    ok;

handle(15719, Player, [Module, ModuleSub, SubAct]) ->
    lib_activity_reserve:act_reserve(Player, [Module, ModuleSub, SubAct]);

handle(15720, Player, [Module, ModuleSub, SubAct]) ->
    lib_activity_reserve:act_reserve_rewards(Player, [Module, ModuleSub, SubAct]);

handle(_Cmd, _Player, _Data) ->
    {error, atom_to_list(?MODULE) ++ " no match"}.
