This commit is contained in:
Yosin-Lenheart
2022-02-13 10:09:55 +08:00
parent b67d7b8414
commit e30f6a5a26
3 changed files with 86 additions and 20 deletions

View File

@@ -257,6 +257,13 @@ void RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v)
SQPopTop(v);
}
//Test
static SQInteger sq_Test(uint32_t v)
{
//sq_pushinteger(v, n1);
return 0;
}
//读人物 或 装备属性
static SQInteger GetCharacterAttribute(HSQUIRRELVM v)
{
@@ -401,8 +408,65 @@ static SQInteger SendPack(HSQUIRRELVM v)
return 1;
}
//发物品给玩家
static SQInteger GivePlayerItem(HSQUIRRELVM v)
{
SQInteger n1,n2;
sq_getinteger(v, 2, &n1);
sq_getinteger(v, 3, &n2);
if (n1>0 && n2>0)
{
_SendpacksType(*_SendClass, 0, 65);
_SendPacksDWord(*_SendClass, 0, 1);
_SendPacksDWord(*_SendClass, 0, n1);
_SendPacksDWord(*_SendClass, 0, n2);
_SendPacks();
sq_pushinteger(v, 1);
}
if (!n1 || !n2)
{
sq_pushinteger(v, 0);
}
return 1;
}
//发装备给玩家
static SQInteger GivePlayerEqu(HSQUIRRELVM v)
{
SQInteger n1, n2;
sq_getinteger(v, 2, &n1);
sq_getinteger(v, 3, &n2);
if (n1 > 0 && n2 > 0)
{
_SendpacksType(*_SendClass, 0, 65);
_SendPacksDWord(*_SendClass, 0, 2);
_SendPacksDWord(*_SendClass, 0, n1);
_SendPacksDWord(*_SendClass, 0, n2);
_SendPacks();
sq_pushinteger(v, 1);
}
if (!n1 || !n2)
{
sq_pushinteger(v, 0);
}
return 1;
}
void RegisterNut()
{
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);
@@ -414,6 +478,8 @@ void RegisterNut()
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);
}