diff --git a/test/squirrel.cpp b/test/squirrel.cpp index d9eec39..713233c 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -739,7 +739,6 @@ static int Set_STL(uint32_t v) return 1; } - //new 类型容器 static int New_STL(uint32_t v) { @@ -797,6 +796,38 @@ static int New_STL(uint32_t v) return 1; } +//时间容器 +int squirrel::Timer_STL(uint32_t v) +{ + char* Name; + int Type; + int ParameterNum = SQGetTop(v); + if (ParameterNum == 3) + { + //获取容器名字 + SQGetStringc(v, 2, &Name); + //获取容器类型 + SQGetInt(v, 3, &Type); + if (STL::Check_STL(Name, Type) != 0) + { + SQPushBool(v, false); + return 1; + } + switch (Type) + { + case 0: + Int_STL[Name] = 0;//单Int容器 + break; + } + SQPushBool(v, true); + } + else + { + SQPushBool(v, false); + } + return 1; +} + //同步 龙盒数据包 static int Sync_Dragon_Pack(uint32_t v) { @@ -936,35 +967,35 @@ void squirrel::RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t void squirrel::R_Register_Nut() { RegisterNutApi(L"L_sq_Test", sq_Test); - RegisterNutApi(L"L_sq_GetCharacterAttribute", GetCharacterAttribute); - RegisterNutApi(L"L_sq_SetCharacterAttribute", SetCharacterAttribute); - RegisterNutApi(L"L_sq_GetTownIndex", GetTownIndex); - RegisterNutApi(L"L_sq_GetRegionIndex", GetRegionIndex); - RegisterNutApi(L"L_sq_GetTownXpos", GetTownXpos); - RegisterNutApi(L"L_sq_GetTownYpos", GetTownYpos); - RegisterNutApi(L"L_sq_GetFatigue", GetFatigue); - RegisterNutApi(L"L_sq_GetExp", GetExp); + RegisterNutApi(L"L_sq_GetCharacterAttribute", GetCharacterAttribute);//获取人物或装备属性 + RegisterNutApi(L"L_sq_SetCharacterAttribute", SetCharacterAttribute);//设置人物或装备属性 + RegisterNutApi(L"L_sq_GetTownIndex", GetTownIndex);//获取城镇编号 + RegisterNutApi(L"L_sq_GetRegionIndex", GetRegionIndex);//获取区域编号 + RegisterNutApi(L"L_sq_GetTownXpos", GetTownXpos);//获取城镇X坐标 + RegisterNutApi(L"L_sq_GetTownYpos", GetTownYpos);//获取城镇Y坐标 + RegisterNutApi(L"L_sq_GetFatigue", GetFatigue);//获取疲劳值 + RegisterNutApi(L"L_sq_GetExp", GetExp);//获取经验值 - RegisterNutApi(L"L_sq_SendPackType", SendPackType); - RegisterNutApi(L"L_sq_SendPackByte", SendPackByte); - RegisterNutApi(L"L_sq_SendPackWord", SendPackWord); - RegisterNutApi(L"L_sq_SendPackDWord", SendPackDWord); - RegisterNutApi(L"L_sq_SendPack", SendPack); - RegisterNutApi(L"L_sq_GivePlayerItem", GivePlayerItem); - RegisterNutApi(L"L_sq_GivePlayerEqu", GivePlayerEqu); - RegisterNutApi(L"L_sq_GoDungeon", GoDungeon); - RegisterNutApi(L"L_sq_GoTown", GoTown); - RegisterNutApi(L"L_sq_Dofile", LDofile); - RegisterNutApi(L"L_cout", Lcout); - RegisterNutApi(L"L_NewWindows", NewWindows); - RegisterNutApi(L"L_SetSlot", SetSlot); + RegisterNutApi(L"L_sq_SendPackType", SendPackType);//发包类型 + RegisterNutApi(L"L_sq_SendPackByte", SendPackByte);//包数据Byte + RegisterNutApi(L"L_sq_SendPackWord", SendPackWord);//包数据Word + RegisterNutApi(L"L_sq_SendPackDWord", SendPackDWord);//包数据DWord + RegisterNutApi(L"L_sq_SendPack", SendPack);//发包 + RegisterNutApi(L"L_sq_GivePlayerItem", GivePlayerItem);//给用户物品 + RegisterNutApi(L"L_sq_GivePlayerEqu", GivePlayerEqu);//给用户装备 + RegisterNutApi(L"L_sq_GoDungeon", GoDungeon);//去副本 + RegisterNutApi(L"L_sq_GoTown", GoTown);//去城镇 + RegisterNutApi(L"L_sq_Dofile", LDofile);//加密读取 + RegisterNutApi(L"L_cout", Lcout);//输出公告 + RegisterNutApi(L"L_NewWindows", NewWindows);//创建窗口 + RegisterNutApi(L"L_SetSlot", SetSlot);//设置槽坐标 - RegisterNutApi(L"L_New_STL", New_STL); - RegisterNutApi(L"L_Set_STL", Set_STL); - RegisterNutApi(L"L_Get_STL", Get_STL); - + RegisterNutApi(L"L_New_STL", New_STL);//新建容器 + RegisterNutApi(L"L_Set_STL", Set_STL);//设置容器 + RegisterNutApi(L"L_Get_STL", Get_STL);//获取容器 + RegisterNutApi(L"L_Timer_STL", Timer_STL);//获取容器 RegisterNutApi(L"L_Get_DragonModel", Get_DragonModel);//获取龙盒模式 RegisterNutApi(L"L_Set_DragonModel", Set_DragonModel);//设置龙盒模式 diff --git a/test/squirrel.h b/test/squirrel.h index 7552354..9a41f5c 100644 --- a/test/squirrel.h +++ b/test/squirrel.h @@ -145,6 +145,9 @@ public: static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool printerror); +public://容器类接口 + static int Timer_STL(uint32_t v);//时间容器 + public: //新增nut接口funcName绑定C语言函数funcAddr