%% ---------------------------------------------------------------------------
%% @doc 离线玩家信息api
%% @author hek
%% @since  2016-11-30
%% @deprecated
%% ---------------------------------------------------------------------------

-module (lib_offline_api).
-export ([login/1]).
-export ([get_player_info/2]).
-export ([apply_cast/4, apply_cast/3]).

%% 查看内存玩家数据
-export([
        update_offline_ps/2
    ]).

-include("server.hrl").
-include("rec_offline.hrl").
-include("common.hrl").
-include("errcode.hrl").
-include("relationship.hrl").

%% ---------------------------------------------------------------------------
%% @doc 玩家上线从ets表中移除离线数据
-spec login(Id) -> Result when
	Id    		:: integer(),                %% 玩家id
	Result      :: ok.
%% @end
%% ---------------------------------------------------------------------------
login(Id) ->
	lib_offline_player:login(Id).

%% ---------------------------------------------------------------------------
%% @doc 按格式(ResultForm)返回#player_status{}中的字段值集合
-spec get_player_info(Id, ResultForm) -> Result when
    Id    		:: integer(),                %% 玩家id
    ResultForm  :: integer() | list() | all, %% #player_status.xx | [#player_status.xx, ...] | all | not_exist(玩家不存在)
    Result      :: term().                   %% 对应上面的参数的返回值：记录中某个字段的值|记录中某些字段组成的列表|全记录
%% @end
%% ---------------------------------------------------------------------------
get_player_info(Id, ResultForm) ->
	lib_offline_player:get_player_info(Id, ResultForm).


%% ---------------------------------------------------------------------------
%% @doc 按格式(ValueList)更新#player_status{}中的字段  ets中不存在，则不处理
-spec update_offline_ps(Id, ValueList) -> ok when
    Id          :: integer(),                %% 玩家id
    ValueList   :: list() | tuple().         %% [{key,value}] | #player_status{}
%% @end
%% ---------------------------------------------------------------------------
update_offline_ps(Id, ValueList) ->
    lib_offline_player:update_offline_ps(Id, ValueList).

apply_cast(PlayerId, lib_player_event, dispatch, [EventTypeId, Data]) ->
    lib_player_event:dispatch(PlayerId, EventTypeId, Data),
    ok;
%% @doc mod_offline_player进程cast方式执行FA
apply_cast(PlayerId, Moudle, Method, Args) ->
	mod_offline_player:apply_cast(PlayerId, Moudle, Method, Args).

apply_cast(Moudle, Method, Args) ->
    mod_offline_player:apply_cast(Moudle, Method, Args).
