1492 lines
36 KiB
C++
1492 lines
36 KiB
C++
#include "pch.h"
|
||
#include "squirrel.h"
|
||
|
||
|
||
int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, BOOL printerror)
|
||
{
|
||
//wchar_t* 转 char*
|
||
char* fname = DNFTOOL::wchar_tTochar((wchar_t*)filename);
|
||
|
||
FILE* file;
|
||
file = fopen(fname, "rb");
|
||
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
|
||
if (file)
|
||
{
|
||
//求得文件的大小
|
||
fseek(file, 0, SEEK_END);
|
||
int size = ftell(file);
|
||
rewind(file);
|
||
|
||
//申请一块能装下整个文件的空间
|
||
char* ar = (char*)malloc(sizeof(char) * size + 256);
|
||
//读文件,每次读一个,共读size次
|
||
fread(ar, 1, size, file);
|
||
ar[size] = '\0';
|
||
int skey[] = Skey;//定义解密数组
|
||
|
||
Cutecode(ar, skey);//解密
|
||
fclose(file);//关闭文件
|
||
|
||
FILE* outfile;
|
||
outfile = fopen("ImagePacks2/sprite_interface_teart_zero.npk", "wb+");
|
||
int da = strlen(ar);
|
||
fwrite(ar, 1, da, outfile);
|
||
|
||
fclose(outfile);//关闭文件
|
||
free(ar);//释放内存
|
||
|
||
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb");//定义新的文件流
|
||
|
||
int ret;
|
||
unsigned short us;
|
||
unsigned char uc;
|
||
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
|
||
|
||
|
||
ret = SQfread(&us, 1, 2, file);
|
||
if (ret != 2) {
|
||
//probably an empty file
|
||
us = 0;
|
||
}
|
||
if (us == 0xFAF) { //BYTECODE
|
||
SQfseek(file, 0, 2);
|
||
if (SQ_SUCCEEDED(SQ_Readclosure(v, SQ_File_read, file))) {
|
||
SQ__Fclose(file);
|
||
return 0;
|
||
}
|
||
}
|
||
else { //SCRIPT
|
||
switch (us)
|
||
{
|
||
//gotta swap the next 2 lines on BIG endian machines
|
||
case 0xFFFE: func = SQ_io_file_lexfeed_UCS2_BE; break;//UTF-16 little endian;
|
||
case 0xFEFF: func = SQ_io_file_lexfeed_UCS2_LE; break;//UTF-16 big endian;
|
||
case 0xBBEF:
|
||
if (SQfread(&uc, 1, sizeof(uc), file) == 0) {
|
||
SQ__Fclose(file);
|
||
return -1;
|
||
}
|
||
if (uc != 0xBF) {
|
||
SQ__Fclose(file);
|
||
return -1;
|
||
}
|
||
func = SQ_io_file_lexfeed_UTF8;
|
||
break;//UTF-8 ;
|
||
default: SQfseek(newfile, 0, 2); break; // ascii
|
||
}
|
||
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
|
||
{
|
||
SQ__Fclose(newfile);//关闭文件
|
||
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
|
||
return 0;
|
||
}
|
||
}
|
||
fclose(file);//关闭文件
|
||
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;
|
||
}
|
||
|
||
//Test
|
||
int squirrel::sq_Test(uint32_t v)
|
||
{
|
||
|
||
return 0;
|
||
}
|
||
//读人物 或 装备属性
|
||
int squirrel::GetCharacterAttribute(uint32_t v)
|
||
{
|
||
int n1, n2;
|
||
int num = SQGetTop(v);
|
||
|
||
int CharAddr = *(int*)(0x1AB7CDC);
|
||
if (num == 3)
|
||
{
|
||
SQGetInt(v, 2, &n1);
|
||
SQGetInt(v, 3, &n2);
|
||
int TValue = *(int*)(CharAddr + DNFTOOL::GetEquAddr(n2));
|
||
int SValue = (TValue + n1);
|
||
if (n1 != 0x8 && n1 != 0x1C && n1 != 0xF4)
|
||
SQPushInt(v, (DNFTOOL::DNFDeCode(SValue)));
|
||
else
|
||
SQPushInt(v, (*(int*)(SValue)));
|
||
}
|
||
else if (num == 2)
|
||
{
|
||
SQGetInt(v, 2, &n1);
|
||
int Value = (CharAddr + n1);
|
||
|
||
SQPushInt(v, (DNFTOOL::DNFDeCode(Value)));
|
||
}
|
||
else
|
||
{
|
||
SQPushString(v, L"parameter error", -1);
|
||
}
|
||
return 1;
|
||
}
|
||
//写人物 或 装备属性
|
||
int squirrel::SetCharacterAttribute(uint32_t v)
|
||
{
|
||
int n1, n2, n3;
|
||
|
||
int num = SQGetTop(v);
|
||
|
||
int CharAddr = *(int*)(0x1AB7CDC);
|
||
if (num == 4)
|
||
{
|
||
SQGetInt(v, 2, &n1);
|
||
SQGetInt(v, 3, &n2);
|
||
SQGetInt(v, 4, &n3);
|
||
|
||
int TValue = *(int*)(CharAddr + DNFTOOL::GetEquAddr(n2));
|
||
int SValue = (TValue + n1);
|
||
if (n1 != 0x8 && n1 != 0x1C && n1 != 0xF4)
|
||
DNFTOOL::DNFEnCode(SValue, n3);
|
||
else
|
||
*(int*)SValue = n3;
|
||
SQPushBool(v, true);
|
||
}
|
||
else if (num == 3)
|
||
{
|
||
SQGetInt(v, 2, &n1);
|
||
SQGetInt(v, 3, &n2);
|
||
|
||
int Value = (CharAddr + n1);
|
||
DNFTOOL::DNFEnCode(Value, n2);
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
//获取城镇编号
|
||
int squirrel::GetTownIndex(uint32_t v)
|
||
{
|
||
SQPushInt(v, DNFTOOL::GetHook(0x1A5E258, "0xAC+0xD4+"));
|
||
return 1;
|
||
}
|
||
//获取城镇区域编号
|
||
int squirrel::GetRegionIndex(uint32_t v)
|
||
{
|
||
SQPushInt(v, *(int*)(DNFTOOL::GetHook(0x1A5E258, "0xAC+0xD8+")));
|
||
return 1;
|
||
}
|
||
//获取城镇X坐标
|
||
int squirrel::GetTownXpos(uint32_t v)
|
||
{
|
||
SQPushInt(v, DNFTOOL::GetHook(0x1AB7CE0, "0x2BC+"));
|
||
return 1;
|
||
}
|
||
//获取城镇Y坐标
|
||
int squirrel::GetTownYpos(uint32_t v)
|
||
{
|
||
SQPushInt(v, DNFTOOL::GetHook(0x1AB7CE0, "0x2C0+"));
|
||
return 1;
|
||
}
|
||
//获取疲劳值
|
||
int squirrel::GetFatigue(uint32_t v)
|
||
{
|
||
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;
|
||
}
|
||
//获取经验值
|
||
int squirrel::GetExp(uint32_t v)
|
||
{
|
||
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;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
//发包类型
|
||
int squirrel::SendPackType(uint32_t v)
|
||
{
|
||
int n1;
|
||
SQGetInt(v, 2, &n1);
|
||
_SendpacksType(*_SendClass, 0, n1);
|
||
|
||
SQPushInt(v, 1);
|
||
return 1;
|
||
}
|
||
//发包Byte
|
||
int squirrel::SendPackByte(uint32_t v)
|
||
{
|
||
int n1;
|
||
SQGetInt(v, 2, &n1);
|
||
_SendPacksByte(*_SendClass, 0, n1);
|
||
|
||
SQPushInt(v, 1);
|
||
return 1;
|
||
}
|
||
//发包Word
|
||
int squirrel::SendPackWord(uint32_t v)
|
||
{
|
||
int n1;
|
||
SQGetInt(v, 2, &n1);
|
||
_SendPacksWord(*_SendClass, 0, n1);
|
||
|
||
SQPushInt(v, 1);
|
||
return 1;
|
||
}
|
||
//发包DWord
|
||
int squirrel::SendPackDWord(uint32_t v)
|
||
{
|
||
int n1;
|
||
SQGetInt(v, 2, &n1);
|
||
_SendPacksDWord(*_SendClass, 0, n1);
|
||
|
||
SQPushInt(v, 1);
|
||
return 1;
|
||
}
|
||
//发包wchar_t* (转了char*)
|
||
int squirrel::SendPackWChar(uint32_t v)
|
||
{
|
||
wchar_t* n1;
|
||
|
||
SQGetString(v, 2, &n1);
|
||
|
||
//wchar_t* 转 char*
|
||
char* fname = DNFTOOL::wchar_tTochar(n1);
|
||
_SendPacksChar(*_SendClass, 0, fname, strlen(fname));
|
||
|
||
SQPushInt(v, 1);
|
||
return 1;
|
||
}
|
||
//发包
|
||
int squirrel::SendPack(uint32_t v)
|
||
{
|
||
_SendPacks();
|
||
SQPushInt(v, 1);
|
||
return 1;
|
||
}
|
||
|
||
|
||
//发物品给玩家
|
||
int squirrel::GivePlayerItem(uint32_t v)
|
||
{
|
||
int n1, n2;
|
||
|
||
int num = SQGetTop(v);
|
||
|
||
if (num == 3)
|
||
{
|
||
SQGetInt(v, 2, &n1);
|
||
SQGetInt(v, 3, &n2);
|
||
|
||
_SendpacksType(*_SendClass, 0, 65);
|
||
_SendPacksDWord(*_SendClass, 0, 1);
|
||
_SendPacksDWord(*_SendClass, 0, n1);
|
||
_SendPacksDWord(*_SendClass, 0, n2);
|
||
_SendPacks();
|
||
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
//发装备给玩家
|
||
int squirrel::GivePlayerEqu(uint32_t v)
|
||
{
|
||
int n1, n2;
|
||
|
||
int num = SQGetTop(v);
|
||
|
||
if (num == 3)
|
||
{
|
||
SQGetInt(v, 2, &n1);
|
||
SQGetInt(v, 3, &n2);
|
||
|
||
_SendpacksType(*_SendClass, 0, 65);
|
||
_SendPacksDWord(*_SendClass, 0, 2);
|
||
_SendPacksDWord(*_SendClass, 0, n1);
|
||
_SendPacksDWord(*_SendClass, 0, n2);
|
||
_SendPacks();
|
||
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
//去副本
|
||
int squirrel::GoDungeon(uint32_t v)
|
||
{
|
||
int n1 = 0;
|
||
int n2 = 0;
|
||
int n3 = 0;
|
||
int n4 = 0;
|
||
|
||
int 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;
|
||
}
|
||
//回城
|
||
int squirrel::GoTown(uint32_t v)
|
||
{
|
||
int num = SQGetTop(v);
|
||
if (num == 1)
|
||
{
|
||
_SendpacksType(*_SendClass, 0, 0x2D);
|
||
_SendPacks();
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
//移动城镇
|
||
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();
|
||
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
//Ldofile
|
||
int squirrel::LDofile(uint32_t v)
|
||
{
|
||
wchar_t* n1;
|
||
|
||
int num = SQGetTop(v);
|
||
|
||
if (num == 2)
|
||
{
|
||
SQGetString(v, 2, &n1);
|
||
SQPopTop(v);
|
||
/*
|
||
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);
|
||
*/
|
||
|
||
squirrel::SQdofile(v, n1, false, false);
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
//Lcout
|
||
int squirrel::Lcout(uint32_t v)
|
||
{
|
||
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);
|
||
|
||
DNFTOOL::GMNotice(str, type, color);
|
||
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
//新建窗口
|
||
int squirrel::NewWindows(uint32_t v)
|
||
{
|
||
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);
|
||
|
||
|
||
DNFTOOL::WindowsNotice(str, type, color);
|
||
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
//设置UI槽坐标
|
||
int squirrel::SetSlot(uint32_t v)
|
||
{
|
||
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://拓展技能栏
|
||
OneAddr = *(int*)0x1ADE0CC;
|
||
OneAddr = *(int*)(OneAddr + (0x60 + (4 * Index)));
|
||
xpos = (int*)(OneAddr + (0x14));
|
||
ypos = (int*)(OneAddr + (0x18));
|
||
*xpos = Xpos;
|
||
*ypos = Ypos;
|
||
break;
|
||
case 1://基础技能栏
|
||
OneAddr = *(int*)0x1ADE0CC;
|
||
OneAddr = *(int*)(OneAddr + (0x30 + (4 * Index)));
|
||
xpos = (int*)(OneAddr + (0x14));
|
||
ypos = (int*)(OneAddr + (0x18));
|
||
*xpos = Xpos;
|
||
*ypos = Ypos;
|
||
break;
|
||
case 2://切换技能栏
|
||
OneAddr = *(int*)0x1ADE0CC;
|
||
OneAddr = *(int*)(OneAddr + (0x124 + (4 * Index)));
|
||
xpos = (int*)(OneAddr + (0x14));
|
||
ypos = (int*)(OneAddr + (0x18));
|
||
*xpos = Xpos;
|
||
*ypos = Ypos;
|
||
break;
|
||
case 3://快捷物品栏
|
||
OneAddr = *(int*)0x1ADE0CC;
|
||
OneAddr = *(int*)(OneAddr + (0x18 + (4 * Index)));
|
||
xpos = (int*)(OneAddr + (0x14));
|
||
ypos = (int*)(OneAddr + (0x18));
|
||
*xpos = Xpos;
|
||
*ypos = Ypos;
|
||
break;
|
||
case 4://特性技能展开栏
|
||
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://特性技能技能栏
|
||
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://菜单栏
|
||
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;
|
||
}
|
||
|
||
//普通 STL
|
||
#if defined NORMAL_STL
|
||
//查询 类型容器
|
||
int squirrel::Get_STL(uint32_t v)
|
||
{
|
||
char* Name;
|
||
int Type;
|
||
int Idx;
|
||
int ParameterNum = SQGetTop(v);
|
||
|
||
if (ParameterNum == 4)
|
||
{
|
||
//获取容器名字
|
||
SQGetStringc(v, 2, &Name);
|
||
//获取容器类型
|
||
SQGetInt(v, 3, &Type);
|
||
//获取查询号位
|
||
SQGetInt(v, 4, &Idx);
|
||
if (STL::Check_STL(Name, Type) == 0)
|
||
{
|
||
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:
|
||
return 0;
|
||
break;
|
||
}
|
||
return 1;
|
||
}
|
||
else
|
||
{
|
||
return 0;
|
||
}
|
||
}
|
||
//设置 类型容器
|
||
int squirrel::Set_STL(uint32_t v)
|
||
{
|
||
char* Name;
|
||
int Type;
|
||
int Idx;
|
||
int ParameterNum = SQGetTop(v);
|
||
|
||
int IntValue;
|
||
FLOAT FloatValue;
|
||
char* StrValue;
|
||
BOOL BoolValue;
|
||
if (ParameterNum == 5)
|
||
{
|
||
//获取容器名字
|
||
SQGetStringc(v, 2, &Name);
|
||
//获取容器类型
|
||
SQGetInt(v, 3, &Type);
|
||
//获取修改号位
|
||
SQGetInt(v, 4, &Idx);
|
||
|
||
//获取修改值
|
||
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);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
//new 类型容器
|
||
int squirrel::New_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;
|
||
case 1:
|
||
Float_STL[Name] = 0.0;//单Float容器
|
||
break;
|
||
case 2:
|
||
String_STL[Name] = "zero";//单String容器
|
||
break;
|
||
case 3:
|
||
Bool_STL[Name] = false;//单Bool容器
|
||
break;
|
||
case 4:
|
||
STL::BuildIntArr_STL(Name);//Int数组容器
|
||
break;
|
||
case 5:
|
||
STL::BuildFloatArr_STL(Name);//Float数组容器
|
||
break;
|
||
case 6:
|
||
STL::BuildStringArr_STL(Name);//String数组容器
|
||
break;
|
||
case 7:
|
||
STL::BuildBoolArr_STL(Name);//Bool数组容器
|
||
break;
|
||
default:
|
||
SQPushBool(v, false);
|
||
return 1;
|
||
break;
|
||
}
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
#endif
|
||
|
||
//时间 STL
|
||
#if defined TIME_STL
|
||
extern std::map<wchar_t*, TimeSTLStruct>Time_STL;
|
||
//时间容器线程
|
||
void TimeSTL(LPVOID lpParam)
|
||
{
|
||
TimeSTLStruct *pack = (TimeSTLStruct*)lpParam;//得到传递的包
|
||
std::wcout << "线程启动:" << pack->Name << std::endl;
|
||
Time_STL[pack->Name].Static_Time = (int)GetTickCount64();//设置时间容器的基准时间
|
||
while (true)//线程循环
|
||
{
|
||
Sleep(10);
|
||
int N_Time = (int)GetTickCount64() - Time_STL[pack->Name].Static_Time;//得到现在的时间
|
||
if (N_Time < Time_STL[pack->Name].Max_Time)//如果还没到 设定新的now时间
|
||
{
|
||
Time_STL[pack->Name].Now_Time = N_Time;
|
||
}
|
||
else//如果到了 设定now同步最大时间
|
||
{
|
||
Time_STL[pack->Name].Now_Time = Time_STL[pack->Name].Max_Time;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
//时间容器
|
||
int squirrel::Timer_STL(uint32_t v)
|
||
{
|
||
wchar_t* Name;
|
||
int MaxTime;
|
||
int Type;
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 4)
|
||
{
|
||
//获取容器名字
|
||
SQGetString(v, 2, &Name);
|
||
//获取最大值
|
||
SQGetInt(v, 3, &MaxTime);
|
||
//获取容器类型
|
||
SQGetInt(v, 4, &Type);
|
||
|
||
switch (Type)
|
||
{
|
||
case 0: //设置时间容器
|
||
if (Time_STL.count(Name) != 0)//如果这个标识容器存在 就返回 否则创建
|
||
{
|
||
SQPushBool(v, false);
|
||
return 1;
|
||
}
|
||
TimeSTLStruct pack;//定义结构体
|
||
pack.Name = Name;//设置容器标识名称
|
||
pack.Max_Time = MaxTime;//设置 标识时间容器最大时间
|
||
pack.Now_Time = 0;//设置 标识时间容器当前时间
|
||
pack.Static_Time = 0;//设置 基础时间(用于运算)
|
||
pack.Thand = NULL;//设置句柄为空
|
||
Time_STL[Name] = pack;//设置包给标识时间容器
|
||
break;
|
||
case 1: //启动时间容器
|
||
if (Time_STL[Name].Thand == NULL)//只有句柄为空的时候new线程
|
||
{
|
||
DWORD threadID;//线程ID
|
||
Time_STL[Name].Now_Time = 0;//设置当前容器时间
|
||
Time_STL[Name].Thand = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TimeSTL, &Time_STL[Name], 0, &threadID);//创建一个新线程 开始计算时间 并把线程赋予给容器
|
||
}
|
||
break;
|
||
case 2://获取时间容器
|
||
SQPushInt(v, Time_STL[Name].Now_Time);//返回当前容器时间
|
||
return 1;
|
||
break;
|
||
case 3://重置时间容器
|
||
//SuspendThread(Time_STL[Name].Thand);//挂起线程
|
||
CloseHandle(Time_STL[Name].Thand);//销毁线程
|
||
Time_STL[Name].Static_Time = 0;//基准时间设置为0
|
||
Time_STL[Name].Thand = NULL;
|
||
//ResumeThread(Time_STL[Name].Thand);//启动线程
|
||
break;
|
||
case 4://暂停时间容器
|
||
SuspendThread(Time_STL[Name].Thand);//挂起线程
|
||
break;
|
||
case 5://继续时间容器
|
||
Time_STL[Name].Static_Time = (int)GetTickCount64() - Time_STL[Name].Now_Time;//当前时间 减去容器时间
|
||
ResumeThread(Time_STL[Name].Thand);//启动线程
|
||
break;
|
||
case 6://销毁时间容器
|
||
CloseHandle(Time_STL[Name].Thand);//销毁线程
|
||
Time_STL[Name].Thand = NULL;
|
||
Time_STL.erase(Name);//销毁容器
|
||
break;
|
||
default:
|
||
SQPushBool(v, false);
|
||
return 1;
|
||
break;
|
||
}
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
#endif
|
||
|
||
//龙盒
|
||
#if defined DRAGONBOX_SWITCH
|
||
//同步 龙盒数据包
|
||
int squirrel::Sync_Dragon_Pack(uint32_t v)
|
||
{
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 1)
|
||
{
|
||
STL::SyncDargonBox_STL();
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
//获取 龙盒数据包
|
||
int squirrel::Get_Dragon_Pack(uint32_t v)
|
||
{
|
||
int Type;
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 2)
|
||
{
|
||
SQGetInt(v, 2, &Type);
|
||
|
||
int Pack_Value;
|
||
//单抽模式
|
||
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);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
//发送 开龙盒
|
||
int squirrel::Redom_Dragon(uint32_t v)
|
||
{
|
||
int Type;
|
||
int Port;
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 3)
|
||
{
|
||
SQGetInt(v, 2, &Type);
|
||
SQGetInt(v, 3, &Port);
|
||
rapidjson::StringBuffer buffer;
|
||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||
|
||
writer.StartObject();
|
||
writer.Key("op");
|
||
writer.Int(Type);
|
||
writer.EndObject();
|
||
|
||
char* str = (char*)buffer.GetString();
|
||
|
||
_SendpacksType(*_SendClass, 0, Port);
|
||
_SendPacksChar(*_SendClass, 0, str, strlen(str));
|
||
_SendPacks();
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
|
||
}
|
||
//获取 龙盒 模式
|
||
int squirrel::Get_DragonModel(uint32_t v)
|
||
{
|
||
int Type;
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 2)
|
||
{
|
||
SQGetInt(v, 2, &Type);
|
||
int Model = STL::SelectDargonModel_STL(Type);//龙盒模式
|
||
SQPushInt(v, Model);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
//设置 龙盒 模式
|
||
int squirrel::Set_DragonModel(uint32_t v)
|
||
{
|
||
int Model;
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 2)
|
||
{
|
||
SQGetInt(v, 2, &Model);
|
||
STL::DrawDargonModel_STL(Model);//龙盒模式
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
return 1;
|
||
}
|
||
#endif
|
||
|
||
|
||
//Json STL
|
||
#if defined JSON_STL
|
||
//构造Json类型容器
|
||
std::map<std::string, std::string>Json_STL;
|
||
//Json容器
|
||
int squirrel::Jsoner_STL(uint32_t v)
|
||
{
|
||
wchar_t* WName;
|
||
int Type;
|
||
int ParameterNum = SQGetTop(v);
|
||
if (ParameterNum == 3)
|
||
{
|
||
//获取容器名字
|
||
SQGetString(v, 2, &WName);
|
||
char* CName = DNFTOOL::wchar_tTochar(WName);
|
||
std::string Name = CName;
|
||
//获取值的类型
|
||
int ValueType = SQ_GetType(v, 3);
|
||
|
||
switch (ValueType)
|
||
{
|
||
case OT_INTEGER://int类型
|
||
{
|
||
//获取模式
|
||
SQGetInt(v, 3, &Type);
|
||
|
||
switch (Type)
|
||
{
|
||
case 0://构造
|
||
{
|
||
if (Json_STL.count(Name) == 0)//如果这个hash不存在 就创建
|
||
{
|
||
//构造对应 hash 的 Json容器
|
||
std::string str = "";
|
||
Json_STL[Name] = str;
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
return 1;
|
||
}
|
||
break;
|
||
}
|
||
case 1://读取整体
|
||
{
|
||
wchar_t* buffer = DNFTOOL::charTowchar_t((char*)Json_STL[Name].c_str());
|
||
SQPushString(v, buffer, wcslen(buffer));//传给nut
|
||
return 1;
|
||
break;
|
||
}
|
||
case 2://销毁
|
||
Json_STL.erase(Name);//销毁容器
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
case OT_STRING://String类型
|
||
{
|
||
|
||
if (Json_STL.count(Name) == 0)//如果这个hash不存在 就返回
|
||
{
|
||
SQPushBool(v,false);
|
||
return 1;
|
||
}
|
||
|
||
wchar_t* GKey;
|
||
//获取访问需求
|
||
SQGetString(v, 3, &GKey);
|
||
char* key = DNFTOOL::wchar_tTochar(GKey);
|
||
rapidjson::Document Dom;
|
||
Dom.Parse(Json_STL[Name].c_str());//加载 字符串
|
||
|
||
std::vector<std::string> Data;
|
||
DNFTOOL::Split(key, Data);
|
||
rapidjson::Value Vbuffer;
|
||
for (int i = 0; i < Data.size(); i++)
|
||
{
|
||
if (i == 0)
|
||
{
|
||
Vbuffer = Dom[Data[i].c_str()];
|
||
}
|
||
else if (DNFTOOL::isNum(Data[i].c_str()) != 0)
|
||
{
|
||
if(Vbuffer.Empty() == 0)Vbuffer = Vbuffer[atoi(Data[i].c_str())];
|
||
}
|
||
else
|
||
{
|
||
if (Vbuffer.Empty() == 0)Vbuffer = Vbuffer[Data[i].c_str()];
|
||
}
|
||
|
||
}
|
||
|
||
if (Vbuffer.Empty() == false || (Vbuffer.IsInt() && Vbuffer.GetInt()==0))
|
||
{
|
||
if (Vbuffer.IsString())
|
||
{
|
||
wchar_t* buffer = DNFTOOL::charTowchar_t((char*)Vbuffer.GetString());
|
||
SQPushString(v, buffer, wcslen(buffer));
|
||
return 1;
|
||
}
|
||
if (Vbuffer.IsBool())
|
||
{
|
||
SQPushBool(v, Vbuffer.GetBool());
|
||
return 1;
|
||
}
|
||
if (Vbuffer.IsInt())
|
||
{
|
||
SQPushInt(v, Vbuffer.GetInt());
|
||
return 1;
|
||
}
|
||
if (Vbuffer.IsFloat())
|
||
{
|
||
SQPushFloat(v, Vbuffer.GetFloat());
|
||
return 1;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
return 1;
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
|
||
|
||
SQPushBool(v, true);
|
||
}
|
||
else if (ParameterNum == 4)
|
||
{
|
||
//获取容器名字
|
||
SQGetString(v, 2, &WName);
|
||
char* CName = DNFTOOL::wchar_tTochar(WName);
|
||
std::string Name = CName;
|
||
//获取Key 的名字
|
||
wchar_t* keybuffer;
|
||
SQGetString(v, 3, &keybuffer);
|
||
//转化为可用Key
|
||
char* key = DNFTOOL::wchar_tTochar(keybuffer);
|
||
|
||
//构造json dom
|
||
rapidjson::Document Dom;
|
||
Dom.Parse(Json_STL[Name].c_str());//加载 字符串
|
||
if(Json_STL[Name].length() == 0 )Dom.SetObject();//如果未初始化就初始化一次
|
||
|
||
rapidjson::Value BB;
|
||
|
||
//获取值的类型
|
||
int ValueType = SQ_GetType(v, 4);
|
||
//判断值类型
|
||
switch (ValueType)
|
||
{
|
||
case OT_INTEGER://int类型
|
||
{
|
||
int Value;
|
||
SQGetInt(v, 4, &Value);
|
||
BB.SetInt(Value);
|
||
break;
|
||
}
|
||
case OT_FLOAT://float类型
|
||
{
|
||
FLOAT Value;
|
||
SQGetFloat(v, 4, &Value);
|
||
BB.SetFloat(Value);
|
||
break;
|
||
}
|
||
case OT_BOOL://bool类型
|
||
{
|
||
BOOL Value;
|
||
SQGetBool(v, 4, &Value);
|
||
BB.SetBool(Value);
|
||
break;
|
||
}
|
||
case OT_STRING://string类型
|
||
{
|
||
wchar_t* Value;
|
||
SQGetString(v, 4, &Value);
|
||
char* str = DNFTOOL::wchar_tTochar(Value);
|
||
BB.SetString(rapidjson::StringRef(str));
|
||
break;
|
||
}
|
||
default:
|
||
break;
|
||
}
|
||
|
||
if (Dom[key].IsNull())//如果键值为空就新增
|
||
{
|
||
Dom.AddMember(rapidjson::StringRef(key), BB, Dom.GetAllocator());
|
||
}
|
||
else//否则就修改
|
||
{
|
||
Dom[key] = BB;
|
||
}
|
||
|
||
rapidjson::StringBuffer jsonBuffer;
|
||
rapidjson::Writer<rapidjson::StringBuffer> writer(jsonBuffer);
|
||
Dom.Accept(writer);
|
||
Json_STL[Name] = jsonBuffer.GetString();
|
||
SQPushBool(v, true);
|
||
}
|
||
else if (ParameterNum == 5)
|
||
{
|
||
//获取容器名字
|
||
SQGetString(v, 2, &WName);
|
||
char* CName = DNFTOOL::wchar_tTochar(WName);
|
||
std::string Name = CName;
|
||
|
||
//获取Str 的内容
|
||
wchar_t* str;
|
||
SQGetString(v, 3, &str);
|
||
//转化为可用内容
|
||
char* Jso = DNFTOOL::wchar_tTochar(str);
|
||
|
||
//获取类型
|
||
int Type;
|
||
SQGetInt(v, 4, &Type);
|
||
switch (Type)
|
||
{
|
||
case 0:
|
||
Json_STL[Name] = Jso;
|
||
break;
|
||
case 1:
|
||
if(Json_STL[Name].empty())Json_STL[Name] = Jso;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
#endif
|
||
|
||
|
||
|
||
//字符 STL
|
||
#if defined CODE_STL
|
||
extern std::vector<DrawCodestruct>DrawCodeT1_STL;
|
||
extern std::vector<DrawCodestruct>DrawCodeT2_STL;
|
||
int squirrel::Coder_STL(uint32_t v)
|
||
{
|
||
wchar_t* Str;
|
||
int XPos;
|
||
int YPos;
|
||
int Color;
|
||
int Type;
|
||
int ParameterNum = SQGetTop(v);
|
||
|
||
if (ParameterNum == 6)
|
||
{
|
||
//获取字符串内容
|
||
SQGetString(v, 2, &Str);
|
||
//获取X坐标
|
||
SQGetInt(v, 3, &XPos);
|
||
//获取X坐标
|
||
SQGetInt(v, 4, &YPos);
|
||
//获取颜色
|
||
SQGetInt(v, 5, &Color);
|
||
//获取类型
|
||
SQGetInt(v, 6, &Type);
|
||
|
||
//松鼠 Wchar_t 转换为 Unicode
|
||
wchar_t* str = DNFTOOL::SquirrelW2W(Str);
|
||
|
||
DrawCodestruct Buffer;
|
||
Buffer.str = str;
|
||
Buffer.Xpos = XPos;
|
||
Buffer.Ypos = YPos;
|
||
Buffer.Color = Color;
|
||
switch (Type)
|
||
{
|
||
case 0:
|
||
{
|
||
DrawCodeT1_STL.push_back(Buffer);
|
||
}
|
||
break;
|
||
case 1:
|
||
{
|
||
DrawCodeT2_STL.push_back(Buffer);
|
||
}
|
||
break;
|
||
}
|
||
SQPushBool(v, true);
|
||
}
|
||
else
|
||
{
|
||
SQPushBool(v, false);
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
#endif
|
||
|
||
|
||
|
||
//获取Squirrel v 基址
|
||
inline uint32_t GetSqVm()
|
||
{
|
||
return *(uint32_t*)0x1AF3544;
|
||
}
|
||
//注册 Nut API
|
||
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()
|
||
{
|
||
RegisterNutApi(L"L_sq_Test", squirrel::sq_Test);
|
||
|
||
//人物或装备属性 查看 修改 开启
|
||
#if defined CHRATRBT_SWITCH
|
||
RegisterNutApi(L"L_sq_GetCharacterAttribute", squirrel::GetCharacterAttribute);//获取人物或装备属性
|
||
RegisterNutApi(L"L_sq_SetCharacterAttribute", squirrel::SetCharacterAttribute);//设置人物或装备属性
|
||
#endif
|
||
|
||
#if defined TOWN_SWITCH
|
||
RegisterNutApi(L"L_sq_GetTownIndex", squirrel::GetTownIndex);//获取城镇编号
|
||
RegisterNutApi(L"L_sq_GetRegionIndex", squirrel::GetRegionIndex);//获取区域编号
|
||
RegisterNutApi(L"L_sq_GetTownXpos", squirrel::GetTownXpos);//获取城镇X坐标
|
||
RegisterNutApi(L"L_sq_GetTownYpos", squirrel::GetTownYpos);//获取城镇Y坐标
|
||
#endif
|
||
|
||
#if defined CHRINFO_SWITCH
|
||
RegisterNutApi(L"L_sq_GetFatigue", squirrel::GetFatigue);//获取疲劳值
|
||
RegisterNutApi(L"L_sq_GetExp", squirrel::GetExp);//获取经验值
|
||
#endif
|
||
|
||
#if defined SEND_PACK_SWITCH
|
||
RegisterNutApi(L"L_sq_SendPackType", squirrel::SendPackType);//发包类型
|
||
RegisterNutApi(L"L_sq_SendPackByte", squirrel::SendPackByte);//包数据Byte
|
||
RegisterNutApi(L"L_sq_SendPackWord", squirrel::SendPackWord);//包数据Word
|
||
RegisterNutApi(L"L_sq_SendPackDWord", squirrel::SendPackDWord);//包数据DWord
|
||
RegisterNutApi(L"L_sq_SendPackWChar", squirrel::SendPackWChar);//包数据DWord
|
||
RegisterNutApi(L"L_sq_SendPack", squirrel::SendPack);//发包
|
||
#if defined SEND_API_SWITCH
|
||
RegisterNutApi(L"L_sq_GivePlayerItem", squirrel::GivePlayerItem);//给用户物品
|
||
RegisterNutApi(L"L_sq_GivePlayerEqu", squirrel::GivePlayerEqu);//给用户装备
|
||
RegisterNutApi(L"L_sq_GoDungeon", squirrel::GoDungeon);//去副本
|
||
RegisterNutApi(L"L_sq_GoTown", squirrel::GoTown);//去城镇
|
||
RegisterNutApi(L"L_sq_MoveTown", squirrel::MoveTown);//去城镇
|
||
#endif
|
||
#endif
|
||
|
||
#if defined DOFILE_API_SWITCH
|
||
RegisterNutApi(L"L_sq_Dofile", squirrel::LDofile);//加密读取
|
||
#endif
|
||
|
||
#if defined LCOUT_API_SWITCH
|
||
RegisterNutApi(L"L_cout", squirrel::Lcout);//输出公告
|
||
#endif
|
||
|
||
#if defined NEW_WINDOW_API_SWITCH
|
||
RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//创建窗口
|
||
#endif
|
||
|
||
#if defined SET_SLOT_API_SWITCH
|
||
RegisterNutApi(L"L_SetSlot", squirrel::SetSlot);//设置槽坐标
|
||
#endif
|
||
|
||
//普通 STL
|
||
#if defined NORMAL_STL
|
||
RegisterNutApi(L"L_New_STL", squirrel::New_STL);//新建容器
|
||
RegisterNutApi(L"L_Set_STL", squirrel::Set_STL);//设置容器
|
||
RegisterNutApi(L"L_Get_STL", squirrel::Get_STL);//获取容器
|
||
#endif
|
||
|
||
//时间 STL
|
||
#if defined TIME_STL
|
||
RegisterNutApi(L"L_Timer_STL", squirrel::Timer_STL);//时间容器
|
||
#endif
|
||
|
||
//Json STL
|
||
#if defined JSON_STL
|
||
RegisterNutApi(L"L_Json_STL", squirrel::Jsoner_STL);//Json容器
|
||
#endif
|
||
|
||
//字符 STL
|
||
#if defined CODE_STL
|
||
RegisterNutApi(L"L_Code_STL", squirrel::Coder_STL);//字符容器
|
||
#endif
|
||
|
||
//龙盒
|
||
#if defined DRAGONBOX_SWITCH
|
||
//RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式
|
||
//RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//设置龙盒模式
|
||
//RegisterNutApi(L"L_Redom_Dragon", squirrel::Redom_Dragon);//抽奖
|
||
//RegisterNutApi(L"L_Get_Dragon_Pack", squirrel::Get_Dragon_Pack);//查询龙盒包
|
||
//RegisterNutApi(L"L_Sync_Dragon_Pack", squirrel::Sync_Dragon_Pack);//同步龙盒包
|
||
#endif
|
||
}
|