2022-02-07 03:31:00 +08:00
|
|
|
|
#include "pch.h"
|
2023-04-14 14:56:01 +08:00
|
|
|
|
#include "lsquirrel.h"
|
2022-04-24 02:31:42 +08:00
|
|
|
|
|
2022-03-09 16:27:06 +08:00
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2022-04-22 02:16:45 +08:00
|
|
|
|
int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, BOOL printerror)
|
2022-03-09 16:27:06 +08:00
|
|
|
|
{
|
2022-11-06 23:12:18 +08:00
|
|
|
|
//wchar_t* ת char*
|
2022-04-22 02:16:45 +08:00
|
|
|
|
char* fname = DNFTOOL::wchar_tTochar((wchar_t*)filename);
|
2022-03-09 16:27:06 +08:00
|
|
|
|
|
|
|
|
|
|
FILE* file;
|
2022-04-21 13:02:35 +08:00
|
|
|
|
file = fopen(fname, "rb");
|
2022-03-09 16:27:06 +08:00
|
|
|
|
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>
|
2022-04-21 13:02:35 +08:00
|
|
|
|
char* ar = (char*)malloc(sizeof(char) * size + 256);
|
2022-03-09 16:27:06 +08:00
|
|
|
|
//<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ÿ<EFBFBD>ζ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>size<7A><65>
|
|
|
|
|
|
fread(ar, 1, size, file);
|
2022-04-21 13:02:35 +08:00
|
|
|
|
ar[size] = '\0';
|
|
|
|
|
|
int skey[] = Skey;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-03-09 16:27:06 +08:00
|
|
|
|
|
|
|
|
|
|
Cutecode(ar, skey);//<2F><><EFBFBD><EFBFBD>
|
2022-04-21 13:02:35 +08:00
|
|
|
|
fclose(file);//<2F>ر<EFBFBD><D8B1>ļ<EFBFBD>
|
2022-03-09 16:27:06 +08:00
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
wchar_t* te = DNFTOOL::charTowchar_t(ar);
|
|
|
|
|
|
return SQ_Compilebuffer(v, te, wcslen(te), (wchar_t*)filename, true);
|
2022-03-09 16:27:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-22 02:16:45 +08:00
|
|
|
|
int squirrel::SQdofile(uint32_t v, const wchar_t* filename, BOOL retval, BOOL printerror)
|
2022-03-09 16:27:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
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-09-06 00:08:26 +08:00
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
int squirrel::SQdofileBuffer(uint32_t v, const wchar_t* filename, const wchar_t* str)
|
|
|
|
|
|
{
|
2023-11-13 14:00:01 +08:00
|
|
|
|
//int oldtop = SQGetTop(v);
|
|
|
|
|
|
if (SQ_Compilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0)
|
2022-11-06 23:12:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
SQPushRootTable(v);
|
|
|
|
|
|
SQ_Call(v, 1, 1, 1);
|
|
|
|
|
|
SQPop(v, 1);
|
|
|
|
|
|
}
|
2023-11-13 14:00:01 +08:00
|
|
|
|
//SQPop(v, oldtop);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
int squirrel::LenheartGetIntData(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
|
int GetRidingObjectAddress(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress = GetSqrObject(v, 2);
|
|
|
|
|
|
SQPushInt(v, *(int*)(objAddress + 0x54d0));
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
|
int squirrel::GetObjectAddress(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress = GetSqrObject(v, 2);
|
|
|
|
|
|
SQPushInt(v, objAddress);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::GetObjectName(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress = GetSqrObject(v, 2);
|
|
|
|
|
|
int objNameAddress = *(int*)(objAddress + 0x258);
|
|
|
|
|
|
char* str = DNFTOOL::UnicodeToUtf8((wchar_t*)objNameAddress);
|
|
|
|
|
|
wchar_t* name = DNFTOOL::charTowchar_t(str);
|
|
|
|
|
|
free (str);
|
|
|
|
|
|
SQPushString(v, name, -1);
|
|
|
|
|
|
delete[]name;
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2023-04-14 14:56:01 +08:00
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::GetObjectInfo(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress;
|
|
|
|
|
|
SQGetInt(v, 2, &objAddress);
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
if (ParameterNum == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + InfoAddress);
|
|
|
|
|
|
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 4, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, *(int*)Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushFloat(v, *(FLOAT*)Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 5)
|
|
|
|
|
|
{
|
|
|
|
|
|
int EquAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &EquAddress);
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 4, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + EquAddress);
|
|
|
|
|
|
Value = *(int*)Value;
|
|
|
|
|
|
|
|
|
|
|
|
Value = Value + InfoAddress;
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 5, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, *(int*)Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushFloat(v, *(FLOAT*)Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQ_Throwerror(v, L"Incorrect function argument");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ܻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::GetObjectDeInfo(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress;
|
|
|
|
|
|
SQGetInt(v, 2, &objAddress);
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
if (ParameterNum == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + InfoAddress);
|
|
|
|
|
|
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 4, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, DNFTOOL::DNFDeCode(Value));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushFloat(v, (FLOAT)DNFTOOL::DNFDeCode(Value));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 5)
|
|
|
|
|
|
{
|
|
|
|
|
|
int EquAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &EquAddress);
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 4, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + EquAddress);
|
|
|
|
|
|
Value = *(int*)Value;
|
|
|
|
|
|
|
|
|
|
|
|
Value = Value + InfoAddress;
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 5, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, DNFTOOL::DNFDeCode(Value));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushFloat(v, (FLOAT)DNFTOOL::DNFDeCode(Value));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQ_Throwerror(v, L"Incorrect function argument");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::SetObjectInfo(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress;
|
|
|
|
|
|
SQGetInt(v, 2, &objAddress);
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
if (ParameterNum == 5)
|
|
|
|
|
|
{
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + InfoAddress);
|
|
|
|
|
|
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 4, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
int W_Value;
|
|
|
|
|
|
SQGetInt(v, 5, &W_Value);
|
|
|
|
|
|
*(int*)Value = W_Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
FLOAT W_Value;
|
|
|
|
|
|
SQGetFloat(v, 5, &W_Value);
|
|
|
|
|
|
*(FLOAT*)Value = W_Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 6)
|
|
|
|
|
|
{
|
|
|
|
|
|
int EquAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &EquAddress);
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 4, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + EquAddress);
|
|
|
|
|
|
Value = *(int*)Value;
|
|
|
|
|
|
|
|
|
|
|
|
Value = Value + InfoAddress;
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 5, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
int W_Value;
|
|
|
|
|
|
SQGetInt(v, 6, &W_Value);
|
|
|
|
|
|
*(int*)Value = W_Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
FLOAT W_Value;
|
|
|
|
|
|
SQGetFloat(v, 6, &W_Value);
|
|
|
|
|
|
*(FLOAT*)Value = W_Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQ_Throwerror(v, L"Incorrect function argument");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::SetObjectDeInfo(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress;
|
|
|
|
|
|
SQGetInt(v, 2, &objAddress);
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
if (ParameterNum == 5)
|
2023-04-14 14:56:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + InfoAddress);
|
|
|
|
|
|
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 4, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
int W_Value;
|
|
|
|
|
|
SQGetInt(v, 5, &W_Value);
|
|
|
|
|
|
DNFTOOL::DNFEnCode(Value, W_Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
FLOAT W_Value;
|
|
|
|
|
|
SQGetFloat(v, 5, &W_Value);
|
|
|
|
|
|
DNFTOOL::DNFEnCode(Value, (int)W_Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-13 14:00:01 +08:00
|
|
|
|
else if (ParameterNum == 6)
|
2023-04-14 14:56:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
int EquAddress;
|
|
|
|
|
|
SQGetInt(v, 3, &EquAddress);
|
|
|
|
|
|
int InfoAddress;
|
|
|
|
|
|
SQGetInt(v, 4, &InfoAddress);
|
|
|
|
|
|
int Value = (objAddress + EquAddress);
|
|
|
|
|
|
Value = *(int*)Value;
|
|
|
|
|
|
|
|
|
|
|
|
Value = Value + InfoAddress;
|
|
|
|
|
|
BOOL Type;
|
|
|
|
|
|
SQGetBool(v, 5, &Type);
|
|
|
|
|
|
if (Type == TRUE)
|
|
|
|
|
|
{
|
|
|
|
|
|
int W_Value;
|
|
|
|
|
|
SQGetInt(v, 6, &W_Value);
|
|
|
|
|
|
DNFTOOL::DNFEnCode(Value, W_Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Type == FALSE)
|
|
|
|
|
|
{
|
|
|
|
|
|
FLOAT W_Value;
|
|
|
|
|
|
SQGetFloat(v, 6, &W_Value);
|
|
|
|
|
|
DNFTOOL::DNFEnCode(Value, (int)W_Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQ_Throwerror(v, L"Incorrect function argument");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
|
|
|
|
|
int squirrel::GetObjectLevel(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objAddress = GetSqrObject(v, 2);
|
|
|
|
|
|
int Level = DNFTOOL::DNFDeCode(objAddress + 0x1A4C);
|
|
|
|
|
|
SQPushInt(v, Level);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-13 10:09:55 +08:00
|
|
|
|
//Test
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>CALL
|
2023-04-14 14:56:01 +08:00
|
|
|
|
typedef void(* NNoticeTCall)(DWORD thisc, DWORD Seat, DWORD a1, wchar_t* a2, DWORD a3, DWORD a4, DWORD a5);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
static NNoticeTCall _ANoticeTcall = (NNoticeTCall)0xE6E070;
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⴰ<EFBFBD><E2B4B0>
|
|
|
|
|
|
typedef void(_fastcall _Open_ExWindow)(int thisc, void*, int a2, char a3, char a4);
|
|
|
|
|
|
static _Open_ExWindow* Open_ExWindow = (_Open_ExWindow*)0xE718A0;
|
2024-03-31 13:23:55 +08:00
|
|
|
|
static _Open_ExWindow* Open_ExWindow2 = (_Open_ExWindow*)0xE6E070;
|
2023-11-13 14:00:01 +08:00
|
|
|
|
int sq_Open_ExWindow(uint32_t v) {
|
|
|
|
|
|
int a1, a2, a3, a4;
|
|
|
|
|
|
|
|
|
|
|
|
SQGetInt(v, 2, &a1);
|
|
|
|
|
|
SQGetInt(v, 3, &a2);
|
|
|
|
|
|
SQGetInt(v, 4, &a3);
|
|
|
|
|
|
SQGetInt(v, 5, &a4);
|
|
|
|
|
|
|
|
|
|
|
|
Open_ExWindow(a1,0,a2,a3,a4);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2024-03-31 13:23:55 +08:00
|
|
|
|
int sq_Open_ExWindow2(uint32_t v) {
|
|
|
|
|
|
int a1, a2, a3, a4;
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
SQGetInt(v, 2, &a1);
|
|
|
|
|
|
SQGetInt(v, 3, &a2);
|
|
|
|
|
|
SQGetInt(v, 4, &a3);
|
|
|
|
|
|
SQGetInt(v, 5, &a4);
|
|
|
|
|
|
|
|
|
|
|
|
Open_ExWindow2(a1, 0, a2, a3, a4);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
typedef int(_cdecl _sub7AAB60)(int a1);
|
|
|
|
|
|
static _sub7AAB60* getitemimg = (_sub7AAB60*)0x7aab60;
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_GetImg(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int a1;
|
|
|
|
|
|
SQGetInt(v, 2, &a1);
|
|
|
|
|
|
|
|
|
|
|
|
int img = getitemimg(a1);
|
|
|
|
|
|
SQPushInt(v, img);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef int(_cdecl _sub7AA800)(int a1, int a2, int a3, int a4, int a5, int a6, char a7);
|
|
|
|
|
|
static _sub7AA800* drawimg = (_sub7AA800*)0x7aa800;
|
|
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Item
|
|
|
|
|
|
int squirrel::sq_DrawItem(uint32_t v)
|
2022-02-13 10:09:55 +08:00
|
|
|
|
{
|
2022-11-06 23:12:18 +08:00
|
|
|
|
int a1, a2, a3, a4, a5, a6, a7;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQGetInt(v, 2, &a1);
|
|
|
|
|
|
SQGetInt(v, 3, &a2);
|
|
|
|
|
|
SQGetInt(v, 4, &a3);
|
|
|
|
|
|
SQGetInt(v, 5, &a4);
|
|
|
|
|
|
SQGetInt(v, 6, &a5);
|
|
|
|
|
|
SQGetInt(v, 7, &a6);
|
|
|
|
|
|
SQGetInt(v, 8, &a7);
|
|
|
|
|
|
|
|
|
|
|
|
int img = getitemimg(a3);
|
|
|
|
|
|
drawimg(a1, a2, img, a4, a5, a6, a7);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
typedef int(_fastcall _Load_Npk)(int thisc, void*, int a2, wchar_t* a3);
|
|
|
|
|
|
typedef int(_fastcall _Get_Img)(int thisc, void*, int a2 );
|
|
|
|
|
|
typedef int(_fastcall _Draw_Img)(int thisc, void*, int X,int Y,int Img);
|
|
|
|
|
|
typedef int(_fastcall _Ex_Draw_Img)(DWORD thisc, DWORD Seat, int X, int Y, DWORD Img, int a5, int a6, int a7, int a8, float a9, float a10);
|
|
|
|
|
|
typedef int(_fastcall _Ex_Draw_Num)(DWORD thisc, DWORD Seat, int X, int Y, DWORD Value, DWORD RGBA, int a6);
|
|
|
|
|
|
typedef int(_fastcall _Ex_Draw_Init)(DWORD thisc, DWORD Seat, DWORD Value, DWORD RGBA, DWORD asadsd, DWORD asads3d);
|
|
|
|
|
|
typedef int(_cdecl _Get_Draw_This)(DWORD thisc);
|
|
|
|
|
|
|
|
|
|
|
|
static _Load_Npk* Load_Npk = (_Load_Npk*)0x11C0410;
|
|
|
|
|
|
static _Get_Img* Get_Img = (_Get_Img*)0x11AA190;
|
|
|
|
|
|
static _Draw_Img* Draw_Img = (_Draw_Img*)0x11A8F60;
|
|
|
|
|
|
static _Ex_Draw_Img* Ex_Draw_Img = (_Ex_Draw_Img*)0x11A97E0;
|
|
|
|
|
|
static _Ex_Draw_Num* Ex_Draw_Num = (_Ex_Draw_Num*)0x11b2390;
|
|
|
|
|
|
static _Ex_Draw_Init* Ex_Draw_Init = (_Ex_Draw_Init*)0x11B22C0;
|
|
|
|
|
|
static _Get_Draw_This* Get_Draw_This = (_Get_Draw_This*)0x11A5990;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//nutְҵ<D6B0><D2B5><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>
|
|
|
|
|
|
typedef char(_fastcall _Test)(int thisc, void*, int a2);
|
|
|
|
|
|
static _Test* Test = (_Test*)0x67e8e0;
|
|
|
|
|
|
|
|
|
|
|
|
//typedef char(_fastcall _TestB)(int thisc, void*, int a2,int a3);
|
|
|
|
|
|
//static _TestB* TestB = (_TestB*)0xC9DB40;
|
|
|
|
|
|
|
|
|
|
|
|
typedef char(_fastcall _TestB)(int thisc, void*, int SkillId);
|
|
|
|
|
|
static _TestB* TestB = (_TestB*)0x497900;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef void(_fastcall _120DDB0B)(BYTE* thisc);
|
|
|
|
|
|
static _120DDB0B* Old120DDB0B = (_120DDB0B*)0x120DDB0;
|
|
|
|
|
|
|
|
|
|
|
|
//ʹ<>ü<EFBFBD><C3BC><EFBFBD>
|
|
|
|
|
|
int sq_UseSkill(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Key_Value;
|
|
|
|
|
|
SQGetInt(v, 2, &Key_Value);
|
|
|
|
|
|
|
|
|
|
|
|
BYTE* thisc = (BYTE*)(*(DWORD*)(0x1B470E0));
|
|
|
|
|
|
thisc[269 + Key_Value] = 0x80;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int sq_Select_MiniMap_Index(uint32_t v) {
|
|
|
|
|
|
int ReIndex;
|
|
|
|
|
|
SQGetInt(v, 2, &ReIndex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int dnf_103E030 = 0x103E030;
|
|
|
|
|
|
static int dnf_287FA88 = 0x287FA88;
|
|
|
|
|
|
static int dnf_103DCD0 = 0x103DCD0;
|
|
|
|
|
|
static int dnf_103B240 = 0x103B240;
|
|
|
|
|
|
static int dnf_2878D95 = 0x2878D95;
|
|
|
|
|
|
static int dnf_1194FC0 = 0x1194FC0;
|
|
|
|
|
|
static int dnf_410230 = 0x410230;
|
|
|
|
|
|
static int dnf_102F4D0 = 0x102F4D0;
|
|
|
|
|
|
|
|
|
|
|
|
_asm
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
mov ecx, dword ptr ds : [0x1A5FB20]
|
|
|
|
|
|
mov esi, dword ptr ds : [ecx + 0x42DC]
|
|
|
|
|
|
push ReIndex
|
|
|
|
|
|
call dnf_103E030
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
|
|
call dnf_287FA88
|
|
|
|
|
|
push ReIndex
|
|
|
|
|
|
call dnf_103E030
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
|
|
call dnf_103DCD0
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
|
|
mov dword ptr ds : [esi + 0x24] , eax
|
|
|
|
|
|
call dnf_103B240
|
|
|
|
|
|
mov ecx, dword ptr ds : [esi + 0x24]
|
|
|
|
|
|
call dnf_2878D95
|
|
|
|
|
|
push 0x1556138
|
|
|
|
|
|
call dnf_1194FC0
|
|
|
|
|
|
mov ecx, eax
|
|
|
|
|
|
add esp, 4
|
|
|
|
|
|
lea edi, dword ptr ds : [ecx + 2]
|
|
|
|
|
|
dnf_1031651 :
|
|
|
|
|
|
mov dx, word ptr ds : [ecx]
|
|
|
|
|
|
add ecx, 2
|
|
|
|
|
|
test dx, dx
|
|
|
|
|
|
jne dnf_1031651
|
|
|
|
|
|
sub ecx, edi
|
|
|
|
|
|
sar ecx, 1
|
|
|
|
|
|
push ecx
|
|
|
|
|
|
push eax
|
|
|
|
|
|
lea ecx, dword ptr ds : [esi + 0x144]
|
|
|
|
|
|
call dnf_410230
|
|
|
|
|
|
//mov ecx, esi
|
|
|
|
|
|
//mov dword ptr ds : [esi + 0x28] , 14
|
|
|
|
|
|
//call dnf_102F4D0
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
|
|
|
|
|
|
struct InputWindowInfoS {
|
|
|
|
|
|
int x;
|
|
|
|
|
|
int y;
|
|
|
|
|
|
int width;
|
|
|
|
|
|
int height;
|
|
|
|
|
|
std::string str;
|
|
|
|
|
|
};
|
|
|
|
|
|
LRESULT CALLBACK LenheartCode(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2023-11-13 14:00:01 +08:00
|
|
|
|
{
|
2024-03-31 13:23:55 +08:00
|
|
|
|
HDC hdc;
|
|
|
|
|
|
PAINTSTRUCT ps;
|
|
|
|
|
|
RECT rect;
|
|
|
|
|
|
static int mX, mY;
|
|
|
|
|
|
static HWND hwndButton;
|
|
|
|
|
|
static HWND hwndEditbox;
|
|
|
|
|
|
std::string strXy;
|
|
|
|
|
|
const int IDcmdButton = 1;
|
|
|
|
|
|
const int IDeditBox = 2;
|
|
|
|
|
|
static InputWindowInfoS* WInfo;
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
switch (message) {
|
|
|
|
|
|
case WM_CREATE:
|
|
|
|
|
|
{
|
|
|
|
|
|
RECT rect;
|
|
|
|
|
|
GetWindowRect(hwnd, &rect); // <20><>ȡ<EFBFBD><C8A1><EFBFBD>ڵľ<DAB5><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݵIJ<DDB5><C4B2><EFBFBD>
|
|
|
|
|
|
CREATESTRUCT* pCreate = (CREATESTRUCT*)lParam;
|
|
|
|
|
|
WInfo = (InputWindowInfoS*)pCreate->lpCreateParams;
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
hwndEditbox = CreateWindowA("edit", NULL,
|
|
|
|
|
|
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
|
|
|
|
|
|
0, 0,
|
|
|
|
|
|
WInfo->width, WInfo->height,
|
|
|
|
|
|
hwnd, (HMENU)IDeditBox, NULL, NULL);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
ShowWindow(hwndEditbox, SW_SHOW);
|
|
|
|
|
|
UpdateWindow(hwndEditbox);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
HFONT hFont = CreateFont(13.5, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
|
|
|
|
|
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, TEXT("Fonts\\msjh.ttf"));
|
|
|
|
|
|
SendMessage(hwndEditbox, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
|
|
|
|
|
|
SetForegroundWindow(hwndEditbox);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ȥ
|
|
|
|
|
|
if (WInfo->str.length() > 0)SetWindowTextA(hwndEditbox, WInfo->str.c_str());
|
|
|
|
|
|
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int length = GetWindowTextLengthA(hwndEditbox);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>ı<EFBFBD>ĩβ
|
|
|
|
|
|
SendMessage(hwndEditbox, EM_SETSEL, length, length);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
case WM_CTLCOLOREDIT:
|
|
|
|
|
|
{
|
|
|
|
|
|
HDC ahdc = (HDC)wParam;
|
|
|
|
|
|
SetTextColor(ahdc, RGB(0, 0, 0));
|
|
|
|
|
|
//SetTextColor(ahdc, RGB(255, 255, 255));
|
|
|
|
|
|
SetBkMode(ahdc, TRANSPARENT); // <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><CDB8>
|
|
|
|
|
|
return (INT_PTR)GetStockObject(NULL_BRUSH); // <20><><EFBFBD>ؿջ<D8BF>ˢ
|
|
|
|
|
|
//return 0; //<2F><><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD><EFBFBD><EFBFBD>ˢʱ<CBA2><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>Ϊ<EFBFBD><CEAA>Ӧ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
|
}
|
|
|
|
|
|
case WM_PAINT:
|
|
|
|
|
|
{
|
|
|
|
|
|
hdc = BeginPaint(hwnd, &ps);
|
|
|
|
|
|
EndPaint(hwnd, &ps);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
case WM_SIZE:
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
|
|
switch (LOWORD(wParam)) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
PostQuitMessage(0);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case IDeditBox:
|
|
|
|
|
|
if (HIWORD(wParam) == EN_CHANGE) {
|
|
|
|
|
|
char strbuf[256];
|
|
|
|
|
|
// <20>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD>仯
|
|
|
|
|
|
GetWindowTextA(hwndEditbox, strbuf, 256);
|
|
|
|
|
|
//std::cout << strbuf << std::endl;
|
|
|
|
|
|
WInfo->str = strbuf;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (HIWORD(wParam) == EN_SETFOCUS) {
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (HIWORD(wParam) == EN_KILLFOCUS) {
|
|
|
|
|
|
DestroyWindow(hwnd); //<2F><><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD>
|
|
|
|
|
|
WInfo->str = "LenheartNULL";
|
|
|
|
|
|
//CREATESTRUCT* pCreate = (CREATESTRUCT*)lParam;
|
|
|
|
|
|
//delete[](InputWindowInfoS*)pCreate->lpCreateParams;
|
|
|
|
|
|
//pCreate->lpCreateParams = NULL;
|
|
|
|
|
|
//exit(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
case WM_MOUSEACTIVATE:
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case WM_CLOSE:
|
|
|
|
|
|
DestroyWindow(hwnd); //<2F><><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD>
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
|
|
PostQuitMessage(0);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LenheartWindows(LPVOID lpParam) {
|
|
|
|
|
|
|
|
|
|
|
|
HWND DNFW = FindWindow(L"DNF Taiwan", L"DNF Taiwan"); // <20>滻"Window Title"Ϊ<><CEAA>Ҫ<EFBFBD><D2AA><EFBFBD>ҵĴ<D2B5><C4B4>ڱ<EFBFBD><DAB1><EFBFBD>
|
|
|
|
|
|
RECT rect;
|
|
|
|
|
|
GetWindowRect(DNFW, &rect); // <20><>ȡ<EFBFBD><C8A1><EFBFBD>ڵľ<DAB5><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
InputWindowInfoS* WInfo = (InputWindowInfoS*)lpParam;
|
|
|
|
|
|
|
|
|
|
|
|
const wchar_t* className = L"myInputBoxClass";
|
|
|
|
|
|
HINSTANCE hInstance = GetModuleHandle(NULL);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
WNDCLASS wc = {};
|
|
|
|
|
|
wc.lpfnWndProc = LenheartCode;
|
|
|
|
|
|
wc.hInstance = hInstance;
|
|
|
|
|
|
wc.lpszClassName = className;
|
|
|
|
|
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
|
|
|
|
|
wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
|
|
|
|
|
|
//wc.hbrBackground = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
RegisterClass(&wc);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
HWND hwnd = CreateWindowEx(
|
|
|
|
|
|
0, className, L"Input Box",
|
|
|
|
|
|
WS_POPUP | WS_EX_TOOLWINDOW,
|
|
|
|
|
|
rect.left + WInfo->x, rect.top + WInfo->y, WInfo->width, WInfo->height,
|
|
|
|
|
|
NULL, NULL, hInstance, lpParam);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TOOLWINDOW);
|
|
|
|
|
|
SetLayeredWindowAttributes(hwnd, 0, 0, LWA_ALPHA);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ShowWindow(hwnd, SW_SHOW);
|
|
|
|
|
|
|
|
|
|
|
|
MSG msg;
|
|
|
|
|
|
while (GetMessage(&msg, NULL, 0, 0))
|
|
|
|
|
|
{
|
|
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
|
|
DispatchMessage(&msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int sq_NewInputBox(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
InputWindowInfoS* WInfo = new InputWindowInfoS();
|
|
|
|
|
|
SQGetInt(v, 2, &WInfo->x);
|
|
|
|
|
|
SQGetInt(v, 3, &WInfo->y);
|
|
|
|
|
|
SQGetInt(v, 4, &WInfo->width);
|
|
|
|
|
|
SQGetInt(v, 5, &WInfo->height);
|
|
|
|
|
|
wchar_t* Str;
|
|
|
|
|
|
SQGetString(v, 6, &Str);
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Str);
|
|
|
|
|
|
std::string RealStr = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
WInfo->str = RealStr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DWORD threadID3;
|
|
|
|
|
|
HANDLE Thand3 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LenheartWindows, WInfo, 0, &threadID3);
|
|
|
|
|
|
|
|
|
|
|
|
SQPushInt(v, (int)WInfo);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int sq_GetInputBoxStr(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Addr;
|
|
|
|
|
|
SQGetInt(v, 2, &Addr);
|
|
|
|
|
|
InputWindowInfoS* WInfo = (InputWindowInfoS*)Addr;
|
|
|
|
|
|
|
|
|
|
|
|
std::string str = WInfo->str;
|
|
|
|
|
|
char* ss = GBKTOUTF8(str);
|
|
|
|
|
|
//wchar_t* name = DNFTOOL::charTowchar_t((char*)Buf.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* aa = DNFTOOL::charTowchar_t(ss);
|
|
|
|
|
|
SQPushString(v, aa, -1);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int sq_SetInputBoxStr(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Addr;
|
|
|
|
|
|
SQGetInt(v, 2, &Addr);
|
|
|
|
|
|
wchar_t* Str;
|
|
|
|
|
|
SQGetString(v, 3, &Str);
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Str);
|
|
|
|
|
|
std::string RealStr = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
InputWindowInfoS* WInfo = (InputWindowInfoS*)Addr;
|
|
|
|
|
|
WInfo->str = RealStr;
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_Test(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦģʽ
|
|
|
|
|
|
typedef int(_cdecl _SetDrawImgModel)(int a1 , int a2);
|
|
|
|
|
|
static _SetDrawImgModel* SetDrawImgModel = (_SetDrawImgModel*)0x11A8A50;
|
|
|
|
|
|
//<2F><>ԭ<EFBFBD><D4AD>Ⱦģʽ
|
|
|
|
|
|
typedef int(_cdecl _ReleaseDrawImgModel)();
|
|
|
|
|
|
static _ReleaseDrawImgModel* ReleaseDrawImgModel = (_ReleaseDrawImgModel*)0x11A8B60;
|
|
|
|
|
|
|
|
|
|
|
|
int sq_SetDrawImgModel(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int M1;
|
|
|
|
|
|
SQGetInt(v, 2, &M1);
|
|
|
|
|
|
int M2;
|
|
|
|
|
|
SQGetInt(v, 3, &M2);
|
|
|
|
|
|
|
|
|
|
|
|
SetDrawImgModel(M1, M2);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sq_ReleaseDrawImgModel(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
ReleaseDrawImgModel();
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Img
|
|
|
|
|
|
int squirrel::sq_DrawImg(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Top = SQGetTop(v);
|
|
|
|
|
|
if (Top == 4) {
|
|
|
|
|
|
int imgbuf;
|
|
|
|
|
|
SQGetInt(v, 2, &imgbuf);
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 3, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 4, &Y);
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y, imgbuf);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (Top == 5)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* File;
|
|
|
|
|
|
SQGetString(v, 2, &File);
|
|
|
|
|
|
int Idx;
|
|
|
|
|
|
SQGetInt(v, 3, &Idx);
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 4, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 5, &Y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int npkbuf = Load_Npk(*(int*)0x1B4684C, 0, 0, File);
|
|
|
|
|
|
int imgbuf = Get_Img(npkbuf, 0, Idx);
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y, imgbuf);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Top == 6) {
|
|
|
|
|
|
wchar_t* File;
|
|
|
|
|
|
SQGetString(v, 2, &File);
|
|
|
|
|
|
int Value;
|
|
|
|
|
|
SQGetInt(v, 3, &Value);
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 4, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 5, &Y);
|
|
|
|
|
|
int rgba;
|
|
|
|
|
|
SQGetInt(v, 6, &rgba);
|
|
|
|
|
|
|
|
|
|
|
|
int thisc = Get_Draw_This(56);
|
|
|
|
|
|
int npkbuf = Load_Npk(*(int*)0x1B4684C, 0, 0, File);
|
|
|
|
|
|
int intibuf = Ex_Draw_Init(thisc, 0, *(int*)0x1B45B94, npkbuf, X, Y);//ƫ<>ƶ<EFBFBD><C6B6>ٵ<EFBFBD><D9B5><EFBFBD>ֵ -1 == 0 <20><><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB> - 1
|
|
|
|
|
|
*(int*)0x1A70190 = intibuf;
|
|
|
|
|
|
Ex_Draw_Num(intibuf, 0, 100, 100, Value, rgba, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Top == 9 || Top == 10) {
|
|
|
|
|
|
wchar_t* File;
|
|
|
|
|
|
SQGetString(v, 2, &File);
|
|
|
|
|
|
int Idx;
|
|
|
|
|
|
SQGetInt(v, 3, &Idx);
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 4, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 5, &Y);
|
|
|
|
|
|
int Model;
|
|
|
|
|
|
SQGetInt(v, 6, &Model);
|
|
|
|
|
|
int rgba;
|
|
|
|
|
|
SQGetInt(v, 7, &rgba);
|
|
|
|
|
|
|
|
|
|
|
|
int Xf;
|
|
|
|
|
|
SQGetFloat(v, 8, (FLOAT*) & Xf);
|
|
|
|
|
|
int Yf;
|
|
|
|
|
|
SQGetFloat(v, 9, (FLOAT*) & Yf);
|
|
|
|
|
|
|
|
|
|
|
|
int npkbuf = Load_Npk(*(int*)0x1B4684C, 0, 0, File);
|
|
|
|
|
|
int imgbuf = Get_Img(npkbuf, 0, Idx);
|
|
|
|
|
|
Ex_Draw_Img(*(int*)0x1B45B94, 0, X, Y, imgbuf, Xf, Yf, Model, rgba, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
typedef struct DamageFontInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
int Type[8][10];
|
|
|
|
|
|
|
|
|
|
|
|
} DamageFontInfo;
|
|
|
|
|
|
static DamageFontInfo MyFont = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_IntiNumberDraw(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* File;
|
|
|
|
|
|
SQGetString(v, 2, &File);
|
|
|
|
|
|
int Idx;
|
|
|
|
|
|
SQGetInt(v, 3, &Idx);
|
|
|
|
|
|
int Type;
|
|
|
|
|
|
SQGetInt(v, 4, &Type);
|
|
|
|
|
|
|
|
|
|
|
|
int npkbuf = Load_Npk(*(int*)0x1B4684C, 0, 0, File);
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < 10; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
int imgbuf = Get_Img(npkbuf, 0, Idx + i);
|
|
|
|
|
|
MyFont.Type[Type][i] = imgbuf;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
int squirrel::sq_DrawNumber(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 2, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 3, &Y);
|
|
|
|
|
|
int rgba;
|
|
|
|
|
|
SQGetInt(v, 4, &rgba);
|
|
|
|
|
|
|
|
|
|
|
|
int Xf;
|
|
|
|
|
|
SQGetFloat(v, 5, (FLOAT*)&Xf);
|
|
|
|
|
|
int Yf;
|
|
|
|
|
|
SQGetFloat(v, 6, (FLOAT*)&Yf);
|
|
|
|
|
|
int Type;
|
|
|
|
|
|
SQGetInt(v, 7, &Type);
|
|
|
|
|
|
int Interval;
|
|
|
|
|
|
SQGetInt(v, 8, &Interval);
|
|
|
|
|
|
int OneOffset;
|
|
|
|
|
|
SQGetInt(v, 9, &OneOffset);
|
|
|
|
|
|
int Number;
|
|
|
|
|
|
SQGetInt(v, 10, &Number);
|
|
|
|
|
|
|
|
|
|
|
|
std::string Value = std::to_string(Number);
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < Value.size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Idx = Value[i] - 48;
|
|
|
|
|
|
if (Idx == 1)Ex_Draw_Img(*(int*)0x1B45B94, 0, X + (i * Interval) + OneOffset, Y, MyFont.Type[Type][Idx], Xf, Yf, 0, rgba, 0, 0);
|
|
|
|
|
|
else Ex_Draw_Img(*(int*)0x1B45B94, 0, X + (i * Interval), Y, MyFont.Type[Type][Idx], Xf, Yf, 0, rgba, 0, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
//Ex_Draw_Img(*(int*)0x1B45B94, 0, X, Y, imgbuf, Xf, Yf, Model, rgba, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static std::map<std::string, int>LenheartCodeWidth;
|
|
|
|
|
|
|
|
|
|
|
|
int sq_GetStringDrawLength(uint32_t v) {
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* Str;
|
|
|
|
|
|
SQGetString(v, 2, &Str);
|
|
|
|
|
|
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Str);
|
|
|
|
|
|
std::string RealStr = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
if (!LenheartCodeWidth.count("0")) {
|
|
|
|
|
|
LenheartCodeWidth["0"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["1"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["2"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["3"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["4"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["5"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["6"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["7"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["8"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["9"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["z"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["y"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["x"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["w"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["v"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["u"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["t"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["s"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["r"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["q"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["p"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["o"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["n"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["m"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["l"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["k"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["j"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["i"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["h"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["g"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["f"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["e"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["d"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["c"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["b"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["a"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["A"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["B"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["C"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["D"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["E"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["F"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["G"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["H"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["I"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["J"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["K"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["L"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["M"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["N"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["O"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["P"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["Q"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["R"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["S"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["T"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["U"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["V"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["W"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["X"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["Y"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["Z"] = 7;
|
|
|
|
|
|
LenheartCodeWidth[","] = 4;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["."] = 3;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["!"] = 3;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["?"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 8;
|
|
|
|
|
|
LenheartCodeWidth[";"] = 3;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["["] = 5;
|
|
|
|
|
|
LenheartCodeWidth["]"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["{"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["}"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["("] = 5;
|
|
|
|
|
|
LenheartCodeWidth[")"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["\""] = 6;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["\""] = 4;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["+"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["-"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["*"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["/"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["="] = 8;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int L = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int StrTextLength = 0;
|
|
|
|
|
|
for (size_t i = 0; i < RealStr.length();)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cplen = 1;
|
|
|
|
|
|
if (RealStr[i] < 0)cplen = 2;
|
|
|
|
|
|
std::string c = RealStr.substr(i, cplen);
|
|
|
|
|
|
if (LenheartCodeWidth.count(c)) {
|
|
|
|
|
|
L += LenheartCodeWidth[c];
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
L += 13;
|
|
|
|
|
|
}
|
|
|
|
|
|
i += cplen;
|
|
|
|
|
|
StrTextLength++;
|
|
|
|
|
|
}
|
|
|
|
|
|
L -= StrTextLength;
|
|
|
|
|
|
|
|
|
|
|
|
SQPushInt(v, L);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sq_GetStringDrawArray(uint32_t v) {
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* Str;
|
|
|
|
|
|
SQGetString(v, 2, &Str);
|
|
|
|
|
|
|
|
|
|
|
|
int Len;
|
|
|
|
|
|
SQGetInt(v, 3, &Len);
|
|
|
|
|
|
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Str);
|
|
|
|
|
|
std::string RealStr = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
if (!LenheartCodeWidth.count("0")) {
|
|
|
|
|
|
LenheartCodeWidth["0"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["1"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["2"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["3"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["4"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["5"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["6"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["7"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["8"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["9"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["z"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["y"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["x"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["w"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["v"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["u"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["t"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["s"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["r"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["q"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["p"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["o"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["n"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["m"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["l"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["k"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["j"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["i"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["h"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["g"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["f"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["e"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["d"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["c"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["b"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["a"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["A"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["B"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["C"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["D"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["E"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["F"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["G"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["H"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["I"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["J"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["K"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["L"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["M"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["N"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["O"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["P"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["Q"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["R"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["S"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["T"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["U"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["V"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["W"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["X"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["Y"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["Z"] = 7;
|
|
|
|
|
|
LenheartCodeWidth[","] = 4;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["."] = 3;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 6;
|
|
|
|
|
|
LenheartCodeWidth["!"] = 3;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["?"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 8;
|
|
|
|
|
|
LenheartCodeWidth[";"] = 3;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["["] = 5;
|
|
|
|
|
|
LenheartCodeWidth["]"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["{"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["}"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["("] = 5;
|
|
|
|
|
|
LenheartCodeWidth[")"] = 5;
|
|
|
|
|
|
LenheartCodeWidth["\""] = 6;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["\""] = 4;
|
|
|
|
|
|
LenheartCodeWidth["<EFBFBD><EFBFBD>"] = 4;
|
|
|
|
|
|
LenheartCodeWidth["+"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["-"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["*"] = 7;
|
|
|
|
|
|
LenheartCodeWidth["/"] = 8;
|
|
|
|
|
|
LenheartCodeWidth["="] = 8;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string>StrBuf;
|
|
|
|
|
|
|
|
|
|
|
|
int StrTextLength = 0;
|
|
|
|
|
|
for (size_t i = 0; i < RealStr.length();)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cplen = 1;
|
|
|
|
|
|
if (RealStr[i] < 0)cplen = 2;
|
|
|
|
|
|
std::string c = RealStr.substr(i, cplen);
|
|
|
|
|
|
|
|
|
|
|
|
StrBuf.push_back(c);
|
|
|
|
|
|
i += cplen;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string>PushStrBuf;
|
|
|
|
|
|
std::string Ostr = "";
|
|
|
|
|
|
for (unsigned int i = 0; i < StrBuf.size(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
int AddLen = 0;
|
|
|
|
|
|
if (LenheartCodeWidth.count(StrBuf[i])) {
|
|
|
|
|
|
AddLen = LenheartCodeWidth[StrBuf[i]];
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
AddLen = 13;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
if (AddLen + StrTextLength > Len) {
|
|
|
|
|
|
PushStrBuf.push_back(Ostr);
|
|
|
|
|
|
StrTextLength = AddLen;
|
|
|
|
|
|
Ostr = StrBuf[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
Ostr += StrBuf[i];
|
|
|
|
|
|
StrTextLength += AddLen;
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
|
if (i == StrBuf.size() - 1) {
|
|
|
|
|
|
PushStrBuf.push_back(Ostr);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sq_newarray((HSQUIRRELVM)v, 0);
|
|
|
|
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < PushStrBuf.size(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string Buf = PushStrBuf[i];
|
|
|
|
|
|
char* ss = GBKTOUTF8(Buf);
|
|
|
|
|
|
//wchar_t* name = DNFTOOL::charTowchar_t((char*)Buf.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* aa = DNFTOOL::charTowchar_t(ss);
|
|
|
|
|
|
//wchar_t* aa = DNFTOOL::SquirrelW2W(ss);
|
|
|
|
|
|
SQPushString(v, aa, -1);
|
|
|
|
|
|
|
|
|
|
|
|
sq_arrayappend((HSQUIRRELVM)v, -2);
|
|
|
|
|
|
//delete[]ss;
|
|
|
|
|
|
//delete[]name;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//sq_newarray(v, 3);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sq_DrawWindow(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Top = SQGetTop(v);
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 2, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 3, &Y);
|
|
|
|
|
|
int WindowWidth;
|
|
|
|
|
|
SQGetInt(v, 4, &WindowWidth);
|
|
|
|
|
|
int WindowHeight;
|
|
|
|
|
|
SQGetInt(v, 5, &WindowHeight);
|
|
|
|
|
|
|
|
|
|
|
|
//·<><C2B7>
|
|
|
|
|
|
wchar_t* File = L"interface/windowcommon.img";
|
|
|
|
|
|
int StartIdx = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int leftWidth = 11;//<2F><><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>ƴ<EFBFBD>ӵĿ<D3B5><C4BF><EFBFBD>
|
|
|
|
|
|
int centerWidth = 12;//<2F>м䲿<D0BC><E4B2BF>ƴ<EFBFBD>ӵĿ<D3B5><C4BF><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
int topHeight = 11;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD>ӵĸ߶<C4B8>
|
|
|
|
|
|
int centerHeight = 13;//<2F>м䲿<D0BC><E4B2BF>ƴ<EFBFBD>ӵĸ߶<C4B8>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Top == 11) {
|
|
|
|
|
|
wchar_t* bFile;
|
|
|
|
|
|
SQGetString(v, 6, &bFile);
|
|
|
|
|
|
int Idx;
|
|
|
|
|
|
SQGetInt(v, 7, &Idx);
|
|
|
|
|
|
File = bFile;
|
|
|
|
|
|
StartIdx = Idx;
|
|
|
|
|
|
|
|
|
|
|
|
SQGetInt(v, 8, &leftWidth);
|
|
|
|
|
|
SQGetInt(v, 9, ¢erWidth);
|
|
|
|
|
|
SQGetInt(v, 10, &topHeight);
|
|
|
|
|
|
SQGetInt(v, 11, ¢erHeight);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int widthCount = round(WindowWidth / centerWidth);
|
|
|
|
|
|
int heightCount = round(WindowHeight / centerWidth);
|
|
|
|
|
|
|
|
|
|
|
|
int npkbuf = Load_Npk(*(int*)0x1B4684C, 0, 0, File);
|
|
|
|
|
|
int leftTopFrame = Get_Img(npkbuf, 0, 0 + StartIdx);
|
|
|
|
|
|
int topCenterFrame = Get_Img(npkbuf, 0, 1 + StartIdx);
|
|
|
|
|
|
int rightTopFrame = Get_Img(npkbuf, 0, 2 + StartIdx);
|
|
|
|
|
|
int leftCenterFrame = Get_Img(npkbuf, 0, 3 + StartIdx);
|
|
|
|
|
|
int centerFrame = Get_Img(npkbuf, 0, 4 + StartIdx);
|
|
|
|
|
|
int rightCenterFrame = Get_Img(npkbuf, 0, 5 + StartIdx);
|
|
|
|
|
|
int leftBottomFrame = Get_Img(npkbuf, 0, 6 + StartIdx);
|
|
|
|
|
|
int centerBottomFrame = Get_Img(npkbuf, 0, 7 + StartIdx);
|
|
|
|
|
|
int rightBottomFrame = Get_Img(npkbuf, 0, 8 + StartIdx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y, leftTopFrame);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < widthCount; i++) {
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * i, Y, topCenterFrame);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * widthCount, Y, rightTopFrame);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ƴ<><C6B4><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>沿<EFBFBD>ֵ<EFBFBD>
|
|
|
|
|
|
//jΪ<6A><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵڼ<C4B5><DABC><EFBFBD>
|
|
|
|
|
|
for (int j = 0; j < heightCount; j++) {
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y + topHeight + centerHeight * j, leftCenterFrame);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵIJ<DFB5><C4B2><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y + topHeight + centerHeight * heightCount, leftBottomFrame);
|
|
|
|
|
|
//<2F><><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĹս<C4B9>
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
|
for (int i = 0; i < widthCount; i++) {
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * i, Y + topHeight + centerHeight * j, centerFrame);
|
|
|
|
|
|
if (j == 0)
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * i, Y + topHeight + centerHeight * heightCount, centerBottomFrame);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * widthCount, Y + topHeight + centerHeight * j, rightCenterFrame);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұߵIJ<DFB5><C4B2><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * widthCount, Y + topHeight + centerHeight * heightCount, rightBottomFrame);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սǴ<D5BD>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (heightCount == 0) {
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y + topHeight + centerHeight * heightCount, leftBottomFrame);
|
|
|
|
|
|
for (int i = 0; i < widthCount; i++) {
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * i, Y + topHeight + centerHeight * heightCount, centerBottomFrame);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + leftWidth + centerWidth * widthCount, Y + topHeight + centerHeight * heightCount, rightBottomFrame);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>սǴ<D5BD>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int sq_DrawButton(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Top = SQGetTop(v);
|
|
|
|
|
|
int X;
|
|
|
|
|
|
SQGetInt(v, 2, &X);
|
|
|
|
|
|
int Y;
|
|
|
|
|
|
SQGetInt(v, 3, &Y);
|
|
|
|
|
|
int WindowWidth;
|
|
|
|
|
|
SQGetInt(v, 4, &WindowWidth);
|
|
|
|
|
|
wchar_t* File;
|
|
|
|
|
|
SQGetString(v, 5, &File);
|
|
|
|
|
|
int StartIdx;
|
|
|
|
|
|
SQGetInt(v, 6, &StartIdx);
|
2024-03-31 13:23:55 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int FillWidth;
|
|
|
|
|
|
SQGetInt(v, 7, &FillWidth);
|
|
|
|
|
|
//<2F>ڿ<D7BD><DABF><EFBFBD>
|
|
|
|
|
|
int FirstWidth;
|
|
|
|
|
|
SQGetInt(v, 8, &FirstWidth);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
int widthCount = round(WindowWidth / 2);
|
|
|
|
|
|
|
|
|
|
|
|
int npkbuf = Load_Npk(*(int*)0x1B4684C, 0, 0, File);
|
|
|
|
|
|
int leftFrame = Get_Img(npkbuf, 0, 0 + StartIdx);
|
|
|
|
|
|
int CenterFrame = Get_Img(npkbuf, 0, 1 + StartIdx);
|
|
|
|
|
|
int rightFrame = Get_Img(npkbuf, 0, 2 + StartIdx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X, Y, leftFrame);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < widthCount; i++) {
|
2024-03-31 13:23:55 +08:00
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + FirstWidth + FillWidth * i, Y, CenterFrame);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
Draw_Img(*(int*)0x1B45B94, 0, X + FirstWidth + FillWidth * widthCount, Y, rightFrame);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string& ReplaceAll(std::string& str, const std::string& src, const std::string& dst) {
|
|
|
|
|
|
std::string::size_type pos(0);
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
if ((pos = str.find(src)) != std::string::npos) {
|
|
|
|
|
|
str.replace(pos, src.length(), dst);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return str;
|
|
|
|
|
|
}
|
|
|
|
|
|
int DecondeJson(uint32_t v) {
|
|
|
|
|
|
wchar_t* OutPutBuffer;
|
|
|
|
|
|
SQGetString(v, 2, &OutPutBuffer);
|
|
|
|
|
|
//char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer);
|
|
|
|
|
|
char* OutPutText = DNFTOOL::wchar_tTochar(OutPutBuffer);
|
|
|
|
|
|
std::string str = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
size_t pos = 0;
|
|
|
|
|
|
bool Ars = false;
|
|
|
|
|
|
while ((pos = str.find("\"", pos)) != std::string::npos) {
|
|
|
|
|
|
// <20>ж<EFBFBD>˫<EFBFBD><CBAB><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Key<65><79>λ<EFBFBD><CEBB>
|
|
|
|
|
|
if (pos > 0) {
|
|
|
|
|
|
if (str[pos - 1] == '[') {
|
|
|
|
|
|
Ars = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if ((str[pos - 1] == '{' || str[pos + 1] == ':' || str[pos - 1] == ',') && !Ars) {
|
|
|
|
|
|
// ɾ<><C9BE>˫<EFBFBD><CBAB><EFBFBD><EFBFBD>
|
|
|
|
|
|
str.erase(pos, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
pos++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (str[pos] == ']') {
|
|
|
|
|
|
Ars = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
pos++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
str = ReplaceAll(str, ":", "=");
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* ss = DNFTOOL::charTowchar_t((char*)str.c_str());
|
|
|
|
|
|
SQPushString(v, ss, -1);
|
|
|
|
|
|
delete[]ss;
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
std::string EncodeARRAY(HSQUIRRELVM v, std::string Jso);
|
|
|
|
|
|
std::string EncodeTABLE(HSQUIRRELVM v, std::string Jso);
|
|
|
|
|
|
|
|
|
|
|
|
std::string EncodeARRAY(HSQUIRRELVM v, std::string Jso) {
|
|
|
|
|
|
Jso += "[";
|
|
|
|
|
|
|
|
|
|
|
|
sq_pushnull((HSQUIRRELVM)v); // null iterator
|
|
|
|
|
|
while (SQ_SUCCEEDED(sq_next((HSQUIRRELVM)v, -2)))
|
|
|
|
|
|
{
|
|
|
|
|
|
//const SQChar* Key;
|
|
|
|
|
|
//sq_getstring((HSQUIRRELVM)v, -2, &Key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//char* OutPutText = DNFTOOL::SquirrelU2W(Key);
|
|
|
|
|
|
//std::string str = OutPutText;
|
|
|
|
|
|
//delete[]OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
//Jso += "\"";
|
|
|
|
|
|
//Jso += str;
|
|
|
|
|
|
//Jso += "\"";
|
|
|
|
|
|
//Jso += ":";
|
|
|
|
|
|
|
|
|
|
|
|
SQObjectType Type = sq_gettype((HSQUIRRELVM)v, -1);
|
|
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case OT_INTEGER: {
|
|
|
|
|
|
SQInteger value;
|
|
|
|
|
|
sq_getinteger(v, -1, &value);
|
|
|
|
|
|
Jso += std::to_string(value);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_FLOAT:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQFloat value;
|
|
|
|
|
|
sq_getfloat(v, -1, &value);
|
|
|
|
|
|
Jso += std::to_string(value);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_BOOL:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQBool value;
|
|
|
|
|
|
sq_getbool(v, -1, &value);
|
|
|
|
|
|
Jso += std::to_string(value);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_STRING:
|
|
|
|
|
|
{
|
|
|
|
|
|
const SQChar* value;
|
|
|
|
|
|
sq_getstring((HSQUIRRELVM)v, -1, &value);
|
|
|
|
|
|
|
|
|
|
|
|
char* vOutPutText = DNFTOOL::SquirrelU2W(value);
|
|
|
|
|
|
std::string vstr = vOutPutText;
|
|
|
|
|
|
delete[]vOutPutText;
|
|
|
|
|
|
Jso += "\"";
|
|
|
|
|
|
Jso += vstr;
|
|
|
|
|
|
Jso += "\"";
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_TABLE:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQInteger Top = sq_gettop(v);
|
|
|
|
|
|
SQObject obj;
|
|
|
|
|
|
sq_getstackobj(v, -1, &obj);
|
|
|
|
|
|
sq_pushobject(v, obj);
|
|
|
|
|
|
Jso = EncodeTABLE(v, Jso);
|
|
|
|
|
|
sq_settop(v, Top);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_ARRAY:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQInteger Top = sq_gettop(v);
|
|
|
|
|
|
SQObject obj;
|
|
|
|
|
|
sq_getstackobj(v, -1, &obj);
|
|
|
|
|
|
sq_pushobject(v, obj);
|
|
|
|
|
|
Jso = EncodeARRAY(v, Jso);
|
|
|
|
|
|
sq_settop(v, Top);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>-1<><31>ֵ<EFBFBD><D6B5>-2<>Ǽ<EFBFBD>
|
|
|
|
|
|
sq_pop((HSQUIRRELVM)v, 2); //<2F><><EFBFBD><EFBFBD>һ<EFBFBD>ε<EFBFBD><CEB5><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
}
|
|
|
|
|
|
sq_pop((HSQUIRRELVM)v, 1); //<2F><><EFBFBD><EFBFBD>һ<EFBFBD>ε<EFBFBD><CEB5><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
Jso = Jso.substr(0, Jso.length() - 1);
|
|
|
|
|
|
Jso += "]";
|
|
|
|
|
|
return Jso;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string EncodeTABLE(HSQUIRRELVM v,std::string Jso) {
|
|
|
|
|
|
|
|
|
|
|
|
Jso += "{";
|
|
|
|
|
|
|
|
|
|
|
|
sq_pushnull((HSQUIRRELVM)v); // null iterator
|
|
|
|
|
|
while (SQ_SUCCEEDED(sq_next((HSQUIRRELVM)v, -2)))
|
|
|
|
|
|
{
|
|
|
|
|
|
const SQChar* Key;
|
|
|
|
|
|
sq_getstring((HSQUIRRELVM)v, -2, &Key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Key);
|
|
|
|
|
|
std::string str = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
Jso += "\"";
|
|
|
|
|
|
Jso += str;
|
|
|
|
|
|
Jso += "\"";
|
|
|
|
|
|
Jso += ":";
|
|
|
|
|
|
|
|
|
|
|
|
SQObjectType Type = sq_gettype((HSQUIRRELVM)v, -1);
|
|
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case OT_INTEGER: {
|
|
|
|
|
|
SQInteger value;
|
|
|
|
|
|
sq_getinteger(v, -1, &value);
|
|
|
|
|
|
Jso += std::to_string(value);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_FLOAT:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQFloat value;
|
|
|
|
|
|
sq_getfloat(v, -1, &value);
|
|
|
|
|
|
Jso += std::to_string(value);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_BOOL:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQBool value;
|
|
|
|
|
|
sq_getbool(v, -1, &value);
|
|
|
|
|
|
Jso += std::to_string(value);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_STRING:
|
|
|
|
|
|
{
|
|
|
|
|
|
const SQChar* value;
|
|
|
|
|
|
sq_getstring((HSQUIRRELVM)v, -1, &value);
|
|
|
|
|
|
|
|
|
|
|
|
char* vOutPutText = DNFTOOL::SquirrelU2W(value);
|
|
|
|
|
|
std::string vstr = vOutPutText;
|
|
|
|
|
|
delete[]vOutPutText;
|
|
|
|
|
|
Jso += "\"";
|
|
|
|
|
|
Jso += vstr;
|
|
|
|
|
|
Jso += "\"";
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_TABLE:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQInteger Top = sq_gettop(v);
|
|
|
|
|
|
SQObject obj;
|
|
|
|
|
|
sq_getstackobj(v, -1, &obj);
|
|
|
|
|
|
sq_pushobject(v, obj);
|
|
|
|
|
|
Jso = EncodeTABLE(v, Jso);
|
|
|
|
|
|
sq_settop(v, Top);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_ARRAY:
|
|
|
|
|
|
{
|
|
|
|
|
|
SQInteger Top = sq_gettop(v);
|
|
|
|
|
|
SQObject obj;
|
|
|
|
|
|
sq_getstackobj(v, -1, &obj);
|
|
|
|
|
|
sq_pushobject(v, obj);
|
|
|
|
|
|
Jso = EncodeARRAY(v, Jso);
|
|
|
|
|
|
sq_settop(v, Top);
|
|
|
|
|
|
Jso += ",";
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>-1<><31>ֵ<EFBFBD><D6B5>-2<>Ǽ<EFBFBD>
|
|
|
|
|
|
sq_pop((HSQUIRRELVM)v, 2); //<2F><><EFBFBD><EFBFBD>һ<EFBFBD>ε<EFBFBD><CEB5><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
}
|
|
|
|
|
|
sq_pop((HSQUIRRELVM)v, 1); //<2F><><EFBFBD><EFBFBD>һ<EFBFBD>ε<EFBFBD><CEB5><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
Jso = Jso.substr(0, Jso.length() - 1);
|
|
|
|
|
|
Jso += "}";
|
|
|
|
|
|
return Jso;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int EncondeJson(uint32_t v) {
|
|
|
|
|
|
|
|
|
|
|
|
std::string Jso = "";
|
|
|
|
|
|
std::string RealJso = EncodeTABLE((HSQUIRRELVM) v, Jso);
|
|
|
|
|
|
char* sbuf = GBKTOUTF8(RealJso);
|
|
|
|
|
|
wchar_t* ss = DNFTOOL::charTowchar_t(sbuf);
|
|
|
|
|
|
SQPushString(v, ss, -1);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
int sq_IsKeyDown(uint32_t v) {
|
|
|
|
|
|
|
|
|
|
|
|
int KeyCode;
|
|
|
|
|
|
SQGetInt(v, 2, &KeyCode);
|
|
|
|
|
|
|
|
|
|
|
|
if (KEY_DOWN(KeyCode)) {
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>IMG֡
|
|
|
|
|
|
//preloadnpk(*(int*)0x1b4684c,img,0)
|
|
|
|
|
|
//getimg(preloadnpk, ֡)
|
|
|
|
|
|
//huizhi(*(int*)1B45B94,x,y, getimg)
|
|
|
|
|
|
|
2023-04-14 14:56:01 +08:00
|
|
|
|
//<2F><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>Call
|
|
|
|
|
|
typedef int _E49DB0();
|
|
|
|
|
|
static _E49DB0* FuncE49DB0 = (_E49DB0*)0xE49DB0;
|
|
|
|
|
|
int squirrel::sq_Switching(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
DWORD V2 = FuncE49DB0();
|
|
|
|
|
|
SQPushInt(v, V2);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
typedef int __fastcall sub_TTTTT(int a1,int a2,int a3);
|
|
|
|
|
|
static sub_TTTTT* Funcsub_GetSkillAddress = (sub_TTTTT*)0x8406C0;
|
|
|
|
|
|
int squirrel::sq_GetSkillAddress(uint32_t v)
|
2022-11-06 23:12:18 +08:00
|
|
|
|
{
|
2023-11-13 14:00:01 +08:00
|
|
|
|
int SkillId;
|
|
|
|
|
|
SQGetInt(v, 2, &SkillId);
|
|
|
|
|
|
DWORD ADDRESS = Funcsub_GetSkillAddress(*(int*)0x1AB7CDC,0, SkillId);
|
|
|
|
|
|
SQPushInt(v, ADDRESS);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef void(_fastcall _DrawSkill)(int a1, int seat, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11);
|
|
|
|
|
|
static _DrawSkill* DrawSkill = (_DrawSkill*)0x909d70;
|
|
|
|
|
|
int sq_DrawSkill(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int a1, x, y, a4, a5, a6, a7, a8, a9,a10,a11;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//a1<61><31><EFBFBD>ܵ<EFBFBD>ַ
|
|
|
|
|
|
SQGetInt(v, 2, &a1);
|
|
|
|
|
|
|
|
|
|
|
|
SQGetInt(v, 3, &x);
|
|
|
|
|
|
SQGetInt(v, 4, &y);
|
|
|
|
|
|
|
|
|
|
|
|
SQGetInt(v, 5, &a4);
|
|
|
|
|
|
SQGetInt(v, 6, &a5);
|
|
|
|
|
|
SQGetInt(v, 7, &a6);
|
|
|
|
|
|
SQGetInt(v, 8, &a7);
|
|
|
|
|
|
SQGetInt(v, 9, &a8);
|
|
|
|
|
|
SQGetInt(v, 10, &a9);
|
|
|
|
|
|
SQGetInt(v, 11, &a10);
|
|
|
|
|
|
|
|
|
|
|
|
DrawSkill(a1,0,*(int*)0x1AB7CDC,x,y,a4,a5,a6,a7,a8,a9,a10);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_GetPlayerEachName(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int objNameAddress = *(int*)(0x1ade0e0);
|
|
|
|
|
|
char* str = DNFTOOL::UnicodeToUtf8((wchar_t*)(objNameAddress + 0x20));
|
|
|
|
|
|
wchar_t* name = DNFTOOL::charTowchar_t(str);
|
|
|
|
|
|
free(str);
|
|
|
|
|
|
SQPushString(v, name, -1);
|
|
|
|
|
|
delete[]name;
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
2023-05-12 16:08:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_OpenConsole(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* OutPutBuffer;
|
|
|
|
|
|
SQGetString(v, 2, &OutPutBuffer);
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer);
|
|
|
|
|
|
|
|
|
|
|
|
AllocConsole();
|
|
|
|
|
|
SetConsoleTitleA(OutPutText);
|
|
|
|
|
|
//SetConsoleOutputCP(65001);
|
|
|
|
|
|
freopen(("CONOUT$"), ("w"), stdout);
|
|
|
|
|
|
freopen(("CONOUT$"), ("w"), stderr);
|
|
|
|
|
|
freopen(("CONIN$"), ("r"), stdin);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
2023-04-14 14:56:01 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_MoveMap(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int dct;
|
|
|
|
|
|
SQGetInt(v, 2, &dct);
|
|
|
|
|
|
DWORD Address1 = 0x1A5FB18;
|
|
|
|
|
|
DWORD Address2 = 0x7CE9E0;
|
|
|
|
|
|
_asm
|
|
|
|
|
|
{
|
|
|
|
|
|
mov ecx, [Address1]
|
|
|
|
|
|
mov ecx, [ecx]
|
|
|
|
|
|
mov ecx, [ecx + 0x20a050]
|
|
|
|
|
|
mov ecx, [ecx + 0x4c]
|
|
|
|
|
|
push 0x1
|
|
|
|
|
|
push 0x1
|
|
|
|
|
|
push 0x0
|
|
|
|
|
|
push 0x0
|
|
|
|
|
|
push 0x0
|
|
|
|
|
|
push 0x0
|
|
|
|
|
|
push 0x0
|
|
|
|
|
|
push dct
|
|
|
|
|
|
call Address2
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::Sout(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Top = SQGetTop(v);
|
|
|
|
|
|
if (Top <= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQ_Throwerror(v, L"Incorrect function argument");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wchar_t* OutPutBuffer;
|
|
|
|
|
|
SQGetString(v, 2, &OutPutBuffer);
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer);
|
2022-02-26 19:07:14 +08:00
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
std::vector<std::string> Data;
|
|
|
|
|
|
DNFTOOL::Split(OutPutText, Data, "%L");
|
|
|
|
|
|
delete []OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
if (Top != Data.size() + 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQ_Throwerror(v, L"Incorrect function argument");
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t Fnum = Data.size();
|
|
|
|
|
|
if (Fnum > 1)Fnum -= 1;
|
|
|
|
|
|
std::string Text = "";
|
|
|
|
|
|
for (size_t i = 0; i < Fnum; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string Parameter;
|
|
|
|
|
|
//<2F><>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ValueType = SQ_GetType(v, 3 + i);
|
|
|
|
|
|
//<2F>ж<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
|
switch (ValueType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case OT_INTEGER://int<6E><74><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
int Value;
|
|
|
|
|
|
SQGetInt(v, 3 + i, &Value);
|
|
|
|
|
|
Parameter = std::to_string(Value);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case OT_FLOAT://float<61><74><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
FLOAT Value;
|
|
|
|
|
|
SQGetFloat(v, 3 + i, &Value);
|
|
|
|
|
|
std::ostringstream oss;
|
|
|
|
|
|
oss << Value;
|
|
|
|
|
|
std::string str(oss.str());
|
|
|
|
|
|
Parameter = str;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case OT_BOOL://bool<6F><6C><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
BOOL Value;
|
|
|
|
|
|
SQGetBool(v, 3 + i, &Value);
|
|
|
|
|
|
switch (Value)
|
|
|
|
|
|
{
|
|
|
|
|
|
case true:
|
|
|
|
|
|
Parameter = "true";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case false:
|
|
|
|
|
|
Parameter = "false";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
//Parameter = std::to_string(Value);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case OT_STRING://string<6E><67><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* Value;
|
|
|
|
|
|
SQGetString(v, 3 + i, &Value);
|
|
|
|
|
|
char* str = DNFTOOL::SquirrelU2W(Value);
|
|
|
|
|
|
Parameter = str;
|
|
|
|
|
|
delete []str;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
Parameter = " ";
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
Text += Data[i];
|
|
|
|
|
|
Text += Parameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
std::cout << Text << std::endl;
|
2022-04-11 19:44:03 +08:00
|
|
|
|
return 0;
|
2022-02-13 10:09:55 +08:00
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
int squirrel::Clock(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, clock());
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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-09-06 00:08:26 +08:00
|
|
|
|
int TValue = *(int*)(CharAddr+DNFTOOL::GetEquAddr(n2));
|
2022-02-10 14:14:08 +08:00
|
|
|
|
int SValue = (TValue + n1);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
if(SValue < 0x400000)
|
|
|
|
|
|
SQPushInt(v, 0);
|
|
|
|
|
|
else if (n1 != 0x8 && n1 != 0x1C && n1 != 0xF4 && n1 != 0x854)
|
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);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
if (SValue < 0x400000)
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
else 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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -1);
|
|
|
|
|
|
}
|
2022-03-27 17:17:12 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -1);
|
|
|
|
|
|
}
|
2022-03-27 17:17:12 +08:00
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-02-10 14:14:08 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
typedef int(_fastcall _9166B0)(int a1, int seat);
|
|
|
|
|
|
static _9166B0* GetSp = (_9166B0*)0x9166B0;
|
|
|
|
|
|
//<2F><>ȡsp<73><70>
|
|
|
|
|
|
static int sq_GetSp(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Type;
|
|
|
|
|
|
|
|
|
|
|
|
int num = SQGetTop(v);
|
|
|
|
|
|
if (num == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, GetSp(NULL,0));
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -1);
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-06 09:58:47 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
typedef int(_61A5F0)();
|
|
|
|
|
|
static _61A5F0* GetPass = (_61A5F0*)0x61A5F0;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡð<C8A1><C3B0><EFBFBD>ŵȼ<C5B5>
|
|
|
|
|
|
static int sq_GetPassLevel(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Passobj = GetPass();
|
|
|
|
|
|
int l = *(int*)Passobj;
|
|
|
|
|
|
SQPushInt(v, l);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef int(_fastcall _4DE680)(int a1, int seat);
|
|
|
|
|
|
static _4DE680* RefreshEventIcon = (_4DE680*)0x4DE680;
|
|
|
|
|
|
//ˢ<>»ͼ<EEB6AF><CDBC>
|
|
|
|
|
|
static int sq_RefreshEventIcon(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
RefreshEventIcon(0x01A39B78,0);
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
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;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
int num = SQGetTop(v);
|
|
|
|
|
|
if (num == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQGetInt(v, 2, &n1);
|
|
|
|
|
|
_SendpacksType(*_SendClass, 0, n1);
|
2022-02-10 14:14:08 +08:00
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -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;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
int num = SQGetTop(v);
|
|
|
|
|
|
if (num == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQGetInt(v, 2, &n1);
|
|
|
|
|
|
_SendPacksByte(*_SendClass, 0, n1);
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -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;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
int num = SQGetTop(v);
|
|
|
|
|
|
if (num == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQGetInt(v, 2, &n1);
|
|
|
|
|
|
_SendPacksWord(*_SendClass, 0, n1);
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -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;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
int num = SQGetTop(v);
|
|
|
|
|
|
if (num == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQGetInt(v, 2, &n1);
|
|
|
|
|
|
_SendPacksDWord(*_SendClass, 0, n1);
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushString(v, L"parameter error", -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;
|
2022-02-14 23:35:11 +08:00
|
|
|
|
int num = SQGetTop(v);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
if (num == 2)
|
2022-02-13 10:09:55 +08:00
|
|
|
|
{
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQGetString(v, 2, &n1);
|
|
|
|
|
|
//wchar_t* ת char*
|
|
|
|
|
|
char* fname = DNFTOOL::wchar_tTochar(n1);
|
|
|
|
|
|
_SendPacksChar(*_SendClass, 0, fname, strlen(fname));
|
|
|
|
|
|
delete []fname;
|
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-09-06 00:08:26 +08:00
|
|
|
|
SQPushString(v, L"parameter error", -1);
|
2022-02-13 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::SendPack(uint32_t v)
|
2022-02-13 10:09:55 +08:00
|
|
|
|
{
|
2022-02-14 23:35:11 +08:00
|
|
|
|
int num = SQGetTop(v);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
if (num == 1)
|
2022-02-13 10:09:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
_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-09-06 00:08:26 +08:00
|
|
|
|
SQPushString(v, L"parameter error", -1);
|
2022-02-13 10:09:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
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-09-06 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
//<2F>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
#if defined ADDRESS_API_SWITCH
|
|
|
|
|
|
//<2F><><EFBFBD>ڴ<EFBFBD>
|
|
|
|
|
|
int squirrel::LReadAddress(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F>ڴ<EFBFBD><DAB4><EFBFBD>ַ int<6E><74>
|
|
|
|
|
|
int Address;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
|
if (ParameterNum == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ParameterType = SQ_GetType(v, 2);
|
|
|
|
|
|
|
|
|
|
|
|
switch (ParameterType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case OT_INTEGER://int<6E><74><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ַ
|
|
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
int Value = *(int*)Address;
|
|
|
|
|
|
SQPushInt(v, Value);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case OT_STRING://String<6E><67><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ParameterNum == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ַ
|
|
|
|
|
|
int Address;
|
|
|
|
|
|
//ƫ<><C6AB>
|
|
|
|
|
|
wchar_t* offset;
|
|
|
|
|
|
|
|
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
SQGetString(v,3,&offset);
|
|
|
|
|
|
|
|
|
|
|
|
int Value = DNFTOOL::GetHook(Address, DNFTOOL::wchar_tTochar(offset));
|
|
|
|
|
|
SQPushInt(v, Value);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2024-03-31 13:23:55 +08:00
|
|
|
|
//<2F><><EFBFBD>ڴ<EFBFBD>
|
|
|
|
|
|
int LReadAddressB(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F>ڴ<EFBFBD><DAB4><EFBFBD>ַ int<6E><74>
|
|
|
|
|
|
int Address;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
|
if (ParameterNum == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ַ
|
|
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
int Value = *(BYTE*)Address;
|
|
|
|
|
|
SQPushInt(v, Value);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ParameterNum == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
////<2F><>ַ
|
|
|
|
|
|
//int Address;
|
|
|
|
|
|
////ƫ<><C6AB>
|
|
|
|
|
|
//wchar_t* offset;
|
|
|
|
|
|
|
|
|
|
|
|
//SQGetInt(v, 2, &Address);
|
|
|
|
|
|
//SQGetString(v, 3, &offset);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
//int Value = DNFTOOL::GetHook(Address, DNFTOOL::wchar_tTochar(offset));
|
|
|
|
|
|
//SQPushInt(v, Value);
|
|
|
|
|
|
std::cout << "δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << std::endl;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2023-11-13 14:00:01 +08:00
|
|
|
|
//д<>ڴ<EFBFBD>
|
|
|
|
|
|
int LWriteAddressB(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F>ڴ<EFBFBD><DAB4><EFBFBD>ַ int<6E><74>
|
|
|
|
|
|
int Address;
|
2024-03-31 13:23:55 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
2024-03-31 13:23:55 +08:00
|
|
|
|
//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
2023-11-13 14:00:01 +08:00
|
|
|
|
if (ParameterNum == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ַ
|
|
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>ĵ<DEB8>ֵ
|
|
|
|
|
|
int WriteValue;
|
|
|
|
|
|
SQGetInt(v, 3, &WriteValue);
|
2024-03-31 13:23:55 +08:00
|
|
|
|
*(BYTE*)Address = (BYTE)WriteValue;
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ParameterNum == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ַ
|
|
|
|
|
|
int Address;
|
|
|
|
|
|
//ƫ<><C6AB>
|
|
|
|
|
|
wchar_t* offset;
|
|
|
|
|
|
//<2F><EFBFBD>ֵ
|
|
|
|
|
|
int WriteValue;
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
SQGetString(v, 3, &offset);
|
|
|
|
|
|
SQGetInt(v, 4, &WriteValue);
|
|
|
|
|
|
int SelectAddress = DNFTOOL::GetHook(Address, DNFTOOL::wchar_tTochar(offset), 1);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
*(BYTE*)Address = (BYTE)WriteValue;
|
|
|
|
|
|
}
|
2024-03-31 13:23:55 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2023-11-13 14:00:01 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
//д<>ڴ<EFBFBD>
|
|
|
|
|
|
int squirrel::LWriteAddress(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F>ڴ<EFBFBD><DAB4><EFBFBD>ַ int<6E><74>
|
|
|
|
|
|
int Address;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
|
if (ParameterNum == 3)
|
|
|
|
|
|
{
|
2024-03-31 13:23:55 +08:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ַ
|
|
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>ĵ<DEB8>ֵ
|
|
|
|
|
|
int WriteValue;
|
|
|
|
|
|
SQGetInt(v, 3, &WriteValue);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
*(int*)Address = WriteValue;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPushBool(v, true);
|
2024-03-31 13:23:55 +08:00
|
|
|
|
return 1;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (ParameterNum == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ַ
|
|
|
|
|
|
int Address;
|
|
|
|
|
|
//ƫ<><C6AB>
|
|
|
|
|
|
wchar_t* offset;
|
|
|
|
|
|
//<2F><EFBFBD>ֵ
|
|
|
|
|
|
int WriteValue;
|
|
|
|
|
|
|
|
|
|
|
|
SQGetInt(v, 2, &Address);
|
|
|
|
|
|
SQGetString(v, 3, &offset);
|
|
|
|
|
|
SQGetInt(v, 4, &WriteValue);
|
|
|
|
|
|
|
|
|
|
|
|
int SelectAddress = DNFTOOL::GetHook(Address, DNFTOOL::wchar_tTochar(offset),1);
|
|
|
|
|
|
*(int*)SelectAddress = WriteValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
2022-05-07 14:31:17 +08:00
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
2023-04-14 14:56:01 +08:00
|
|
|
|
int squirrel::sq_Cmd(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* OutPutBuffer;
|
|
|
|
|
|
SQGetString(v, 2, &OutPutBuffer);
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer);
|
|
|
|
|
|
|
|
|
|
|
|
system(OutPutText);
|
|
|
|
|
|
//WinExec(OutPutText, SW_NORMAL);
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
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-09-06 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
|
#if defined ITEMRARITY
|
|
|
|
|
|
std::map< int, int>ItemColorMap;
|
|
|
|
|
|
int squirrel::RegisterItemColor_STL(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int ItemID, Clolr;
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
if (ParameterNum == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQGetInt(v, 2, &ItemID);
|
|
|
|
|
|
SQGetInt(v, 3, &Clolr);
|
|
|
|
|
|
ItemColorMap[ItemID] = Clolr;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-11-29 20:38:55 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HOOK
|
|
|
|
|
|
#ifdef CODEDRAW
|
|
|
|
|
|
struct CodeDrawObj
|
|
|
|
|
|
{
|
|
|
|
|
|
int Color;
|
|
|
|
|
|
std::string str;
|
|
|
|
|
|
};
|
|
|
|
|
|
std::map< std::string , CodeDrawObj>CodeDrawMap;
|
|
|
|
|
|
int squirrel::RegisterCodeDraw_STL(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
int Clolr;
|
|
|
|
|
|
wchar_t* Key;
|
|
|
|
|
|
wchar_t* OutPutBuffer;
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
if (ParameterNum == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
SQGetString(v, 2, &Key);
|
|
|
|
|
|
SQGetInt(v, 3, &Clolr);
|
|
|
|
|
|
SQGetString(v, 4, &OutPutBuffer);
|
|
|
|
|
|
|
|
|
|
|
|
char* OutPutKey = DNFTOOL::SquirrelU2W(Key);
|
|
|
|
|
|
std::string BufferKey = OutPutKey;
|
|
|
|
|
|
delete[]OutPutKey;
|
|
|
|
|
|
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(OutPutBuffer);
|
|
|
|
|
|
std::string str = OutPutText;
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
|
|
|
|
|
|
CodeDrawObj buffobj;
|
|
|
|
|
|
buffobj.Color = Clolr;
|
|
|
|
|
|
buffobj.str = str;
|
|
|
|
|
|
CodeDrawMap[BufferKey] = buffobj;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
//<2F><>ͨ STL
|
|
|
|
|
|
#if defined NORMAL_STL
|
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;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
FLOAT FloatValue;
|
2022-03-09 16:27:06 +08:00
|
|
|
|
char* StrValue;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
BOOL BoolValue;
|
2022-03-09 16:27:06 +08:00
|
|
|
|
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-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-03-08 12:57:35 +08:00
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
//ʱ<><CAB1> STL
|
|
|
|
|
|
#if defined TIME_STL
|
2022-06-20 03:10:33 +08:00
|
|
|
|
extern std::map<wchar_t*, TimeSTLStruct>Time_STL;
|
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-06-20 03:10:33 +08:00
|
|
|
|
case 0: //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (Time_STL.count(Name) == 1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͷ<EFBFBD><CDB7><EFBFBD> <20><><EFBFBD><EFBFBD>
|
2022-04-06 09:58:47 +08:00
|
|
|
|
{
|
|
|
|
|
|
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>㣩
|
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>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-06-20 03:10:33 +08:00
|
|
|
|
case 1: //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (Time_STL[Name].Static_Time != 0)break;//ֻ<>л<EFBFBD><D0BB><EFBFBD>ʱ<EFBFBD><CAB1>Ϊ0<CEAA><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
Time_STL[Name].Static_Time = clock();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-14 13:12:00 +08:00
|
|
|
|
case 2://<2F><>ȡʱ<C8A1><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
int Time = clock() - Time_STL[Name].Static_Time + Time_STL[Name].Now_Time;
|
2022-11-06 23:12:18 +08:00
|
|
|
|
if(Time_STL[Name].Static_Time + Time_STL[Name].Now_Time == 0)SQPushBool(v, false);//û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
|
2022-09-06 00:08:26 +08:00
|
|
|
|
else if (Time <= Time_STL[Name].Max_Time)SQPushInt(v, Time);//<2F><><EFBFBD>ص<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
|
else SQPushInt(v, (int)Time_STL[Name].Max_Time);
|
2022-04-06 09:58:47 +08:00
|
|
|
|
return 1;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-14 13:12:00 +08:00
|
|
|
|
case 3://<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
Time_STL[Name].Static_Time = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-14 13:12:00 +08:00
|
|
|
|
case 4://<2F><>ͣʱ<CDA3><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
Time_STL[Name].Now_Time += clock() - Time_STL[Name].Static_Time;
|
|
|
|
|
|
Time_STL[Name].Static_Time = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-14 13:12:00 +08:00
|
|
|
|
case 5://<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (Time_STL[Name].Static_Time != 0)break;//ֻ<>л<EFBFBD><D0BB><EFBFBD>ʱ<EFBFBD><CAB1>Ϊ0<CEAA><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
Time_STL[Name].Static_Time = clock();
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-14 13:12:00 +08:00
|
|
|
|
case 6://<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
2022-04-14 13:12:00 +08:00
|
|
|
|
Time_STL.erase(Name);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-06 09:58:47 +08:00
|
|
|
|
default:
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
2022-04-01 20:02:04 +08:00
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-01 20:02:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-04-01 20:02:04 +08:00
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
#if defined DRAGONBOX_SWITCH
|
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-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-03-11 21:52:14 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
//Json STL
|
2022-04-22 02:16:45 +08:00
|
|
|
|
#if defined JSON_STL
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Json<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-05-07 14:31:17 +08:00
|
|
|
|
std::map<std::string, std::string>Json_STL;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
//Json<6F><6E><EFBFBD><EFBFBD>
|
|
|
|
|
|
int squirrel::Jsoner_STL(uint32_t v)
|
|
|
|
|
|
{
|
2022-04-23 00:49:13 +08:00
|
|
|
|
wchar_t* WName;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
int Type;
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
if (ParameterNum == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-04-23 00:49:13 +08:00
|
|
|
|
SQGetString(v, 2, &WName);
|
|
|
|
|
|
char* CName = DNFTOOL::wchar_tTochar(WName);
|
|
|
|
|
|
std::string Name = CName;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []CName;
|
2022-04-23 00:49:13 +08:00
|
|
|
|
//<2F><>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ValueType = SQ_GetType(v, 3);
|
2022-04-22 02:16:45 +08:00
|
|
|
|
|
2022-04-23 00:49:13 +08:00
|
|
|
|
switch (ValueType)
|
2022-04-22 02:16:45 +08:00
|
|
|
|
{
|
2022-04-23 00:49:13 +08:00
|
|
|
|
case OT_INTEGER://int<6E><74><EFBFBD><EFBFBD>
|
2022-04-22 02:16:45 +08:00
|
|
|
|
{
|
2022-04-23 00:49:13 +08:00
|
|
|
|
//<2F><>ȡģʽ
|
|
|
|
|
|
SQGetInt(v, 3, &Type);
|
|
|
|
|
|
|
|
|
|
|
|
switch (Type)
|
2022-04-22 02:16:45 +08:00
|
|
|
|
{
|
2022-04-23 00:49:13 +08:00
|
|
|
|
case 0://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
2022-04-23 01:06:57 +08:00
|
|
|
|
if (Json_STL.count(Name) == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>hash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʹ<EFBFBD><CDB4><EFBFBD>
|
2022-04-23 00:49:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ hash <20><> Json<6F><6E><EFBFBD><EFBFBD>
|
|
|
|
|
|
std::string str = "";
|
|
|
|
|
|
Json_STL[Name] = str;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
case 1://<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
2022-04-22 02:16:45 +08:00
|
|
|
|
{
|
2022-04-23 00:49:13 +08:00
|
|
|
|
wchar_t* buffer = DNFTOOL::charTowchar_t((char*)Json_STL[Name].c_str());
|
|
|
|
|
|
SQPushString(v, buffer, wcslen(buffer));//<2F><><EFBFBD><EFBFBD>nut
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []buffer;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
return 1;
|
2022-04-23 00:49:13 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case 2://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
Json_STL.erase(Name);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
break;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
break;
|
2022-05-23 21:37:38 +08:00
|
|
|
|
case OT_STRING://String<6E><67><EFBFBD><EFBFBD>
|
2022-04-22 02:16:45 +08:00
|
|
|
|
{
|
2022-04-23 01:06:57 +08:00
|
|
|
|
|
|
|
|
|
|
if (Json_STL.count(Name) == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>hash<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͷ<EFBFBD><CDB7><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v,false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-23 00:49:13 +08:00
|
|
|
|
wchar_t* GKey;
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetString(v, 3, &GKey);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
char* key = DNFTOOL::SquirrelU2W(GKey);
|
|
|
|
|
|
//char* key = DNFTOOL::wchar_tTochar(GKey);
|
2022-04-23 00:49:13 +08:00
|
|
|
|
rapidjson::Document Dom;
|
2022-04-23 01:06:57 +08:00
|
|
|
|
Dom.Parse(Json_STL[Name].c_str());//<2F><><EFBFBD><EFBFBD> <20>ַ<EFBFBD><D6B7><EFBFBD>
|
2022-04-23 00:49:13 +08:00
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> Data;
|
|
|
|
|
|
DNFTOOL::Split(key, Data);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []key;
|
2022-04-23 00:49:13 +08:00
|
|
|
|
rapidjson::Value Vbuffer;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
for (unsigned int i = 0; i < Data.size(); i++)
|
2022-04-23 00:49:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (i == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Vbuffer = Dom[Data[i].c_str()];
|
|
|
|
|
|
}
|
2022-05-07 14:31:17 +08:00
|
|
|
|
else if (DNFTOOL::isNum(Data[i].c_str()) != 0)
|
2022-04-23 00:49:13 +08:00
|
|
|
|
{
|
2022-09-06 00:08:26 +08:00
|
|
|
|
if(Vbuffer.Empty() == 0 && Vbuffer.Size() > atoi(Data[i].c_str()))Vbuffer = Vbuffer[atoi(Data[i].c_str())];
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-05-23 21:37:38 +08:00
|
|
|
|
if (Vbuffer.Empty() == 0)Vbuffer = Vbuffer[Data[i].c_str()];
|
2022-04-23 00:49:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
if (Vbuffer.IsBool())
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, Vbuffer.GetBool());
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Vbuffer.Empty() == false || (Vbuffer.IsInt() && Vbuffer.GetInt()==0))
|
2022-04-23 00:49:13 +08:00
|
|
|
|
{
|
2022-05-23 21:37:38 +08:00
|
|
|
|
if (Vbuffer.IsString())
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* buffer = DNFTOOL::charTowchar_t((char*)Vbuffer.GetString());
|
|
|
|
|
|
SQPushString(v, buffer, wcslen(buffer));
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []buffer;
|
2022-05-23 21:37:38 +08:00
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2023-04-14 14:56:01 +08:00
|
|
|
|
else if (Vbuffer.IsInt())
|
2022-05-23 21:37:38 +08:00
|
|
|
|
{
|
|
|
|
|
|
SQPushInt(v, Vbuffer.GetInt());
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2023-04-14 14:56:01 +08:00
|
|
|
|
else if (Vbuffer.IsFloat())
|
2022-05-23 21:37:38 +08:00
|
|
|
|
{
|
|
|
|
|
|
SQPushFloat(v, Vbuffer.GetFloat());
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2023-04-14 14:56:01 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
rapidjson::StringBuffer jsonBuffer;
|
|
|
|
|
|
rapidjson::Writer<rapidjson::StringBuffer> writer(jsonBuffer);
|
|
|
|
|
|
Vbuffer.Accept(writer);
|
|
|
|
|
|
const char* json = jsonBuffer.GetString();
|
|
|
|
|
|
wchar_t* buffer = DNFTOOL::charTowchar_t((char*)json);
|
|
|
|
|
|
SQPushString(v, buffer, wcslen(buffer));
|
|
|
|
|
|
delete[]buffer;
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
}
|
2022-05-23 21:37:38 +08:00
|
|
|
|
else
|
2022-04-23 00:49:13 +08:00
|
|
|
|
{
|
2022-05-23 21:37:38 +08:00
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
2022-04-23 00:49:13 +08:00
|
|
|
|
}
|
2022-04-22 02:16:45 +08:00
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
break;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 4)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-04-23 00:49:13 +08:00
|
|
|
|
SQGetString(v, 2, &WName);
|
|
|
|
|
|
char* CName = DNFTOOL::wchar_tTochar(WName);
|
|
|
|
|
|
std::string Name = CName;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []CName;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
//<2F><>ȡKey <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
wchar_t* keybuffer;
|
|
|
|
|
|
SQGetString(v, 3, &keybuffer);
|
|
|
|
|
|
//ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>Key
|
|
|
|
|
|
char* key = DNFTOOL::wchar_tTochar(keybuffer);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>json dom
|
|
|
|
|
|
rapidjson::Document Dom;
|
|
|
|
|
|
Dom.Parse(Json_STL[Name].c_str());//<2F><><EFBFBD><EFBFBD> <20>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
|
if(Json_STL[Name].length() == 0 )Dom.SetObject();//<2F><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC><EFBFBD>ͳ<EFBFBD>ʼ<EFBFBD><CABC>һ<EFBFBD><D2BB>
|
|
|
|
|
|
|
|
|
|
|
|
rapidjson::Value BB;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
int ValueType = SQ_GetType(v, 4);
|
|
|
|
|
|
//<2F>ж<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|
|
|
|
|
switch (ValueType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case OT_INTEGER://int<6E><74><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
int Value;
|
|
|
|
|
|
SQGetInt(v, 4, &Value);
|
|
|
|
|
|
BB.SetInt(Value);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case OT_FLOAT://float<61><74><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
FLOAT Value;
|
|
|
|
|
|
SQGetFloat(v, 4, &Value);
|
|
|
|
|
|
BB.SetFloat(Value);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case OT_BOOL://bool<6F><6C><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
BOOL Value;
|
|
|
|
|
|
SQGetBool(v, 4, &Value);
|
|
|
|
|
|
BB.SetBool(Value);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case OT_STRING://string<6E><67><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* Value;
|
|
|
|
|
|
SQGetString(v, 4, &Value);
|
|
|
|
|
|
char* str = DNFTOOL::wchar_tTochar(Value);
|
|
|
|
|
|
BB.SetString(rapidjson::StringRef(str));
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []str;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
|
|
|
|
|
|
if (Dom[key].IsNull())//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<D6B5>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD>
|
2022-04-22 02:16:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
Dom.AddMember(rapidjson::StringRef(key), BB, Dom.GetAllocator());
|
|
|
|
|
|
}
|
2022-04-23 00:49:13 +08:00
|
|
|
|
else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
Dom[key] = BB;
|
|
|
|
|
|
}
|
2022-04-22 02:16:45 +08:00
|
|
|
|
|
|
|
|
|
|
rapidjson::StringBuffer jsonBuffer;
|
|
|
|
|
|
rapidjson::Writer<rapidjson::StringBuffer> writer(jsonBuffer);
|
|
|
|
|
|
Dom.Accept(writer);
|
|
|
|
|
|
Json_STL[Name] = jsonBuffer.GetString();
|
|
|
|
|
|
SQPushBool(v, true);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
delete []key;
|
2022-04-22 02:16:45 +08:00
|
|
|
|
}
|
2022-06-20 03:10:33 +08:00
|
|
|
|
else if (ParameterNum == 5)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetString(v, 2, &WName);
|
|
|
|
|
|
char* CName = DNFTOOL::wchar_tTochar(WName);
|
|
|
|
|
|
std::string Name = CName;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡStr <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
wchar_t* str;
|
|
|
|
|
|
SQGetString(v, 3, &str);
|
|
|
|
|
|
//ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
char* Jso = DNFTOOL::wchar_tTochar(str);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
delete []CName;
|
|
|
|
|
|
delete []Jso;
|
2022-06-20 03:10:33 +08:00
|
|
|
|
}
|
2022-04-22 02:16:45 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>ַ<EFBFBD> STL
|
|
|
|
|
|
#if defined CODE_STL
|
2022-09-06 00:08:26 +08:00
|
|
|
|
extern std::vector< DrawCodestruct>DrawCodeT1_STL;
|
|
|
|
|
|
extern std::vector< DrawCodestruct>DrawCodeT2_STL;
|
2022-11-06 23:12:18 +08:00
|
|
|
|
extern std::vector< DrawCodestruct>DrawCodeT3_STL;
|
2022-04-24 02:31:42 +08:00
|
|
|
|
int squirrel::Coder_STL(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* Str;
|
|
|
|
|
|
int XPos;
|
|
|
|
|
|
int YPos;
|
|
|
|
|
|
int Color;
|
|
|
|
|
|
int Type;
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
2022-04-24 18:02:17 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
if (ParameterNum == 6)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetString(v, 2, &Str);
|
|
|
|
|
|
//<2F><>ȡX<C8A1><58><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 3, &XPos);
|
|
|
|
|
|
//<2F><>ȡX<C8A1><58><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 4, &YPos);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ɫ
|
|
|
|
|
|
SQGetInt(v, 5, &Color);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 6, &Type);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
2022-04-24 18:02:17 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD> Wchar_t ת<><D7AA>Ϊ Unicode
|
2022-09-06 00:08:26 +08:00
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Str);
|
|
|
|
|
|
std::string str = OutPutText;
|
|
|
|
|
|
//wchar_t * str = DNFTOOL::char2wchar(OutPutText);
|
|
|
|
|
|
delete []OutPutText;
|
|
|
|
|
|
//delete Str;
|
2022-04-24 18:02:17 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
DrawCodestruct Buffer;
|
|
|
|
|
|
Buffer.str = str;
|
|
|
|
|
|
Buffer.Xpos = XPos;
|
|
|
|
|
|
Buffer.Ypos = YPos;
|
|
|
|
|
|
Buffer.Color = Color;
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawCodeT1_STL.push_back(Buffer);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawCodeT2_STL.push_back(Buffer);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-11-06 23:12:18 +08:00
|
|
|
|
case 2:
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawCodeT3_STL.push_back(Buffer);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2022-04-24 02:31:42 +08:00
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
}
|
2022-04-24 18:02:17 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
|
#ifdef DRAW_CODE
|
|
|
|
|
|
typedef DWORD(_fastcall _FontInit)(DWORD thisc, DWORD Seat);
|
|
|
|
|
|
static _FontInit* sub_11BE9A0 = (_FontInit*)0x11BE9A0;
|
|
|
|
|
|
static _FontInit* sub_11BE980 = (_FontInit*)0x11BE980;
|
|
|
|
|
|
typedef DWORD(_fastcall _BFontInit)(DWORD thisc, DWORD Seat);
|
|
|
|
|
|
static _BFontInit* sub_1206570 = (_BFontInit*)0x1206570;
|
|
|
|
|
|
typedef DWORD(_fastcall _FontC)(DWORD thisc, DWORD Seat, DWORD Font);
|
|
|
|
|
|
static _FontC* sub_1206550 = (_FontC*)0x1206550;
|
|
|
|
|
|
static DrawCode NewDrawCodeF = (DrawCode)0x01206BD0;
|
|
|
|
|
|
|
|
|
|
|
|
int squirrel::sq_DrawCode(uint32_t v)
|
|
|
|
|
|
{
|
|
|
|
|
|
wchar_t* Str;
|
|
|
|
|
|
int XPos;
|
|
|
|
|
|
int YPos;
|
|
|
|
|
|
int Color;
|
|
|
|
|
|
int Type;
|
|
|
|
|
|
int Stroke;
|
|
|
|
|
|
|
|
|
|
|
|
int ParameterNum = SQGetTop(v);
|
|
|
|
|
|
|
|
|
|
|
|
if (ParameterNum == 4)
|
|
|
|
|
|
{
|
2023-04-14 14:56:01 +08:00
|
|
|
|
Color = (int)0xfffffffff;
|
2022-11-06 23:12:18 +08:00
|
|
|
|
Type = 1;
|
|
|
|
|
|
Stroke = 0;
|
|
|
|
|
|
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 5)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ɫ
|
|
|
|
|
|
SQGetInt(v, 5, &Color);
|
|
|
|
|
|
Type = 1;
|
|
|
|
|
|
Stroke = 0;
|
|
|
|
|
|
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 6)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ɫ
|
|
|
|
|
|
SQGetInt(v, 5, &Color);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 6, &Type);
|
|
|
|
|
|
Stroke = 0;
|
|
|
|
|
|
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (ParameterNum == 7)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ɫ
|
|
|
|
|
|
SQGetInt(v, 5, &Color);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 6, &Type);
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 7, &Stroke);
|
|
|
|
|
|
|
|
|
|
|
|
SQPushBool(v, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
SQPushBool(v, false);
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetString(v, 2, &Str);
|
|
|
|
|
|
//<2F><>ȡX<C8A1><58><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 3, &XPos);
|
|
|
|
|
|
//<2F><>ȡX<C8A1><58><EFBFBD><EFBFBD>
|
|
|
|
|
|
SQGetInt(v, 4, &YPos);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD> Wchar_t ת<><D7AA>Ϊ Unicode
|
|
|
|
|
|
char* OutPutText = DNFTOOL::SquirrelU2W(Str);
|
|
|
|
|
|
//תΪ<D7AA><CEAA>ȷ<EFBFBD><C8B7>Unicode<64>ַ<EFBFBD>
|
|
|
|
|
|
wchar_t* str = DNFTOOL::char2wchar(OutPutText);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
unsigned char* font = new unsigned char[1000];
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|
|
|
|
|
sub_11BE9A0((DWORD)font, 0);
|
|
|
|
|
|
sub_11BE980((DWORD)font, 0);
|
|
|
|
|
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
font[1] = Stroke;
|
|
|
|
|
|
|
|
|
|
|
|
int FontObj;
|
|
|
|
|
|
|
|
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
FontObj = *(int*)0x1B468CC;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
FontObj = *(int*)0x1B468DC;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
FontObj = *(int*)0x1B468D4;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
FontObj = *(int*)0x1B468CC;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
*(int*)((int)font + 8) = FontObj;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ƾ<EFBFBD><C6BE><EFBFBD>
|
|
|
|
|
|
DWORD base = *(int*)0x1B45B94;
|
|
|
|
|
|
//<2F><><EFBFBD>ñ<EFBFBD>
|
|
|
|
|
|
sub_1206550(base, 0, (DWORD)font);
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
NewDrawCodeF(base, 0, XPos, YPos, Color, (int)str);
|
|
|
|
|
|
//ȡ<><C8A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
sub_1206570(base, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete[]OutPutText;
|
|
|
|
|
|
delete[]str;
|
|
|
|
|
|
delete[]font;
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
typedef int(_Sq_Err)(uint32_t v);
|
|
|
|
|
|
static _Sq_Err* Sq_Err = (_Sq_Err*)0x13542F0;
|
2022-04-24 02:31:42 +08:00
|
|
|
|
|
2022-03-08 12:57:35 +08:00
|
|
|
|
//<2F><>ȡSquirrel v <20><>ַ
|
|
|
|
|
|
inline uint32_t GetSqVm()
|
|
|
|
|
|
{
|
|
|
|
|
|
return *(uint32_t*)0x1AF3544;
|
|
|
|
|
|
}
|
2022-04-21 12:48:20 +08:00
|
|
|
|
//ע<><D7A2> Nut API
|
2022-03-08 12:57:35 +08:00
|
|
|
|
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);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_DrawImg", squirrel::sq_DrawImg);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_ReleaseDrawImgModel", sq_ReleaseDrawImgModel);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_SetDrawImgModel", sq_SetDrawImgModel);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_IntiNumberDraw", squirrel::sq_IntiNumberDraw);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_DrawNumber", squirrel::sq_DrawNumber);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_DrawWindow", sq_DrawWindow);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_DrawButton", sq_DrawButton);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_GetStringDrawLength", sq_GetStringDrawLength);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_GetStringDrawArray", sq_GetStringDrawArray);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_DecondeJson", DecondeJson);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_EncondeJson", EncondeJson);
|
2024-03-31 13:23:55 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_IsKeyDown", sq_IsKeyDown);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RegisterNutApi(L"L_sq_Open_ExWindow", sq_Open_ExWindow);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⴰ<EFBFBD><E2B4B0>
|
2024-03-31 13:23:55 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_Open_ExWindow2", sq_Open_ExWindow2);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⴰ<EFBFBD><E2B4B0>
|
2023-11-13 14:00:01 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_Select_MiniMap_Index", sq_Select_MiniMap_Index);//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_DrawSkill", sq_DrawSkill);//<2F><><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD>
|
|
|
|
|
|
RegisterNutApi(L"L_sq_UseSkill", sq_UseSkill);//<2F><><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD>
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_GetPlayerEachName", sq_GetPlayerEachName);
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_GetSkillAddress", sq_GetSkillAddress);
|
2023-05-12 16:08:39 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_OpenConsole", squirrel::sq_OpenConsole);
|
2023-04-14 14:56:01 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_MoveMap", squirrel::sq_MoveMap);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
RegisterNutApi(L"L_Sq_Err", Sq_Err);
|
|
|
|
|
|
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_GetImg", sq_GetImg);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
RegisterNutApi(L"L_Sq_DrawItem", sq_DrawItem);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_GetObjectAddress", GetObjectAddress);
|
2023-11-13 14:00:01 +08:00
|
|
|
|
RegisterNutApi(L"L_Sq_GetRidingObjectAddress", GetRidingObjectAddress);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
RegisterNutApi(L"L_Sq_GetObjectName", GetObjectName);
|
2023-04-14 14:56:01 +08:00
|
|
|
|
RegisterNutApi(L"L_Sq_GetObjectInfo", GetObjectInfo);
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_GetObjectDeInfo", GetObjectDeInfo);
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_SetObjectInfo", SetObjectInfo);
|
|
|
|
|
|
RegisterNutApi(L"L_Sq_SetObjectDeInfo", SetObjectDeInfo);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
RegisterNutApi(L"L_Sq_GetObjectLevel", GetObjectLevel);
|
|
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
|
2023-04-14 14:56:01 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_Switching", squirrel::sq_Switching);//<2F><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ
|
|
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>鿴 <20><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
#if defined CHRATRBT_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
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>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined TOWN_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
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>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined CHRINFO_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_GetFatigue", squirrel::GetFatigue);//<2F><>ȡƣ<C8A1><C6A3>ֵ
|
|
|
|
|
|
RegisterNutApi(L"L_sq_GetExp", squirrel::GetExp);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
|
2023-11-13 14:00:01 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_GetSp", sq_GetSp);//<2F><>ȡSP<53><50>
|
|
|
|
|
|
RegisterNutApi(L"L_sq_GetPassLevel", sq_GetPassLevel);//<2F><>ȡð<C8A1><C3B0><EFBFBD>ŵȼ<C5B5>
|
|
|
|
|
|
RegisterNutApi(L"L_sq_RefreshEventIcon", sq_RefreshEventIcon);//ˢ<>»ͼ<EEB6AF><CDBC>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-04-06 09:58:47 +08:00
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined SEND_PACK_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
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>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined SEND_API_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
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>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
|
|
|
|
|
#ifdef DRAW_CODE
|
|
|
|
|
|
RegisterNutApi(L"L_sq_DrawCode", squirrel::sq_DrawCode);//<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined DOFILE_API_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_Dofile", squirrel::LDofile);//<2F><><EFBFBD>ܶ<EFBFBD>ȡ
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
#if defined GETINTDATA_API_SWITCH
|
|
|
|
|
|
//RegisterNutApi(L"L_sq_LenheartGetIntData", (void*)0x005E3DB0);//<2F><>ȡ<EFBFBD><C8A1>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
#if defined ADDRESS_API_SWITCH
|
|
|
|
|
|
RegisterNutApi(L"L_sq_RA", squirrel::LReadAddress);//<2F><><EFBFBD>ڴ<EFBFBD>
|
|
|
|
|
|
RegisterNutApi(L"L_sq_WA", squirrel::LWriteAddress);//д<>ڴ<EFBFBD>
|
2024-03-31 13:23:55 +08:00
|
|
|
|
|
|
|
|
|
|
RegisterNutApi(L"L_sq_RAB", LReadAddressB);//<2F><><EFBFBD>ڴ<EFBFBD>
|
2023-11-13 14:00:01 +08:00
|
|
|
|
RegisterNutApi(L"L_sq_WAB", LWriteAddressB);//д<>ڴ<EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined LCOUT_API_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
RegisterNutApi(L"L_cout", squirrel::Lcout);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-09-06 00:08:26 +08:00
|
|
|
|
RegisterNutApi(L"Sout", squirrel::Sout);//<2F><><EFBFBD><EFBFBD>
|
2023-11-13 14:00:01 +08:00
|
|
|
|
RegisterNutApi(L"Clock", squirrel::Clock);//<2F><><EFBFBD><EFBFBD>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if defined NEW_WINDOW_API_SWITCH
|
2022-04-06 09:58:47 +08:00
|
|
|
|
RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2023-04-14 14:56:01 +08:00
|
|
|
|
RegisterNutApi(L"L_Cmd", squirrel::sq_Cmd);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-04-06 09:58:47 +08:00
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined SET_SLOT_API_SWITCH
|
|
|
|
|
|
RegisterNutApi(L"L_SetSlot", squirrel::SetSlot);//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
#endif
|
2022-04-06 09:58:47 +08:00
|
|
|
|
|
2022-04-21 12:48:20 +08:00
|
|
|
|
//<2F><>ͨ STL
|
|
|
|
|
|
#if defined NORMAL_STL
|
2022-04-06 09:58:47 +08:00
|
|
|
|
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>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-04-06 09:58:47 +08:00
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
//ʱ<><CAB1> STL
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined TIME_STL
|
2022-04-06 09:58:47 +08:00
|
|
|
|
RegisterNutApi(L"L_Timer_STL", squirrel::Timer_STL);//ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-04-06 09:58:47 +08:00
|
|
|
|
|
2022-04-22 02:16:45 +08:00
|
|
|
|
//Json STL
|
|
|
|
|
|
#if defined JSON_STL
|
2022-05-07 14:31:17 +08:00
|
|
|
|
RegisterNutApi(L"L_Json_STL", squirrel::Jsoner_STL);//Json<6F><6E><EFBFBD><EFBFBD>
|
2022-04-22 02:16:45 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
//<2F>ַ<EFBFBD> STL
|
|
|
|
|
|
#if defined CODE_STL
|
|
|
|
|
|
RegisterNutApi(L"L_Code_STL", squirrel::Coder_STL);//<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
|
|
|
|
|
#ifdef ITEMRARITY
|
|
|
|
|
|
RegisterNutApi(L"L_RegisterItemColor_STL", squirrel::RegisterItemColor_STL);//ע<><D7A2>Item<65><6D>ɫ
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-11-29 20:38:55 +08:00
|
|
|
|
|
|
|
|
|
|
#ifdef CODEDRAW
|
|
|
|
|
|
RegisterNutApi(L"L_RegisterCodeDraw_STL", squirrel::RegisterCodeDraw_STL);//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>HOOK
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
RegisterNutApi(L"L_sq_GetInputBoxStr",sq_GetInputBoxStr);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_SetInputBoxStr", sq_SetInputBoxStr);
|
|
|
|
|
|
RegisterNutApi(L"L_sq_NewInputBox", sq_NewInputBox);
|
|
|
|
|
|
|
2022-04-24 02:31:42 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
2022-04-21 12:48:20 +08:00
|
|
|
|
#if defined DRAGONBOX_SWITCH
|
2022-05-07 14:31:17 +08:00
|
|
|
|
//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-04-21 12:48:20 +08:00
|
|
|
|
#endif
|
2022-02-10 14:14:08 +08:00
|
|
|
|
}
|
2022-09-06 00:08:26 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
//typedef struct _DofileObject
|
|
|
|
|
|
//{
|
|
|
|
|
|
// int State;
|
|
|
|
|
|
// std::string DofileArr[];
|
|
|
|
|
|
//}_DofileObject;
|
|
|
|
|
|
//extern _DofileObject DofileObject;
|
|
|
|
|
|
#include "conio.h"
|
|
|
|
|
|
#pragma warning(disable:4996)
|
2022-09-06 00:08:26 +08:00
|
|
|
|
//<2F>߳<EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Sqr<71>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void squirrel::SqrCallBackFunc()
|
|
|
|
|
|
{
|
2023-11-13 14:00:01 +08:00
|
|
|
|
//if (DofileObject.State == 0) {
|
|
|
|
|
|
// DofileObject.State = 1;
|
|
|
|
|
|
// for (size_t i = 0; i < DofileObject.DofileArr->size(); i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// std::cout << DofileObject.DofileArr[i] << std::endl;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// DofileObject.DofileArr->clear();
|
|
|
|
|
|
// DofileObject.State = 0;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t v = GetSqVm();
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
static int SqrCallBackFuncTimer = clock();
|
|
|
|
|
|
int NowTime = clock();
|
2023-11-13 14:00:01 +08:00
|
|
|
|
if ((NowTime - SqrCallBackFuncTimer) >= 500)
|
2022-09-06 00:08:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
DWORD Time = clock();
|
|
|
|
|
|
DWORD VmTop = SQGetTop(v);
|
|
|
|
|
|
//std::cout << "stack: " << VmTop << std::endl;
|
|
|
|
|
|
SQPushRootTable(v);
|
|
|
|
|
|
SQPushString(v, L"Lenheart", -1);
|
|
|
|
|
|
SQ_Get(v, -2);
|
|
|
|
|
|
SQPushRootTable(v);
|
|
|
|
|
|
SQPushInt(v, VmTop);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
SQ_Call(v, 2, 0, 1);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPop(v, 2);
|
|
|
|
|
|
|
|
|
|
|
|
SqrCallBackFuncTimer = NowTime;
|
|
|
|
|
|
}
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (nCode >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><>MSG<53>ṹ<EFBFBD><E1B9B9>ָ<EFBFBD><D6B8>ת<EFBFBD><D7AA>ΪPMSG<53><47><EFBFBD><EFBFBD>
|
|
|
|
|
|
PMSG pMsg = (PMSG)lParam;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
|
switch (pMsg->message)
|
|
|
|
|
|
{
|
|
|
|
|
|
case WM_KEYDOWN: {
|
|
|
|
|
|
uint32_t v = GetSqVm();
|
|
|
|
|
|
int Top = SQGetTop(v);
|
|
|
|
|
|
SQPushRootTable(v);
|
|
|
|
|
|
SQPushString(v, L"KeyInputCallBack", -1);
|
|
|
|
|
|
if (SQ_Get(v, -2) >= 0) {
|
|
|
|
|
|
SQPushRootTable(v);
|
|
|
|
|
|
SQPushInt(v, pMsg->wParam);
|
|
|
|
|
|
SQ_Call(v, 2, 0, 1);
|
|
|
|
|
|
SQPop(v, 2);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
SQPop(v, 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>hook<6F><6B><EFBFBD><EFBFBD>
|
|
|
|
|
|
return CallNextHookEx(NULL, nCode, wParam, lParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SQUNICODE
|
|
|
|
|
|
|
|
|
|
|
|
#define scvprintf vfwprintf
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
#define scvprintf vfprintf
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void printfunc(HSQUIRRELVM v, const SQChar* s, ...)
|
|
|
|
|
|
{
|
|
|
|
|
|
va_list vl;
|
|
|
|
|
|
va_start(vl, s);
|
|
|
|
|
|
scvprintf(stdout, s, vl);
|
|
|
|
|
|
va_end(vl);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
void squirrel::InitGameScript()
|
|
|
|
|
|
{
|
|
|
|
|
|
uint32_t v = GetSqVm();
|
2022-11-10 04:27:41 +08:00
|
|
|
|
//<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
#ifdef COPY_MESSAGE
|
|
|
|
|
|
* (WORD*)0x011C53B0 = 0x01B0;
|
|
|
|
|
|
#endif // COPY_MESSAGE
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
#ifdef SELL
|
|
|
|
|
|
//FILE* file = fopen("DNF.exe", "rb");
|
|
|
|
|
|
//if (file)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// int size = filelength(fileno(file));
|
|
|
|
|
|
// if (size < 30770624) {
|
2023-11-13 14:00:01 +08:00
|
|
|
|
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
|
|
|
|
|
|
Registerfunc(130, sock::Pack_Control, 0);
|
|
|
|
|
|
|
2024-03-31 13:23:55 +08:00
|
|
|
|
FILE* file2 = fopen("Xuefeng2_bConsole", "rb");
|
|
|
|
|
|
if (file2)
|
|
|
|
|
|
{
|
|
|
|
|
|
sq_setprintfunc((HSQUIRRELVM)v, (SQPRINTFUNCTION)printfunc);
|
|
|
|
|
|
}
|
|
|
|
|
|
hook::RegisterHook();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// fclose(file);
|
|
|
|
|
|
//}
|
|
|
|
|
|
#endif
|
2023-11-13 14:00:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HHOOK hHook = SetWindowsHookEx(WH_GETMESSAGE, HookProc, NULL, GetCurrentThreadId());
|
2024-03-31 13:23:55 +08:00
|
|
|
|
// <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|
|
|
|
|
//HHOOK g_hHook = SetWindowsHookEx(WH_CALLWNDPROC, ImeEndCompositionProc, NULL, GetCurrentThreadId());
|
2023-05-12 16:08:39 +08:00
|
|
|
|
|
2022-11-06 23:12:18 +08:00
|
|
|
|
|
|
|
|
|
|
#ifdef SELL
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPushRootTable(v);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
SQPushString(v, L"L_sq_Dofile", -1);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQ_Get(v, -2);
|
|
|
|
|
|
SQPushRootTable(v);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
SQPushString(v, L"licbylist.dll", -1);
|
|
|
|
|
|
SQ_Call(v, 2, 0, 1);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPop(v, 2);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
#else
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPushRootTable(v);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
SQPushString(v, L"dofile", -1);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQ_Get(v, -2);
|
|
|
|
|
|
SQPushRootTable(v);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
SQPushString(v, L"sqr/DofileList.nut", -1);
|
|
|
|
|
|
SQ_Call(v, 2, 0, 1);
|
2022-09-06 00:08:26 +08:00
|
|
|
|
SQPop(v, 2);
|
2022-11-06 23:12:18 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2022-09-06 00:08:26 +08:00
|
|
|
|
}
|