%%% -------------------------------------------------------
%%% @author huangyongxing@yeah.net
%%% @doc
%%% GM命令相关发送
%%% @end
%%% -------------------------------------------------------
-module(cli_gm).
-export([
        set_level/2
        , get_equips/1
        , send_gm/2
    ]).

set_level(Socket, SetLevel) when is_port(Socket) ->
    GmTokens = ["setlv", SetLevel],
    send_gm(Socket, GmTokens);
set_level(_Socket, _SetLevel) ->
    throw({error, {set_level, _SetLevel}}).

%% 获取套装
get_equips(Socket) ->
    GmTokens = ["autoequip", "1", "2"],
    send_gm(Socket, GmTokens).

%% 发送GM命令
send_gm(Socket, GmTokens) ->
    GmTokensSure = [uio:thing_to_string(GmToken) || GmToken <- GmTokens],
    GmStr = string:join(GmTokensSure, "_"),
    % ?INFO_TTY("gm:~s", [GmStr]),
    send_gm_str(Socket, GmStr).

send_gm_str(Socket, GmStr) ->
    cli_simu_proto:pack_send(Socket, 11101, GmStr).

