%%-----------------------------------------------------------------------------
%% @Module  :       pp_limit_goal
%% @Author  :       WJQ
%% @Created :       2019-03-29
%% @Description:    限时目标
%%-----------------------------------------------------------------------------
-module (pp_limit_goal).

-include ("server.hrl").
-include ("common.hrl").
-include ("limit_goal.hrl").
-include ("figure.hrl").

-export ([
	handle/3
]).

handle(Cmd, PS, Args) ->
	#player_status{figure = Figure} = PS,
	#figure{lv = LV} = Figure,
	case LV >= ?LIMIT_GOAL_LV of
		true  -> do_handle(Cmd, PS, Args);
		false -> skip
	end.

%% 主界面信息
do_handle(50101, PS, []) ->
	#player_status{id = RoleId, limit_goal = LimitGoal} = PS,
	lib_limit_goal:send_info(RoleId, LimitGoal),
	{ok, PS};

%% 领取任务奖励
do_handle(50102, PS, [GoalId, TaskId]) ->
	lib_limit_goal:send_task_reward(PS, GoalId, TaskId);

do_handle(_Cmd, PS, _Args) ->
	?ERR("no match Cmd:~p Args:~p~n", [_Cmd, _Args]),
	{ok, PS}.