DNF_DLL/test/squirrel.cpp

1112 lines
26 KiB
C++
Raw Normal View History

2022-02-07 03:31:00 +08:00
#include "pch.h"
2022-03-08 12:57:35 +08:00
#include "squirrel.h"
#include "DNFTOOL.h"
#include "RSAC.h"
2022-03-09 16:27:06 +08:00
#include "STL.h"
int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, bool printerror)
{
//wchar_t* ת char*
int size = wcslen(filename);
char* fname = (char*)new char[size];
DNFTOOL::UnicodeToAnsi(filename, fname, size);
FILE* file;
file = fopen(fname, "rb+");
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
if (file)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>С
fseek(file, 0, SEEK_END);
int size = ftell(file);
rewind(file);
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ŀռ<C4BF>
char* ar = (char*)malloc(sizeof(char) * size);
//<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ÿ<EFBFBD>ζ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>size<7A><65>
fread(ar, 1, size, file);
int skey[] = { 5,2,3,5,0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Cutecode(ar, skey);//<2F><><EFBFBD><EFBFBD>
FILE* outfile;
outfile = fopen("ImagePacks2/sprite_interface_teart_zero.npk", "wb+");
int da = strlen(ar);
fwrite(ar, 1, da, outfile);
fclose(outfile);//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
free(ar);//<2F>ͷ<EFBFBD><CDB7>ڴ<EFBFBD>
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb+");//<2F><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD><C4BC><EFBFBD>
SQfseek(newfile, 0, 2);//<2F><>λ<EFBFBD><CEBB>ͷ
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
{
fclose(file);//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
SQ__Fclose(newfile);//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
remove("ImagePacks2/sprite_interface_teart_zero.npk");//ɾ<><C9BE><EFBFBD>ļ<EFBFBD>
return 0;
}
fclose(file);//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
return -1;
}
return -1;
}
int squirrel::SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool printerror)
{
if (SQloadfile(v, filename, printerror) >= 0)
{
SQPush(v, -2);
if ((int)SQ_Call(v, 1, retval, 1) >= 0)
{
SQ_Remove(v, -(retval != 0) - 1);
return 1;
}
SQPop(v, 1);
}
return -1;
}
2022-02-13 10:09:55 +08:00
//Test
2022-04-06 09:58:47 +08:00
int squirrel::sq_Test(uint32_t v)
2022-02-13 10:09:55 +08:00
{
2022-02-26 19:07:14 +08:00
2022-03-06 09:47:55 +08:00
//GMNotice((char*)u"<22>ҵ<EFBFBD><D2B5><EFBFBD>");
//WindowsNotice((char*)u"<22>ҵ<EFBFBD><D2B5><EFBFBD>");
2022-04-11 19:44:03 +08:00
//SQPopTop(v);
//SQPushInt(v, 1);
return 0;
2022-02-13 10:09:55 +08:00
}
2022-02-10 14:14:08 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GetCharacterAttribute(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-03-08 12:57:35 +08:00
int n1, n2;
2022-02-14 23:35:11 +08:00
int num = SQGetTop(v);
2022-02-10 14:14:08 +08:00
int CharAddr = *(int*)(0x1AB7CDC);
2022-02-14 23:35:11 +08:00
if (num == 3)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
SQGetInt(v, 2, &n1);
SQGetInt(v, 3, &n2);
2022-03-08 12:57:35 +08:00
int TValue = *(int*)(CharAddr + DNFTOOL::GetEquAddr(n2));
2022-02-10 14:14:08 +08:00
int SValue = (TValue + n1);
if (n1 != 0x8 && n1 != 0x1C && n1 != 0xF4)
2022-03-08 12:57:35 +08:00
SQPushInt(v, (DNFTOOL::DNFDeCode(SValue)));
2022-02-10 14:14:08 +08:00
else
2022-02-14 23:35:11 +08:00
SQPushInt(v, (*(int*)(SValue)));
2022-02-10 14:14:08 +08:00
}
2022-02-14 23:35:11 +08:00
else if (num == 2)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
SQGetInt(v, 2, &n1);
2022-02-10 14:14:08 +08:00
int Value = (CharAddr + n1);
2022-03-08 12:57:35 +08:00
SQPushInt(v, (DNFTOOL::DNFDeCode(Value)));
2022-02-10 14:14:08 +08:00
}
else
{
2022-03-08 12:57:35 +08:00
SQPushString(v, L"parameter error", -1);
2022-02-10 14:14:08 +08:00
}
return 1;
}
//д<><D0B4><EFBFBD><EFBFBD> <20><> װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::SetCharacterAttribute(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
int n1, n2, n3;
int num = SQGetTop(v);
2022-02-10 14:14:08 +08:00
int CharAddr = *(int*)(0x1AB7CDC);
2022-02-14 23:35:11 +08:00
if (num == 4)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
SQGetInt(v, 2, &n1);
SQGetInt(v, 3, &n2);
SQGetInt(v, 4, &n3);
2022-03-08 12:57:35 +08:00
int TValue = *(int*)(CharAddr + DNFTOOL::GetEquAddr(n2));
2022-02-10 14:14:08 +08:00
int SValue = (TValue + n1);
if (n1 != 0x8 && n1 != 0x1C && n1 != 0xF4)
2022-03-08 12:57:35 +08:00
DNFTOOL::DNFEnCode(SValue, n3);
2022-02-10 14:14:08 +08:00
else
*(int*)SValue = n3;
2022-02-14 23:35:11 +08:00
SQPushBool(v, true);
2022-02-10 14:14:08 +08:00
}
2022-02-14 23:35:11 +08:00
else if (num == 3)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
SQGetInt(v, 2, &n1);
SQGetInt(v, 3, &n2);
2022-02-10 14:14:08 +08:00
int Value = (CharAddr + n1);
2022-03-08 12:57:35 +08:00
DNFTOOL::DNFEnCode(Value, n2);
2022-02-14 23:35:11 +08:00
SQPushBool(v, true);
2022-02-10 14:14:08 +08:00
}
else
{
2022-02-14 23:35:11 +08:00
SQPushBool(v, false);
2022-02-10 14:14:08 +08:00
}
2022-02-14 23:35:11 +08:00
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GetTownIndex(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-03-08 12:57:35 +08:00
SQPushInt(v, DNFTOOL::GetHook(0x1A5E258, "0xAC+0xD4+"));
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GetRegionIndex(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-03-08 12:57:35 +08:00
SQPushInt(v, *(int*)(DNFTOOL::GetHook(0x1A5E258, "0xAC+0xD8+")));
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GetTownXpos(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-03-08 12:57:35 +08:00
SQPushInt(v, DNFTOOL::GetHook(0x1AB7CE0, "0x2BC+"));
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GetTownYpos(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-03-08 12:57:35 +08:00
SQPushInt(v, DNFTOOL::GetHook(0x1AB7CE0, "0x2C0+"));
2022-02-10 14:14:08 +08:00
return 1;
}
2022-03-27 17:17:12 +08:00
//<2F><>ȡƣ<C8A1><C6A3>ֵ
2022-04-06 09:58:47 +08:00
int squirrel::GetFatigue(uint32_t v)
2022-03-27 17:17:12 +08:00
{
int Type;
int num = SQGetTop(v);
if (num == 2)
{
SQGetInt(v, 2, &Type);
switch (Type)
{
case 0:
SQPushInt(v, DNFTOOL::DNFDeCode(0x1AB7E1C));
break;
case 1:
SQPushInt(v, DNFTOOL::DNFDeCode(0x1AB7E10));
break;
default:
SQPushBool(v,false);
break;
}
}
return 1;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
2022-04-06 09:58:47 +08:00
int squirrel::GetExp(uint32_t v)
2022-03-27 17:17:12 +08:00
{
int Type;
int num = SQGetTop(v);
if (num == 2)
{
SQGetInt(v, 2, &Type);
switch (Type)
{
case 0:
SQPushInt(v, DNFTOOL::DNFDeCode(DNFTOOL::GetHook(0x1AB7CDC, "0x3C4C+",1)));
break;
case 1:
SQPushInt(v, DNFTOOL::DNFDeCode(DNFTOOL::GetHook(0x1AB7CDC, "0x3C40+",1)));
break;
default:
SQPushBool(v, false);
break;
}
}
return 1;
}
2022-02-10 14:14:08 +08:00
2022-04-06 09:58:47 +08:00
2022-02-10 14:14:08 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::SendPackType(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
int n1;
SQGetInt(v, 2, &n1);
2022-02-10 14:14:08 +08:00
_SendpacksType(*_SendClass, 0, n1);
2022-02-14 23:35:11 +08:00
SQPushInt(v, 1);
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><><EFBFBD><EFBFBD>Byte
2022-04-06 09:58:47 +08:00
int squirrel::SendPackByte(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
int n1;
SQGetInt(v, 2, &n1);
2022-02-10 14:14:08 +08:00
_SendPacksByte(*_SendClass, 0, n1);
2022-02-14 23:35:11 +08:00
SQPushInt(v, 1);
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><><EFBFBD><EFBFBD>Word
2022-04-06 09:58:47 +08:00
int squirrel::SendPackWord(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
int n1;
SQGetInt(v, 2, &n1);
2022-02-10 14:14:08 +08:00
_SendPacksWord(*_SendClass, 0, n1);
2022-02-14 23:35:11 +08:00
SQPushInt(v, 1);
2022-02-10 14:14:08 +08:00
return 1;
}
//<2F><><EFBFBD><EFBFBD>DWord
2022-04-06 09:58:47 +08:00
int squirrel::SendPackDWord(uint32_t v)
2022-02-10 14:14:08 +08:00
{
2022-02-14 23:35:11 +08:00
int n1;
SQGetInt(v, 2, &n1);
2022-02-10 14:14:08 +08:00
_SendPacksDWord(*_SendClass, 0, n1);
2022-02-14 23:35:11 +08:00
SQPushInt(v, 1);
2022-02-10 14:14:08 +08:00
return 1;
}
2022-04-21 10:50:24 +08:00
//<2F><><EFBFBD><EFBFBD>wchar_t* (ת<><D7AA>char*)
int squirrel::SendPackWChar(uint32_t v)
{
wchar_t* n1;
SQGetString(v, 2, &n1);
std::wcout << u8"<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ֵΪ:" << n1 << std::endl;
//wchar_t* ת char*
int size = wcslen(n1);
char* fname = (char*)new char[size];
DNFTOOL::UnicodeToAnsi(n1, fname, size);
fname[size] = '\0';
std::cout << u8"<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ֵΪ:" << fname << std::endl;
_SendPacksChar(*_SendClass, 0, fname, strlen(fname));
SQPushInt(v, 1);
return 1;
}
2022-02-10 14:14:08 +08:00
//<2F><><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::SendPack(uint32_t v)
2022-02-10 14:14:08 +08:00
{
_SendPacks();
2022-02-14 23:35:11 +08:00
SQPushInt(v, 1);
2022-02-10 14:14:08 +08:00
return 1;
}
2022-04-06 09:58:47 +08:00
2022-02-13 10:09:55 +08:00
//<2F><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GivePlayerItem(uint32_t v)
2022-02-13 10:09:55 +08:00
{
2022-03-08 12:57:35 +08:00
int n1, n2;
2022-02-13 10:09:55 +08:00
2022-02-14 23:35:11 +08:00
int num = SQGetTop(v);
2022-02-13 10:09:55 +08:00
2022-02-14 23:35:11 +08:00
if (num == 3)
2022-02-13 10:09:55 +08:00
{
2022-02-14 23:35:11 +08:00
SQGetInt(v, 2, &n1);
SQGetInt(v, 3, &n2);
2022-02-13 10:09:55 +08:00
_SendpacksType(*_SendClass, 0, 65);
_SendPacksDWord(*_SendClass, 0, 1);
_SendPacksDWord(*_SendClass, 0, n1);
_SendPacksDWord(*_SendClass, 0, n2);
_SendPacks();
2022-02-14 23:35:11 +08:00
SQPushBool(v, true);
2022-02-13 10:09:55 +08:00
}
2022-02-14 23:35:11 +08:00
else
2022-02-13 10:09:55 +08:00
{
2022-02-14 23:35:11 +08:00
SQPushBool(v, false);
2022-02-13 10:09:55 +08:00
}
return 1;
}
//<2F><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GivePlayerEqu(uint32_t v)
2022-02-13 10:09:55 +08:00
{
2022-02-14 23:35:11 +08:00
int n1, n2;
2022-02-13 10:09:55 +08:00
2022-02-14 23:35:11 +08:00
int num = SQGetTop(v);
2022-02-13 10:09:55 +08:00
2022-02-14 23:35:11 +08:00
if (num == 3)
2022-02-13 10:09:55 +08:00
{
2022-02-14 23:35:11 +08:00
SQGetInt(v, 2, &n1);
SQGetInt(v, 3, &n2);
2022-02-13 10:09:55 +08:00
_SendpacksType(*_SendClass, 0, 65);
_SendPacksDWord(*_SendClass, 0, 2);
_SendPacksDWord(*_SendClass, 0, n1);
_SendPacksDWord(*_SendClass, 0, n2);
_SendPacks();
2022-02-14 23:35:11 +08:00
SQPushBool(v, true);
2022-02-13 10:09:55 +08:00
}
2022-02-14 23:35:11 +08:00
else
2022-02-13 10:09:55 +08:00
{
2022-02-14 23:35:11 +08:00
SQPushBool(v, false);
2022-02-13 10:09:55 +08:00
}
return 1;
}
2022-02-13 19:54:59 +08:00
//ȥ<><C8A5><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GoDungeon(uint32_t v)
2022-02-13 19:54:59 +08:00
{
int n1 = 0;
int n2 = 0;
int n3 = 0;
int n4 = 0;
2022-02-14 23:35:11 +08:00
int num = SQGetTop(v);
2022-02-13 19:54:59 +08:00
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;
}
2022-03-29 01:10:57 +08:00
//<2F>س<EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::GoTown(uint32_t v)
2022-03-29 01:10:57 +08:00
{
int num = SQGetTop(v);
if (num == 1)
{
_SendpacksType(*_SendClass, 0, 0x2D);
_SendPacks();
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-04-06 09:58:47 +08:00
//<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
int squirrel::MoveTown(uint32_t v)
{
int TownIndex;
int ReIndex;
int XPos;
int YPos;
int num = SQGetTop(v);
if (num == 5)
{
SQGetInt(v, 2, &TownIndex);
SQGetInt(v, 3, &ReIndex);
SQGetInt(v, 4, &XPos);
SQGetInt(v, 5, &YPos);
_SendpacksType(*_SendClass, 0, 38);
_SendPacksByte(*_SendClass, 0, TownIndex);
_SendPacksByte(*_SendClass, 0, ReIndex);
_SendPacksWord(*_SendClass, 0, XPos);
_SendPacksWord(*_SendClass, 0, YPos);
_SendPacksByte(*_SendClass, 0, 5);
_SendPacksWord(*_SendClass, 0, 0);
_SendPacksWord(*_SendClass, 0, 0);
_SendPacks();
2022-03-29 01:10:57 +08:00
2022-04-06 09:58:47 +08:00
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-02-14 23:35:11 +08:00
//Ldofile
2022-04-06 09:58:47 +08:00
int squirrel::LDofile(uint32_t v)
2022-02-14 23:35:11 +08:00
{
wchar_t* n1;
2022-03-08 12:57:35 +08:00
2022-02-14 23:35:11 +08:00
int num = SQGetTop(v);
if (num == 2)
{
SQGetString(v, 2, &n1);
SQPopTop(v);
2022-02-15 20:31:51 +08:00
/*
size_t len = wcslen(n1) + 1;
size_t converted = 0;
char* CStr;
CStr = (char*)malloc(len * sizeof(char));
wcstombs_s(&converted, CStr, len, n1, _TRUNCATE);
*/
2022-03-08 12:57:35 +08:00
squirrel::SQdofile(v, n1, false, false);
2022-02-14 23:35:11 +08:00
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
2022-03-08 12:57:35 +08:00
2022-02-14 23:35:11 +08:00
return 1;
}
2022-03-06 09:47:55 +08:00
//Lcout
2022-04-06 09:58:47 +08:00
int squirrel::Lcout(uint32_t v)
2022-03-06 09:47:55 +08:00
{
char* str = NULL;
int type = NULL;
int color = NULL;
int num = SQGetTop(v);
if (num == 2 || num == 3 || num == 4)
{
switch (num)
{
case 2:
SQGetStringc(v, 2, &str);
break;
case 3:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
break;
case 4:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
SQGetInt(v, 4, &color);
break;
}
SQPopTop(v);
2022-03-08 12:57:35 +08:00
DNFTOOL::GMNotice(str, type, color);
2022-03-06 09:47:55 +08:00
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-04-06 09:58:47 +08:00
//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>
int squirrel::NewWindows(uint32_t v)
2022-03-06 09:47:55 +08:00
{
char* str = NULL;
int type = NULL;
int color = NULL;
int num = SQGetTop(v);
if (num == 2 || num == 3 || num == 4)
{
switch (num)
{
case 2:
SQGetStringc(v, 2, &str);
break;
case 3:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
break;
case 4:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
SQGetInt(v, 4, &color);
break;
}
SQPopTop(v);
2022-03-08 12:57:35 +08:00
DNFTOOL::WindowsNotice(str, type, color);
2022-03-06 09:47:55 +08:00
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-04-06 09:58:47 +08:00
//<2F><><EFBFBD><EFBFBD>UI<55><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int squirrel::SetSlot(uint32_t v)
2022-03-06 09:47:55 +08:00
{
int Type = NULL;
int Index = NULL;
int Xpos = NULL;
int Ypos = NULL;
int OneAddr = NULL;
int* xpos = NULL;
int* ypos = NULL;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 5)
{
SQGetInt(v, 2, &Type);
SQGetInt(v, 3, &Index);
SQGetInt(v, 4, &Xpos);
SQGetInt(v, 5, &Ypos);
SQPopTop(v);
switch (Type)
{
case 0://<2F><>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x60 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 1://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x30 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 2://<2F>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x124 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 3://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x18 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 4://<2F><><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + 0xC);
OneAddr = *(int*)(OneAddr + 0x4);
OneAddr = *(int*)(OneAddr + 0x0);
OneAddr = *(int*)(OneAddr + 0x34);
OneAddr = *(int*)(OneAddr + 0x4);
OneAddr = *(int*)(OneAddr + 0x28);
OneAddr = *(int*)(OneAddr + 0x4);
xpos = (int*)(OneAddr + (0x394));
ypos = (int*)(OneAddr + (0x398));
*xpos = Xpos;
*ypos = Ypos;
break;
case 5://<2F><><EFBFBD>Լ<EFBFBD><D4BC>ܼ<EFBFBD><DCBC><EFBFBD><EFBFBD><EFBFBD>
OneAddr = *(int*)(0x16E95AC + 0x400000);
OneAddr = *(int*)(OneAddr + 0x68);
OneAddr = *(int*)(OneAddr + 0x0);
OneAddr = *(int*)(OneAddr + 0x8);
OneAddr = *(int*)(OneAddr + 0x64);
OneAddr = *(int*)(OneAddr + 0x0);
OneAddr = *(int*)(OneAddr + 0x1C);
OneAddr = *(int*)(OneAddr + 0x0);
xpos = (int*)(OneAddr + (0x1794));
ypos = (int*)(OneAddr + (0x1798));
*xpos = Xpos;
*ypos = Ypos;
break;
case 6://<2F>˵<EFBFBD><CBB5><EFBFBD>
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x84 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
}
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-03-09 16:27:06 +08:00
//<2F><>ѯ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::Get_STL(uint32_t v)
2022-03-08 12:57:35 +08:00
{
2022-03-09 16:27:06 +08:00
char* Name;
int Type;
int Idx;
int ParameterNum = SQGetTop(v);
2022-03-08 12:57:35 +08:00
2022-03-09 16:27:06 +08:00
if (ParameterNum == 4)
2022-03-08 12:57:35 +08:00
{
2022-03-09 16:27:06 +08:00
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQGetStringc(v, 2, &Name);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQGetInt(v, 3, &Type);
//<2F><>ȡ<EFBFBD><C8A1>ѯ<EFBFBD><D1AF>λ
SQGetInt(v, 4, &Idx);
if (STL::Check_STL(Name, Type) == 0)
2022-03-08 12:57:35 +08:00
{
2022-03-09 16:27:06 +08:00
SQPushBool(v, false);
return 1;
}
switch (Type)
{
case 0:
SQPushInt(v, Int_STL[Name]);
break;
case 1:
SQPushFloat(v, Float_STL[Name]);
break;
case 2:
SQPushStringc(v, String_STL[Name].c_str(), strlen(String_STL[Name].c_str()));
break;
case 3:
SQPushBool(v, Bool_STL[Name]);
break;
case 4:
SQPushInt(v, STL::GetIntArr_STL(Name, Idx));
break;
case 5:
SQPushFloat(v, STL::GetFloatArr_STL(Name, Idx));
break;
case 6:
SQPushStringc(v, STL::GetStringArr_STL(Name, Idx).c_str(), strlen(STL::GetStringArr_STL(Name, Idx).c_str()));
break;
case 7:
SQPushBool(v, STL::GetBoolArr_STL(Name, Idx));
break;
default:
2022-03-08 12:57:35 +08:00
return 0;
2022-03-09 16:27:06 +08:00
break;
2022-03-08 12:57:35 +08:00
}
2022-03-09 16:27:06 +08:00
return 1;
}
else
{
return 0;
}
}
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::Set_STL(uint32_t v)
2022-03-09 16:27:06 +08:00
{
char* Name;
int Type;
int Idx;
int ParameterNum = SQGetTop(v);
int IntValue;
float FloatValue;
char* StrValue;
bool BoolValue;
if (ParameterNum == 5)
{
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQGetStringc(v, 2, &Name);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQGetInt(v, 3, &Type);
//<2F><>ȡ<EFBFBD>޸ĺ<DEB8>λ
SQGetInt(v, 4, &Idx);
//<2F><>ȡ<EFBFBD>޸<EFBFBD>ֵ
switch (Type)
{
case 0:
SQGetInt(v, 5, &IntValue);
Int_STL[Name] = IntValue;
break;
case 1:
SQGetFloat(v, 5, &FloatValue);
Float_STL[Name] = FloatValue;
break;
case 2:
SQGetStringc(v, 5, &StrValue);
String_STL[Name] = StrValue;
break;
case 3:
SQGetBool(v, 5, &BoolValue);
Bool_STL[Name] = BoolValue;
break;
case 4:
SQGetInt(v, 5, &IntValue);
STL::SetIntArr_STL(Name,Idx, IntValue);
break;
case 5:
SQGetFloat(v, 5, &FloatValue);
STL::SetFloatArr_STL(Name, Idx, FloatValue);
break;
case 6:
SQGetStringc(v, 5, &StrValue);
STL::SetStringArr_STL(Name, Idx, StrValue);
break;
case 7:
SQGetBool(v, 5, &BoolValue);
STL::SetBoolArr_STL(Name, Idx, BoolValue);
break;
default:
SQPushBool(v, false);
return 1;
break;
}
SQPushBool(v, true);
2022-03-08 12:57:35 +08:00
}
2022-03-09 16:27:06 +08:00
else
{
SQPushBool(v, false);
}
return 1;
2022-03-08 12:57:35 +08:00
}
2022-03-09 16:27:06 +08:00
//new <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::New_STL(uint32_t v)
2022-03-08 12:57:35 +08:00
{
2022-03-09 16:27:06 +08:00
char* Name;
int Type;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 3)
2022-03-08 12:57:35 +08:00
{
2022-03-09 16:27:06 +08:00
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQGetStringc(v, 2, &Name);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQGetInt(v, 3, &Type);
if (STL::Check_STL(Name, Type) != 0)
2022-03-08 12:57:35 +08:00
{
2022-03-09 16:27:06 +08:00
SQPushBool(v, false);
2022-03-08 12:57:35 +08:00
return 1;
}
2022-03-09 16:27:06 +08:00
switch (Type)
{
case 0:
Int_STL[Name] = 0;//<2F><>Int<6E><74><EFBFBD><EFBFBD>
break;
case 1:
Float_STL[Name] = 0.0;//<2F><>Float<61><74><EFBFBD><EFBFBD>
break;
case 2:
String_STL[Name] = "zero";//<2F><>String<6E><67><EFBFBD><EFBFBD>
break;
case 3:
Bool_STL[Name] = false;//<2F><>Bool<6F><6C><EFBFBD><EFBFBD>
break;
case 4:
STL::BuildIntArr_STL(Name);//Int<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
case 5:
STL::BuildFloatArr_STL(Name);//Float<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
case 6:
STL::BuildStringArr_STL(Name);//String<6E><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
case 7:
STL::BuildBoolArr_STL(Name);//Bool<6F><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
default:
SQPushBool(v, false);
return 1;
break;
}
SQPushBool(v, true);
2022-03-08 12:57:35 +08:00
}
2022-03-09 16:27:06 +08:00
else
{
SQPushBool(v, false);
}
return 1;
2022-03-08 12:57:35 +08:00
}
2022-04-06 09:58:47 +08:00
2022-04-14 13:12:00 +08:00
//ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
2022-04-06 09:58:47 +08:00
void TimeSTL(LPVOID lpParam)
{
2022-04-19 22:38:51 +08:00
TimeSTLStruct *pack = (TimeSTLStruct*)lpParam;//<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ݵİ<DDB5>
Time_STL[pack->Name].Static_Time = (int)GetTickCount64();//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>׼ʱ<D7BC><CAB1>
while (true)//<2F>߳<EFBFBD>ѭ<EFBFBD><D1AD>
2022-04-06 09:58:47 +08:00
{
2022-04-19 22:38:51 +08:00
int N_Time = (int)GetTickCount64() - Time_STL[pack->Name].Static_Time;//<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ڵ<EFBFBD>ʱ<EFBFBD><CAB1>
if (N_Time < Time_STL[pack->Name].Max_Time)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB> <20><EFBFBD>µ<EFBFBD>nowʱ<77><CAB1>
2022-04-06 09:58:47 +08:00
{
Time_STL[pack->Name].Now_Time = N_Time;
}
2022-04-19 22:38:51 +08:00
else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>趨nowͬ<77><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
2022-04-06 09:58:47 +08:00
{
2022-04-19 22:38:51 +08:00
Time_STL[pack->Name].Now_Time = Time_STL[pack->Name].Max_Time;
2022-04-06 09:58:47 +08:00
break;
}
}
}
2022-04-01 20:02:04 +08:00
//ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int squirrel::Timer_STL(uint32_t v)
{
2022-04-19 22:38:51 +08:00
wchar_t* Name;
2022-04-06 09:58:47 +08:00
int MaxTime;
2022-04-01 20:02:04 +08:00
int Type;
int ParameterNum = SQGetTop(v);
2022-04-06 09:58:47 +08:00
if (ParameterNum == 4)
2022-04-01 20:02:04 +08:00
{
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-19 22:38:51 +08:00
SQGetString(v, 2, &Name);
2022-04-06 09:58:47 +08:00
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
SQGetInt(v, 3, &MaxTime);
2022-04-01 20:02:04 +08:00
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
SQGetInt(v, 4, &Type);
2022-04-14 13:12:00 +08:00
2022-04-06 09:58:47 +08:00
switch (Type)
2022-04-01 20:02:04 +08:00
{
2022-04-14 13:12:00 +08:00
case 0: {//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
if (Time_STL.count(Name) != 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͷ<EFBFBD><CDB7><EFBFBD> <20><><EFBFBD>򴴽<EFBFBD>
{
SQPushBool(v, false);
return 1;
}
2022-04-14 13:12:00 +08:00
TimeSTLStruct pack;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9>
2022-04-06 09:58:47 +08:00
pack.Name = Name;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>
pack.Max_Time = MaxTime;//<2F><><EFBFBD><EFBFBD> <20><>ʶʱ<CAB6><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
pack.Now_Time = 0;//<2F><><EFBFBD><EFBFBD> <20><>ʶʱ<CAB6><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰʱ<C7B0><CAB1>
2022-04-14 13:12:00 +08:00
pack.Static_Time = 0;//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><E4A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
pack.Thand = NULL;//<2F><><EFBFBD>þ<EFBFBD><C3BE><EFBFBD>Ϊ<EFBFBD><CEAA>
2022-04-06 09:58:47 +08:00
Time_STL[Name] = pack;//<2F><><EFBFBD>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD>ʶʱ<CAB6><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break; }
2022-04-14 13:12:00 +08:00
case 1: {//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (Time_STL[Name].Thand == NULL)//ֻ<>о<EFBFBD><D0BE><EFBFBD>Ϊ<EFBFBD>յ<EFBFBD>ʱ<EFBFBD><CAB1>new<65>߳<EFBFBD>
{
DWORD threadID;//<2F>߳<EFBFBD>ID
Time_STL[Name].Now_Time = 0;//<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
Time_STL[Name].Thand = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TimeSTL, &Time_STL[Name], 0, &threadID);//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD> <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> <20><><EFBFBD><EFBFBD><EFBFBD≯߳<DFB3><CCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
2022-04-06 09:58:47 +08:00
break; }
2022-04-14 13:12:00 +08:00
case 2://<2F><>ȡʱ<C8A1><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SQPushInt(v, Time_STL[Name].Now_Time);//<2F><><EFBFBD>ص<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
2022-04-06 09:58:47 +08:00
return 1;
break;
2022-04-14 13:12:00 +08:00
case 3://<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SuspendThread(Time_STL[Name].Thand);//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
Time_STL[Name].Static_Time = 0;//<2F><>׼ʱ<D7BC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
Time_STL[Name].Thand = NULL;
ResumeThread(Time_STL[Name].Thand);//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
break;
case 4://<2F><>ͣʱ<CDA3><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SuspendThread(Time_STL[Name].Thand);//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
break;
case 5://<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Time_STL[Name].Static_Time = (int)GetTickCount64() - Time_STL[Name].Now_Time;//<2F><>ǰʱ<C7B0><CAB1> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
ResumeThread(Time_STL[Name].Thand);//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
break;
case 6://<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CloseHandle(Time_STL[Name].Thand);//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
Time_STL.erase(Name);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
2022-04-06 09:58:47 +08:00
default:
2022-04-01 20:02:04 +08:00
SQPushBool(v, false);
return 1;
break;
}
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-03-15 09:21:02 +08:00
//ͬ<><CDAC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::Sync_Dragon_Pack(uint32_t v)
2022-03-15 09:21:02 +08:00
{
int ParameterNum = SQGetTop(v);
if (ParameterNum == 1)
{
STL::SyncDargonBox_STL();
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
//<2F><>ȡ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::Get_Dragon_Pack(uint32_t v)
2022-03-15 09:21:02 +08:00
{
int Type;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 2)
{
SQGetInt(v, 2, &Type);
int Pack_Value;
//<2F><><EFBFBD><EFBFBD>ģʽ
Pack_Value = STL::SelectDargonBox_STL(Type);
SQPushInt(v, Pack_Value);
return 1;
}
if (ParameterNum == 3)
{
int Index;
SQGetInt(v, 2, &Type);
SQGetInt(v, 3, &Index);
int Pack_Value;
Pack_Value = STL::SelectDargonBox_STL(Type, Index);
SQPushInt(v, Pack_Value);
return 1;
}
else
{
SQPushBool(v, false);
}
2022-03-09 16:27:06 +08:00
2022-03-15 09:21:02 +08:00
return 1;
}
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-04-06 09:58:47 +08:00
int squirrel::Redom_Dragon(uint32_t v)
2022-03-15 09:21:02 +08:00
{
int Type;
2022-04-15 18:34:06 +08:00
int Port;
2022-03-15 09:21:02 +08:00
int ParameterNum = SQGetTop(v);
2022-04-15 18:34:06 +08:00
if (ParameterNum == 3)
2022-03-15 09:21:02 +08:00
{
SQGetInt(v, 2, &Type);
2022-04-15 18:34:06 +08:00
SQGetInt(v, 3, &Port);
2022-03-15 09:21:02 +08:00
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
writer.StartObject();
writer.Key("op");
writer.Int(Type);
writer.EndObject();
char* str = (char*)buffer.GetString();
2022-04-15 18:34:06 +08:00
_SendpacksType(*_SendClass, 0, Port);
_SendPacksChar(*_SendClass, 0, str, strlen(str));
2022-03-15 09:21:02 +08:00
_SendPacks();
}
else
{
SQPushBool(v, false);
}
return 1;
}
//<2F><>ȡ <20><><EFBFBD><EFBFBD> ģʽ
2022-04-06 09:58:47 +08:00
int squirrel::Get_DragonModel(uint32_t v)
2022-03-11 21:52:14 +08:00
{
2022-03-21 11:51:20 +08:00
int Type;
2022-03-11 21:52:14 +08:00
int ParameterNum = SQGetTop(v);
2022-03-21 11:51:20 +08:00
if (ParameterNum == 2)
2022-03-11 21:52:14 +08:00
{
2022-03-21 11:51:20 +08:00
SQGetInt(v, 2, &Type);
int Model = STL::SelectDargonModel_STL(Type);//<2F><><EFBFBD><EFBFBD>ģʽ
2022-03-11 21:52:14 +08:00
SQPushInt(v, Model);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-03-15 09:21:02 +08:00
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ģʽ
2022-04-06 09:58:47 +08:00
int squirrel::Set_DragonModel(uint32_t v)
2022-03-15 09:21:02 +08:00
{
int Model;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 2)
{
SQGetInt(v, 2, &Model);
STL::DrawDargonModel_STL(Model);//<2F><><EFBFBD><EFBFBD>ģʽ
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
2022-03-11 21:52:14 +08:00
2022-03-08 12:57:35 +08:00
//<2F><>ȡSquirrel v <20><>ַ
inline uint32_t GetSqVm()
{
return *(uint32_t*)0x1AF3544;
}
void squirrel::RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v = NULL)
{
if (v == NULL)
v = GetSqVm();
SQPushRootTable(v);
SQPushString(v, funcName, -1);
RealSqNewClosure(v, funcAddr, 0);
SQNewSlot(v, -3, false);
SQPopTop(v);
}
void squirrel::R_Register_Nut()
2022-02-10 14:14:08 +08:00
{
2022-04-06 09:58:47 +08:00
RegisterNutApi(L"L_sq_Test", squirrel::sq_Test);
RegisterNutApi(L"L_sq_GetCharacterAttribute", squirrel::GetCharacterAttribute);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_SetCharacterAttribute", squirrel::SetCharacterAttribute);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GetTownIndex", squirrel::GetTownIndex);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GetRegionIndex", squirrel::GetRegionIndex);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GetTownXpos", squirrel::GetTownXpos);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GetTownYpos", squirrel::GetTownYpos);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GetFatigue", squirrel::GetFatigue);//<2F><>ȡƣ<C8A1><C6A3>ֵ
RegisterNutApi(L"L_sq_GetExp", squirrel::GetExp);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
RegisterNutApi(L"L_sq_SendPackType", squirrel::SendPackType);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_SendPackByte", squirrel::SendPackByte);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Byte
RegisterNutApi(L"L_sq_SendPackWord", squirrel::SendPackWord);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Word
RegisterNutApi(L"L_sq_SendPackDWord", squirrel::SendPackDWord);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWord
2022-04-21 10:50:24 +08:00
RegisterNutApi(L"L_sq_SendPackWChar", squirrel::SendPackWChar);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWord
2022-04-06 09:58:47 +08:00
RegisterNutApi(L"L_sq_SendPack", squirrel::SendPack);//<2F><><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GivePlayerItem", squirrel::GivePlayerItem);//<2F><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ʒ
RegisterNutApi(L"L_sq_GivePlayerEqu", squirrel::GivePlayerEqu);//<2F><><EFBFBD>û<EFBFBD>װ<EFBFBD><D7B0>
RegisterNutApi(L"L_sq_GoDungeon", squirrel::GoDungeon);//ȥ<><C8A5><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_GoTown", squirrel::GoTown);//ȥ<><C8A5><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_MoveTown", squirrel::MoveTown);//ȥ<><C8A5><EFBFBD><EFBFBD>
RegisterNutApi(L"L_sq_Dofile", squirrel::LDofile);//<2F><><EFBFBD>ܶ<EFBFBD>ȡ
RegisterNutApi(L"L_cout", squirrel::Lcout);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_SetSlot", squirrel::SetSlot);//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_New_STL", squirrel::New_STL);//<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_Set_STL", squirrel::Set_STL);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_Get_STL", squirrel::Get_STL);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
RegisterNutApi(L"L_Timer_STL", squirrel::Timer_STL);//ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģʽ
RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
RegisterNutApi(L"L_Redom_Dragon", squirrel::Redom_Dragon);//<2F>
RegisterNutApi(L"L_Get_Dragon_Pack", squirrel::Get_Dragon_Pack);//<2F><>ѯ<EFBFBD><D1AF><EFBFBD>а<EFBFBD>
RegisterNutApi(L"L_Sync_Dragon_Pack", squirrel::Sync_Dragon_Pack);//ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
2022-02-10 14:14:08 +08:00
}