%%%-------------------------------------------------------------------
%%% @doc     精英考核 - 协议文件
%%% Module  : lib_elite_assessment.erl
%%% Created : 2020-07-13
%%% @Author : tyl
%%%-------------------------------------------------------------------
-module(pp_elite_assessment).

-include("server.hrl").
-include("def_module.hrl").
-include("def_vip.hrl").
-include("figure.hrl").
-include("errcode.hrl").
-include("common.hrl").

-export([handle/3]).


handle(Cmd, Player, Data) ->
	#player_status{figure = Figure} = Player,
	OpenLv = lib_module:get_open_lv(?MOD_ELITE_ASSESS),
	case Figure#figure.lv >= OpenLv of
		true ->
			do_handle(Cmd, Player, Data);
		false -> skip
	end.

%% 获取章节信息
do_handle(45201, Player, []) ->
	lib_elite_assessment:send_category_list(Player),
	{ok, Player};

%% 领取章节奖励
do_handle(45202, Player, [_Category]) ->
	% {ok, NewPlayer} = lib_elite_assessment:receive_category_reward(Player, Category),
	{ok, Player};

%% 领取任务奖励
do_handle(45203, Player, [Category, TaskId]) ->
	{ok, NewPlayer} = lib_elite_assessment:receive_reward(Player, Category, TaskId),
	{ok, NewPlayer};

do_handle(_Cmd, _Player, _Data) ->
	{error, "pp_elite_assessment no match~n"}.
