1111
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "pch.h"
|
||||
#include "squirrel.h"
|
||||
#include "lsquirrel.h"
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,235 @@ int squirrel::GetObjectName(uint32_t v)
|
||||
delete[]name;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//获取对象属性
|
||||
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;
|
||||
}
|
||||
|
||||
//解密获取对象属性
|
||||
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;
|
||||
}
|
||||
|
||||
//设置对象属性
|
||||
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;
|
||||
}
|
||||
|
||||
//加密设置对象属性
|
||||
int squirrel::SetObjectDeInfo(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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
//获取对象等级
|
||||
int squirrel::GetObjectLevel(uint32_t v)
|
||||
{
|
||||
@@ -93,7 +322,7 @@ int squirrel::GetObjectLevel(uint32_t v)
|
||||
|
||||
|
||||
//窗口CALL
|
||||
typedef void(__fastcall* NNoticeTCall)(DWORD thisc, DWORD Seat, DWORD a1, wchar_t* a2, DWORD a3, DWORD a4, DWORD a5);
|
||||
typedef void(* NNoticeTCall)(DWORD thisc, DWORD Seat, DWORD a1, wchar_t* a2, DWORD a3, DWORD a4, DWORD a5);
|
||||
static NNoticeTCall _ANoticeTcall = (NNoticeTCall)0xE6E070;
|
||||
|
||||
typedef int(_cdecl _sub7AAB60)(int a1);
|
||||
@@ -130,12 +359,48 @@ int squirrel::sq_DrawItem(uint32_t v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//换装参数Call
|
||||
typedef int _E49DB0();
|
||||
static _E49DB0* FuncE49DB0 = (_E49DB0*)0xE49DB0;
|
||||
int squirrel::sq_Switching(uint32_t v)
|
||||
{
|
||||
DWORD V2 = FuncE49DB0();
|
||||
SQPushInt(v, V2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int squirrel::sq_Test(uint32_t v)
|
||||
{
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -809,6 +1074,17 @@ int squirrel::NewWindows(uint32_t v)
|
||||
|
||||
return 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
//设置UI槽坐标
|
||||
int squirrel::SetSlot(uint32_t v)
|
||||
{
|
||||
@@ -1486,16 +1762,28 @@ int squirrel::Jsoner_STL(uint32_t v)
|
||||
delete []buffer;
|
||||
return 1;
|
||||
}
|
||||
if (Vbuffer.IsInt())
|
||||
else if (Vbuffer.IsInt())
|
||||
{
|
||||
SQPushInt(v, Vbuffer.GetInt());
|
||||
return 1;
|
||||
}
|
||||
if (Vbuffer.IsFloat())
|
||||
else if (Vbuffer.IsFloat())
|
||||
{
|
||||
SQPushFloat(v, Vbuffer.GetFloat());
|
||||
return 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1719,7 +2007,7 @@ int squirrel::sq_DrawCode(uint32_t v)
|
||||
|
||||
if (ParameterNum == 4)
|
||||
{
|
||||
Color = 0xfffffffff;
|
||||
Color = (int)0xfffffffff;
|
||||
Type = 1;
|
||||
Stroke = 0;
|
||||
|
||||
@@ -1846,6 +2134,7 @@ void squirrel::RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t
|
||||
void squirrel::R_Register_Nut()
|
||||
{
|
||||
RegisterNutApi(L"L_sq_Test", squirrel::sq_Test);
|
||||
RegisterNutApi(L"L_sq_MoveMap", squirrel::sq_MoveMap);
|
||||
RegisterNutApi(L"L_Sq_Err", Sq_Err);
|
||||
|
||||
RegisterNutApi(L"L_Sq_GetImg", sq_GetImg);
|
||||
@@ -1853,9 +2142,15 @@ void squirrel::R_Register_Nut()
|
||||
|
||||
RegisterNutApi(L"L_Sq_GetObjectAddress", GetObjectAddress);
|
||||
RegisterNutApi(L"L_Sq_GetObjectName", GetObjectName);
|
||||
RegisterNutApi(L"L_Sq_GetObjectInfo", GetObjectInfo);
|
||||
RegisterNutApi(L"L_Sq_GetObjectDeInfo", GetObjectDeInfo);
|
||||
RegisterNutApi(L"L_Sq_SetObjectInfo", SetObjectInfo);
|
||||
RegisterNutApi(L"L_Sq_SetObjectDeInfo", SetObjectDeInfo);
|
||||
RegisterNutApi(L"L_Sq_GetObjectLevel", GetObjectLevel);
|
||||
|
||||
|
||||
RegisterNutApi(L"L_sq_Switching", squirrel::sq_Switching);//换装参数获取
|
||||
|
||||
//人物或装备属性 查看 修改 开启
|
||||
#if defined CHRATRBT_SWITCH
|
||||
RegisterNutApi(L"L_sq_GetCharacterAttribute", squirrel::GetCharacterAttribute);//获取人物或装备属性
|
||||
@@ -1909,6 +2204,7 @@ void squirrel::R_Register_Nut()
|
||||
|
||||
#if defined NEW_WINDOW_API_SWITCH
|
||||
RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//创建窗口
|
||||
RegisterNutApi(L"L_Cmd", squirrel::sq_Cmd);//创建窗口
|
||||
#endif
|
||||
|
||||
#if defined SET_SLOT_API_SWITCH
|
||||
|
||||
Reference in New Issue
Block a user