/*
文件名:Base_Input.nut
路径:CallBack/Base_Input.nut
创建日期:2024-04-06	05:35
文件用途:普通输入
*/
Base_InputFunc_Handle <- {}

Base_InputFunc_Handle.ResetScript <- function(SUser, CmdString) {
    sq_ReloadScript();
    print("\n重载函数\n");
};

Base_InputFunc_Handle.T <- function(SUser, CmdString) {
    local Location = SUser.GetLocation();
    print("\n");
    print("Xpos: " + Location.Pos.X);
    print("Ypos: " + Location.Pos.Y);
    print("Town: " + Location.Town);
    print("Area: " + Location.Area);
    print("GetState: " + SUser.GetState());
    print("GetCharacCount: " + SUser.GetCharacCount());
    print("GetUID: " + SUser.GetUID());
    print("GetCID: " + SUser.GetCID());
    print("GetCharacJob: " + SUser.GetCharacJob());
    print("GetCharacName: " + SUser.GetCharacName());
    print("GetCharacLevel: " + SUser.GetCharacLevel());

    print("GetCharacGrowType: " + SUser.GetCharacGrowType());
    print("GetCharacSecondGrowType: " + SUser.GetCharacSecondGrowType());
    print("GetFatigue: " + SUser.GetFatigue());
    print("GetMaxFatigue: " + SUser.GetMaxFatigue());
    print("GetParty: " + SUser.GetParty());
    print("\n");
};

//普通输入的hook函数map
Base_InputHookFunc_Handle <- {}

function Cb_base_input(C_User, CmdString) {
    local Flag = true;
    foreach(_Index, Func in Base_InputHookFunc_Handle) {
        local Ret = Func(C_User, CmdString);
        if (!Ret) Flag = false;
    }
    local Pos = CmdString.find(" ");
    local Str;
    if (Pos) {
        Str = CmdString.slice(0, Pos);
    } else {
        Str = CmdString;
    }
    if (Str in Gm_InputFunc_Handle) {
        local SUser = User(C_User);
        Gm_InputFunc_Handle[CmdString](SUser, CmdString);
    }
    return Flag;
}