This commit is contained in:
2022-02-13 19:54:59 +08:00
parent e30f6a5a26
commit feb4773c65
4 changed files with 68 additions and 10 deletions

View File

@@ -251,7 +251,7 @@ void RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v)
if (!v)
v = GetSqVm();
SQPushRootTable(v);
RealSqPushString(v, funcName, -1);
SQPushString(v, funcName, -1);
RealSqNewClosure(v, funcAddr, 0);
SQNewSlot(v, -3, false);
SQPopTop(v);
@@ -464,6 +464,48 @@ static SQInteger GivePlayerEqu(HSQUIRRELVM v)
return 1;
}
//去副本
static int GoDungeon(uint32_t v)
{
int n1 = 0;
int n2 = 0;
int n3 = 0;
int n4 = 0;
int num;
num = SQGetTop(v);
if (num == 2)
{
SQGetInt(v, 2, &n1);
}
else if (num == 5)
{
SQGetInt(v, 2, &n1);
SQGetInt(v, 3, &n2);
SQGetInt(v, 4, &n3);
SQGetInt(v, 5, &n4);
}
else
{
SQPushBool(v, false);
return 1;
}
_SendpacksType(*_SendClass, 0, 15);
_SendPacks();
_SendpacksType(*_SendClass, 0, 16);
_SendPacksWord(*_SendClass, 0, n1);
_SendPacksByte(*_SendClass, 0, n2);
_SendPacksByte(*_SendClass, 0, n3);
_SendPacksByte(*_SendClass, 0, n4);
_SendPacks();
SQPushBool(v, true);
return 1;
}
void RegisterNut()
{
RegisterNutApi(L"L_sq_Test", sq_Test);
@@ -480,6 +522,7 @@ void RegisterNut()
RegisterNutApi(L"L_sq_SendPack", SendPack);
RegisterNutApi(L"L_sq_GivePlayerItem", GivePlayerItem);
RegisterNutApi(L"L_sq_GivePlayerEqu", GivePlayerEqu);
RegisterNutApi(L"L_sq_GoDungeon", GoDungeon);
}