%%%-------------------------------------------------------------------
%%% @author zmh
%%% @doc
%%%
%%% @end
%%%-------------------------------------------------------------------
-module(pp_glamour).
-include("server.hrl").
-include("glamour.hrl").
-include("figure.hrl").
-include("errcode.hrl").
-include("def_module.hrl").
-include("predefine.hrl").
-include("guild.hrl").
%% API
-export([handle/3]).

handle(Cmd, Status, ProData) ->
    OpenDay = util:get_open_day(),
    OpenLimitD = data_glamour:get(open_day),
    case OpenDay >= OpenLimitD of
        true ->
            do_handle(Cmd, Status, ProData);
        false ->
            ignore
    end.
%% 获取活动状态
do_handle(14200, Status, []) ->
    #player_status{id=RoleID}=Status,
    mod_glamour_ctrl:get_act_state(RoleID),
    {ok,Status};

%%跑马起步状态
do_handle(14201,Status,[])->
    #player_status{id=RoleID}=Status,
    mod_glamour_mgr:get_run_state(RoleID),
    Focuser = lib_role_glamour:trans_focuser_role(Status),
    mod_glamour_focus:enter_glamour_show(Focuser),
    {ok,Status};

%%主推用 一般不需要请求
do_handle(14211,Status,[])->
    #player_status{id=RoleID}=Status,
    mod_glamour_mgr:apply_cast({get_running_state,RoleID}),
    {ok,Status};

do_handle(14202,Status,[])->
    #player_status{id=RoleID}=Status,
    mod_glamour_focus:get_focus_state(RoleID),
    {ok,Status};

do_handle(14203,Status,[])->
    lib_role_glamour:get_top_focuser_show(Status),
    {ok,Status};

do_handle(14205,Status,[])->
    #player_status{guild = GuildStatus}=Status,
    #status_guild{id = GuildId} = GuildStatus,
    GuildId>0 andalso lib_role_glamour:get_focus_data(Status),
    {ok,Status};

do_handle(14208,Status,[])->
    #player_status{id=RoleID}=Status,
    mod_glamour_focus:get_show_focusers(RoleID),
    {ok,Status};

do_handle(14209,Status,[RunID,Item])->
    lib_role_glamour:use_item(RunID,Item,Status),
    {ok,Status};

do_handle(14210,Status,[RunID,Add])->
    lib_role_glamour:guess_runer(RunID,Add,Status),
    {ok,Status};

do_handle(14212,Status,[Item,AimId])->
    NStatus = lib_role_glamour:buy_items(Item,AimId,Status),
    {ok,NStatus};

do_handle(14213,Status,[])->
    #player_status{id=RoleID}=Status,
    mod_glamour_focus:get_logs(RoleID),
    {ok,Status};

do_handle(14214,Status,[])->
    #player_status{guild = GuildStatus}=Status,
    #status_guild{id = GuildId} = GuildStatus,
    GuildId>0 andalso lib_role_glamour:get_focus_view(Status),
    {ok,Status};

do_handle(14215,Status,[])->
    #player_status{id=RoleID}=Status,
    mod_glamour_mgr:get_rand_heads(RoleID),
    {ok,Status};

do_handle(_Cmd, _Player, _Data) ->
    ok.