Gm_InputFunc_Handle["给"] <- function(SUser, CmdString) {
    local count = -1;
    local pos = 0;
    local handler = [];
    do {
        local start = pos;
        pos = CmdString.find(" ", pos + 1);
        if (pos != null) {
            handler.append(CmdString.slice(start + 1, pos));
        } else
            handler.append(CmdString.slice(start + 1));
        count = count + 1
    } while (pos != null)

    //得到空格数量
    if (count == 1) {
        local Ret = SUser.GiveItem(handler[1].tointeger(), 1);
        if (!Ret) SUser.SendNotiPacketMessage("发送失败背包是不是满了", 8);
    } else if (count == 2) {
        local Ret = SUser.GiveItem(handler[1].tointeger(), handler[2].tointeger());
        if (!Ret) SUser.SendNotiPacketMessage("发送失败背包是不是满了", 8);
    }
}

Gm_InputFunc_Handle["转职"] <- function(SUser, CmdString) {
    local count = -1;
    local pos = 0;
    local handler = [];
    do {
        local start = pos;
        pos = CmdString.find(" ", pos + 1);
        if (pos != null) {
            handler.append(CmdString.slice(start + 1, pos));
        } else
            handler.append(CmdString.slice(start + 1));
        count = count + 1
    } while (pos != null)

    //得到空格数量
    if (count == 1) {
        SUser.ChangeGrowType(handler[1].tointeger(), 0);
        SUser.SendNotiPacket(0, 2, 0);
        SUser.InitSkillW(handler[1].tointeger(), 0);
    } else if (count == 2) {
        SUser.ChangeGrowType(handler[1].tointeger(), handler[2].tointeger());
        SUser.SendNotiPacket(0, 2, 0);
        SUser.InitSkillW(handler[1].tointeger(), handler[2].tointeger());
    }
}


Gm_InputFunc_Handle["完成任务"] <- function(SUser, CmdString) {
    SUser.ClearQuest_Gm(674);
    SUser.ClearQuest_Gm(649);

    SUser.ClearQuest_Gm(675);
    SUser.ClearQuest_Gm(650);

    SUser.ClearQuest_Gm(4414);

    SUser.ClearQuest_Gm(2603);
    SUser.ClearQuest_Gm(2610);
    SUser.ClearQuest_Gm(2613);
    SUser.ClearQuest_Gm(2622);
    SUser.ClearQuest_Gm(4391);
    SUser.ClearQuest_Gm(4539);

    SUser.ClearQuest_Gm(220);
    SUser.ClearQuest_Gm(221);
}

Gm_InputFunc_Handle["升级"] <- function(SUser, CmdString) {
    local count = -1;
    local pos = 0;
    local handler = [];
    do {
        local start = pos;
        pos = CmdString.find(" ", pos + 1);
        if (pos != null) {
            handler.append(CmdString.slice(start + 1, pos));
        } else
            handler.append(CmdString.slice(start + 1));
        count = count + 1
    } while (pos != null)

    //得到空格数量
    if (count == 1) {
        SUser.SetCharacLevel(handler[1].tointeger());
    }
}

Gm_InputFunc_Handle["点券"] <- function(SUser, CmdString) {
    local count = -1;
    local pos = 0;
    local handler = [];
    do {
        local start = pos;
        pos = CmdString.find(" ", pos + 1);
        if (pos != null) {
            handler.append(CmdString.slice(start + 1, pos));
        } else
            handler.append(CmdString.slice(start + 1));
        count = count + 1
    } while (pos != null)

    //得到空格数量
    if (count == 1) {
        SUser.RechargeCera(handler[1].tointeger());
    }
}

Gm_InputFunc_Handle["test"] <- function(SUser, CmdString) {
    local count = -1;
    local pos = 0;
    local handler = [];
    do {
        local start = pos;
        pos = CmdString.find(" ", pos + 1);
        if (pos != null) {
            handler.append(CmdString.slice(start + 1, pos));
        } else
            handler.append(CmdString.slice(start + 1));
        count = count + 1
    } while (pos != null)

    //得到空格数量
    if (count == 1) {
        SUser.DropItem(3038, 300, 300);
    }
}


// Timer.SetTimeOut(function() {

//     Haker.LoadHook("0x0830ADF6", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int", "void"],
//         function(args) {
//             local SParty = Party(NativePointer(args[0]).readPointer());
//             local map_monster_param = NativePointer(Haker.CpuContext.ebp).add(0x10).readPointer();
//             local monster_uid = NativePointer(NativePointer(Haker.CpuContext.ebp).add(0x18).readPointer()).readU16();

//             SParty.ForeachMember(function(SUser, Index) {
//                 local user_item_list = Memory.alloc(8);
//                 Sq_CallFunc(S_Ptr("0x08152A2C"), "pointer", ["pointer"], user_item_list.C_Object);

//                 Sq_CallFunc(S_Ptr("0x0830ADF6"), "void", ["pointer", "pointer", "pointer", "pointer", "int", "int", "int", "int", "int", "pointer", "float", "int"], args[0], user_item_list.C_Object, args[2], args[3], Index + 1, 1, args[6], args[7], args[8], args[9], args[10], args[11]);

//                 api_copy_mapinfo_items_between_lists(NativePointer(args[1]), user_item_list);

//                 local Pack = Packet();
//                 Sq_CallFunc(S_Ptr("0x0830B8CC"), "pointer", ["pointer", "pointer", "pointer", "int", "int", "pointer", "pointer"], args[0], Pack.C_Object, user_item_list.C_Object, monster_uid, Index + 1, args[3], map_monster_param);
//                 SUser.Send(Pack);
//                 Pack.Delete();

//                 Sq_CallFunc(S_Ptr("0x08151F6E"), "pointer", ["pointer"], user_item_list.C_Object);
//             });

//             //跳过原逻辑
//             Sq_WriteByteArr(S_Ptr("0x830ADFC"), Haker.AsmGenerateMcd(
//                 "pop ebx",
//                 "pop esi",
//                 "pop edi",
//                 "pop ebp",
//                 "ret"));
//             return null;
//         },
//         function(args) {
//             //还原
//             Sq_WriteByteArr(S_Ptr("0x830ADFC"), [0x81, 0xec, 0x7c, 0x01, 0x00, 0x00, 0x8B, 0x55, 0x18]);
//             return null;
//         });

//     //跳过原本的怪物死亡掉落包构造
//     Haker.LoadHook("0x0830B8CC", ["pointer", "pointer", "pointer", "int", "int", "pointer", "pointer", "pointer"],
//         function(args) {
//             if (Haker.NextReturnAddress == "0x830CE08") {
//                 print(12313);
//                 local v109 = NativePointer(NativePointer(Haker.CpuContext.ebp).sub(0x90).readPointer());
//                 local v106 = NativePointer(Haker.CpuContext.ebp).sub(0x96)
//                 if (v109.add(44).readU32() == 100 && v106.readU8() != 1 && NativePointer(args[0]).add(109 * 4).readU32() != 1) {
//                     //跳过原逻辑
//                     Sq_WriteByteArr(S_Ptr("0x830B8D3"), Haker.AsmGenerateMcd(
//                         "add esp , 64",
//                         "pop ebx",
//                         "pop ebp",
//                         "ret"));
//                 }
//             }
//             return null;
//         },
//         function(args) {
//             if (Haker.NextReturnAddress == "0x830CE08") {
//                 local v109 = NativePointer(NativePointer(Haker.CpuContext.ebp).sub(0x90).readPointer());
//                 local v106 = NativePointer(Haker.CpuContext.ebp).sub(0x96)
//                 if (v109.add(44).readU32() == 100 && v106.readU8() != 1 && NativePointer(args[0]).add(109 * 4).readU32() != 1) {
//                     Sq_WriteByteArr(S_Ptr("0x830B8D3"), [0x8B, 0x45, 0x18, 0x66, 0x89, 0x45, 0xB4, 0x8B, 0x45, 0x0C]);
//                     return 1;
//                 }
//             }
//             return null;
//         });

//     //跳过原本的怪物死亡掉落包队伍发包
//     Haker.LoadHook("0x0859d14e", ["pointer", "pointer", "int"],
//         function(args) {
//             if (Haker.NextReturnAddress == "0x85a39db" && Sq_CallFunc(S_Ptr("0x0848F438"), "int", ["pointer"], args[1]) == 0) {
//                 //跳过原逻辑
//                 Sq_WriteByteArr(S_Ptr("0x859D154"), Haker.AsmGenerateMcd(
//                     "add esp , 28",
//                     "pop ebp",
//                     "ret"));
//             }
//             return null;
//         },
//         function(args) {
//             if (Haker.NextReturnAddress == "0x85a39db" && Sq_CallFunc(S_Ptr("0x0848F438"), "int", ["pointer"], args[1]) == 0) {
//                 Sq_WriteByteArr(S_Ptr("0x859D154"), [0xC7, 0x45, 0xF4, 0x00, 0x00, 0x00, 0x00]);
//                 return 0;
//             }
//             return null;
//         });

//     //DisPatcher_GetItem::check_error 校验用户是否非法捡取物品
//     Haker.LoadHook("0x081C35AC", ["int"],
//         function(args) {
//             return null;
//         },
//         function(args) {
//             local user = NativePointer(Haker.CpuContext.ebp).add(0xc).readPointer();
//             local msg_base = NativePointer(Haker.CpuContext.ebp).add(0x10).readPointer();
//             local drop_id = NativePointer(msg_base).add(13).readU16();
//             local res = validate_pickup_permission(user, drop_id);
//             return res;
//         });

//     //跳过物品掷点
//     Haker.LoadHook("0x0850D756", ["pointer", "bool"],
//         function(args) {
//             return null;
//         },
//         function(args) {
//             return false;
//         });

//     //取消队友分金币
//     Haker.LoadHook("0x0859A918", ["pointer", "int"],
//         function(args) {
//             return null;
//         },
//         function(args) {
//             return 1;
//         });


//     //SS免确认
//     Sq_WriteByteArr(S_Ptr("0x085A56D0"), [9]);
//     Haker.LoadHook("0x08150f18", ["pointer", "int"],
//         function(args) {
//             return null;
//         },
//         function(args) {
//             return 0;
//         });


//     Sq_WriteByteArr(S_Ptr("0x085A41D1"), [0xB8, 0x00, 0x00, 0x00, 0x00, 0x90]);
// }, 1)




Timer.SetTimeOut(function () 
{

}, 1);

