%%%-------------------------------------------------------------------
%%% @doc    经验海 - 协议文件
%%% Module  : pp_exp_sea.erl
%%% Created : 2021-07-27
%%% @end
%%% @author : tyl
%%%-------------------------------------------------------------------
-module(pp_exp_sea).

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

-export([handle/3]).

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

%% 主界面信息
do_handle(46300, Player, []) ->
	exp_sea_logic:get_exp_sea_info(Player);

%% 强化信息
do_handle(46301, Player, []) ->
	exp_sea_logic:get_strength_info(Player);

%% 点击强化
do_handle(46302, Player, [Type]) ->
	exp_sea_logic:click_strength(Player, Type);

%% 挂机收益
do_handle(46303, Player, []) ->
	exp_sea_logic:get_drop_reward_list(Player);

%% 进入场景
do_handle(46305, Player, []) ->
	exp_sea_logic:enter_exp_sea(Player);

%% 退出场景
do_handle(46306, Player, []) ->
	case exp_sea_logic:is_exp_sea_scene(Player#player_status.scene) of
		true -> exp_sea_logic:exit_exp_sea(Player, ?NORMAL_EXIT);
		_ -> {ok, Player}
	end;

do_handle(_Cmd, _PS, _Args) ->
	?ERR("Nomatch Cmd:~p Args:~p", [_Cmd, _Args]),
	{ok, _PS}.