This commit is contained in:
Lenheart 2022-03-27 17:17:12 +08:00
parent 9e120025de
commit 47e68ae106
3 changed files with 64 additions and 3 deletions

View File

@ -25,7 +25,7 @@ void DNFTOOL::SetNutArrNum(int Nutͷ
*p = num;
}
int DNFTOOL::GetHook(int Addr, std::string )
int DNFTOOL::GetHook(int Addr, std::string µØÖ·,int Type)
{
size_t pos = .find("+");
size_t size = .size();
@ -47,10 +47,18 @@ int DNFTOOL::GetHook(int Addr, std::string
if (num != 0)
{
for (int z = 0; z < i; z++)
{
if (z == i - 1)
{
if (Type == 0)return *(int*)(num + GetHookArr[z]);
else return (num + GetHookArr[z]);
}
else
{
num = *(int*)(num + GetHookArr[z]);
}
}
}
return num;
}

View File

@ -63,7 +63,7 @@ public:
//写Nut头 号位数据
static void SetNutArrNum(int Nut头地址, int Pos, int num);
//读内存偏移地址
static int GetHook(int Addr, std::string );
static int GetHook(int Addr, std::string ,int Type = 0);
//解密读取
static int DNFDeCode(int Address);
//加密写入

View File

@ -174,6 +174,56 @@ static int GetTownYpos(uint32_t v)
SQPushInt(v, DNFTOOL::GetHook(0x1AB7CE0, "0x2C0+"));
return 1;
}
//»ñȡƣÀÍÖµ
static int GetFatigue(uint32_t v)
{
int Type;
int num = SQGetTop(v);
if (num == 2)
{
SQGetInt(v, 2, &Type);
switch (Type)
{
case 0:
SQPushInt(v, DNFTOOL::DNFDeCode(0x1AB7E1C));
break;
case 1:
SQPushInt(v, DNFTOOL::DNFDeCode(0x1AB7E10));
break;
default:
SQPushBool(v,false);
break;
}
}
return 1;
}
//»ñÈ¡¾­ÑéÖµ
static int GetExp(uint32_t v)
{
int Type;
int num = SQGetTop(v);
if (num == 2)
{
SQGetInt(v, 2, &Type);
switch (Type)
{
case 0:
SQPushInt(v, DNFTOOL::DNFDeCode(DNFTOOL::GetHook(0x1AB7CDC, "0x3C4C+",1)));
break;
case 1:
SQPushInt(v, DNFTOOL::DNFDeCode(DNFTOOL::GetHook(0x1AB7CDC, "0x3C40+",1)));
break;
default:
SQPushBool(v, false);
break;
}
}
return 1;
}
//·¢°üÀàÐÍ
static int SendPackType(uint32_t v)
@ -875,6 +925,9 @@ void squirrel::R_Register_Nut()
RegisterNutApi(L"L_sq_GetRegionIndex", GetRegionIndex);
RegisterNutApi(L"L_sq_GetTownXpos", GetTownXpos);
RegisterNutApi(L"L_sq_GetTownYpos", GetTownYpos);
RegisterNutApi(L"L_sq_GetFatigue", GetFatigue);
RegisterNutApi(L"L_sq_GetExp", GetExp);
RegisterNutApi(L"L_sq_SendPackType", SendPackType);
RegisterNutApi(L"L_sq_SendPackByte", SendPackByte);
RegisterNutApi(L"L_sq_SendPackWord", SendPackWord);