%%%--------------------------------------
%%% @Module  : pp_shop
%%% @Author  : xiaoxiang
%%% @Created : 2017.1.3
%%% @Description:  商城模块
%%%--------------------------------------
-module(pp_shop).
-export([handle/3]).

-include("server.hrl").
-include("common.hrl").
-include("shop.hrl").
-include("errcode.hrl").
-include("def_fun.hrl").
-include("def_module.hrl").
-include("goods.hrl").
-include("figure.hrl").

handle(Cmd, Player, ProData) ->
    case lib_module:is_open(Player, ?MOD_SHOP) of
        true ->
            handle_do(Cmd, Player, ProData);
        _ ->
            ok
    end.

handle_do(15301, Player, [Type]) when Type == ?SHOP_1VN_DEF orelse Type == ?SHOP_1VN ->
    lib_kf_1vn:get_goods_list(Player, Type);

handle_do(15301, Player, [Type]) ->
    lib_shop:get_goods_list(Player, Type);

%% 购买商品
handle_do(15302, Player, [KeyList, Type]) ->
    lib_shop:buy_goods_by_money_type(Player, KeyList, Type);

%% 根据物品类型id购买物品（快速购买）
handle_do(15304, Player, [GoodsId, Num, BuyType]) when Num > 0 ->
    lib_shop:quick_buy(Player, GoodsId, Num, BuyType);

handle_do(_Cmd, _Player, _Data) ->
    {error, atom_to_list(?MODULE) ++ " no match"}.
