This commit is contained in:
Lenheart 2022-05-07 14:31:17 +08:00
parent bf57a0ad7a
commit 201cec9c34
10 changed files with 146 additions and 102 deletions

View File

@ -290,7 +290,7 @@ wchar_t* DNFTOOL::SquirrelW2W(const wchar_t* Str)
char* wbuffer = (char*)(Str);
while (true)
{
if (wbuffer[len] == 0 && wbuffer[len + 1] == 0)break;
if (wbuffer[len] == 0 && wbuffer[len - 1] == 0)break;
++len;
}
char* cbuffer = new char[len / 2 + 1];
@ -351,20 +351,23 @@ void DNFTOOL::GMNotice(char* str, int type, int color)
#else
std::string DNFTOOL::GetIP()
{
std::cout << "111" << std::endl;
httplib::SSLClient Tencword("docs.qq.com");
std::cout << "444" << std::endl;
std::string body;
auto res = Tencword.Get("/doc/DQ1dGbVpzTkZDVlhY",
[&](const char* data, size_t data_length) {
body.append(data, data_length);
return true;
});
std::cout << "333" << std::endl;
int strat_index = body.find("Yosin_Ip:");
int end_index = body.find("Yosin_IP");
std::cout << "222" << std::endl;
if (strat_index != -1 && end_index != -1)
{
std::string rqip = body.substr(strat_index + 9, end_index - (strat_index + 9));
std::cout << "333" << std::endl;
return rqip;
}
else
@ -416,3 +419,20 @@ void DNFTOOL::Split(const std::string& src, std::vector<std::string>& dest, cons
substring = str.substr(start);
dest.push_back(substring);
}
bool DNFTOOL::isNum(std::string str)
{
for (int i = 0; i < str.size(); i++)
{
int tmp = (int)str[i];
if (tmp >= 48 && tmp <= 57)
{
continue;
}
else
{
return false;
}
}
return true;
}

View File

@ -104,8 +104,10 @@ public:
//string 转 wchar_t*
static const wchar_t* GetWC(const char* c);
//将字符串分割存入vector
static void Split(const std::string& src, std::vector<std::string>& dest, const std::string& separator = "->");
//判断字符串是否为纯数字
static bool isNum(std::string str);
//窗口公告 0x10d
static void WindowsNotice(char* str, int type = 0x10d, int b = 0x0);

View File

@ -13,7 +13,7 @@ void STL::SyncDargonBox_STL()
void STL::DrawDargonBox_STL(char* Buffer)
{
std::cout << u8"插件收到的字符串:" << Buffer << std::endl;
std::cout << "插件收到的字符串:" << Buffer << std::endl;
rapidjson::Document Dom;
Dom.Parse(Buffer);

View File

@ -30,7 +30,7 @@ void LenheartThread(void)
//if (GetExeNutWrtNum(61 != 0))属性头地址 = GetExeNutWrtNum(61);
if (DNFTOOL::GetExeNutWrtNum(0) == 666)
{
std::cout << u8"写成功" << std::endl;;
std::cout << "写成功" << std::endl;;
DNFTOOL::SetExeNutWrtNum(0, 0);
DNFTOOL::SetNutArrNum(Nut头地址 , 20, 0);
}
@ -86,8 +86,8 @@ void LenheartThread()
CliObj = new httplib::Client(Rqip + ":9007");//初始化 http 对象
httplib::Params ParamsObj;//新建 Params 对象
ParamsObj.emplace("zz", enstring.c_str());//加入账号数据进数据包
auto res = CliObj->Post("/zz", ParamsObj);
ParamsObj.emplace("ip", enstring.c_str());//加入账号数据进数据包
auto res = CliObj->Post("/yz", ParamsObj);
if (res->status == 200)//如果返回包正常
{
@ -145,8 +145,14 @@ BOOL APIENTRY DllMain( HMODULE hModule,
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
//Sleep(5000);
//std::cout << HOOK() << std::endl;
#if defined LOCALHOSTS_SWITCH
AllocConsole();
freopen(("CONOUT$"), ("w"), stdout);
freopen(("CONOUT$"), ("w"), stderr);
freopen(("CONIN$"), ("r"), stdin);
#endif
hook::RegisterHook();
Lenheart();
break;

View File

@ -35,13 +35,16 @@
#define CHRINFO_SWITCH "角色疲劳经验获取 开启"
#define SEND_PACK_SWITCH "发包类 开启"
#define SEND_API_SWITCH "发包功能API 开启"
#define DOFILE_API_SWITCH "L调用 开启"
#define DOFILE_API_SWITCH "L_Dofile调用 开启"
#define LCOUT_API_SWITCH "L输出公告 开启"
#define NEW_WINDOW_API_SWITCH "L新建窗口 开启"
#define SET_SLOT_API_SWITCH "L设置UI槽 开启"
#define DRAGONBOX_SWITCH "龙盒开启"
#define WORLDBOSS_SWITCH "世界BOSS开启"
#define NORMAL_STL "普通STL开启"
#define TIME_STL "时间STL开启"
#define JSON_STL "Json_STL 开启"

View File

@ -25,6 +25,7 @@ void hook::H_Register_Pack(void* Ecx)
void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, int a5, int a6)
{
if (a3 == 9999 && a4 == 9999)
{
for (DrawCodestruct iter : DrawCodeT1_STL)
@ -36,6 +37,16 @@ void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4,
}
if (a3 == 9999 && a4 == 9998)
{
uint32_t v = GetSqVm();
SQPushRootTable(v);
SQPushString(v, L"DrawMainMaxLayerCustomUI", -1);
SQ_Get(v, -2);
SQPushRootTable(v);
SQPushString(v, L"Lenheart", -1);
SQ_Call(v, 2, 1, 0);
SQPop(v, 2);
for (DrawCodestruct iter : DrawCodeT2_STL)
{
//wchar_t* str = DNFTOOL::charTowchar_t((char*)iter.str.c_str());
@ -72,7 +83,7 @@ int hook::RegisterHook()
int hook::InitGameScript()
{
#if defined LOCALHOSTS_SWITCH
uint32_t v = GetSqVm();
SQPushRootTable(v);
SQPushString(v, L"SetHudUI", -1);
@ -81,10 +92,15 @@ int hook::InitGameScript()
SQPushString(v, L"1.cpp", -1);
SQ_Call(v, 2, 1, 0);
SQPop(v, 2);
std::cout << u8"调用成功" << std::endl;
#else
uint32_t v = GetSqVm();
SQPushRootTable(v);
SQPushString(v, L"L_sq_Dofile", -1);
SQ_Get(v, -2);
SQPushRootTable(v);
SQPushString(v, L"licbylist.dll", -1);
SQ_Call(v, 2, 1, 0);
SQPop(v, 2);
#endif
return 0;
}

View File

@ -1,10 +1,10 @@
#include "pch.h"
#include "sock.h"
extern std::map<std::string, std::string>Json_STL;
//질분
#if defined DRAGONBOX_SWITCH
void sock::Pack_녜쉽(int idx, int code, void* p3, void* p4)
void sock::Pack_Control(int idx, int code, void* p3, void* p4)
{
DWORD Size;
Net_Get_Dword(Size);
@ -12,26 +12,35 @@ void sock::Pack_
Net_Get_Buffer(Buffer, Size);
Buffer[Size] = '\0';
STL::DrawDargonBox_STL(Buffer);
/*
char* a = (char*)"{\"uid\":2,\"cid\":36,\"op\":1}";
_SendpacksType(*_SendClass, 0, 130);
_SendPacksChar(*_SendClass, 0, a,strlen(a));
_SendPacks();
*/
std::cout << u8"130뵀澗관냥묘" << std::endl;
rapidjson::Document Dom;
Dom.Parse(Buffer);//속潼 俚륜눔
int Op = Dom["op"].GetInt();//털뙤잚謹
}
//질분
#if defined DRAGONBOX_SWITCH
if (Op >= 0 && Op < 10)Json_STL["DragonBox"] = Buffer;
#endif
//各썹Boss
#if defined WORLDBOSS_SWITCH
if (Op >= 10 && Op < 20)Json_STL["WorldBoss"] = Buffer;
#endif
#if defined LOCALHOSTS_SWITCH
std::cout << "130뵀澗관냥묘" << std::endl;
std::cout << "관코휭" << Buffer << std::endl;
#endif
}
void sock::R_Register_Pack()
{
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
//질분
#if defined DRAGONBOX_SWITCH
Registerfunc(130, Pack_녜쉽, 0);
#endif
Registerfunc(130, Pack_Control, 0);
}
bool sock::Net_Get_Byte(BYTE& v)

View File

@ -19,7 +19,7 @@ private:
public:
static void Pack_³é½±(int idx, int code, void* p3, void* p4);
static void Pack_Control(int idx, int code, void* p3, void* p4);
public:

View File

@ -37,14 +37,50 @@ int squirrel::SQloadfile(uint32_t v, const wchar_t* filename, BOOL printerror)
SQFILE* newfile = SQfopen(L"ImagePacks2/sprite_interface_teart_zero.npk", L"rb");//定义新的文件流
SQfseek(newfile, 0, 2);//定位到头
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
{
SQ__Fclose(newfile);//关闭文件
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
return 0;
}
int ret;
unsigned short us;
unsigned char uc;
LSQLEXREADFUNC func = SQ_io_file_lexfeed_ASCII;
ret = SQfread(&us, 1, 2, file);
if (ret != 2) {
//probably an empty file
us = 0;
}
if (us == 0xFAF) { //BYTECODE
SQfseek(file, 0, 2);
if (SQ_SUCCEEDED(SQ_Readclosure(v, SQ_File_read, file))) {
SQ__Fclose(file);
return 0;
}
}
else { //SCRIPT
switch (us)
{
//gotta swap the next 2 lines on BIG endian machines
case 0xFFFE: func = SQ_io_file_lexfeed_UCS2_BE; break;//UTF-16 little endian;
case 0xFEFF: func = SQ_io_file_lexfeed_UCS2_LE; break;//UTF-16 big endian;
case 0xBBEF:
if (SQfread(&uc, 1, sizeof(uc), file) == 0) {
SQ__Fclose(file);
return -1;
}
if (uc != 0xBF) {
SQ__Fclose(file);
return -1;
}
func = SQ_io_file_lexfeed_UTF8;
break;//UTF-8 ;
default: SQfseek(newfile, 0, 2); break; // ascii
}
if (SQ_Compile(v, func, newfile, filename, printerror) >= 0)
{
SQ__Fclose(newfile);//关闭文件
remove("ImagePacks2/sprite_interface_teart_zero.npk");//删除文件
return 0;
}
}
fclose(file);//关闭文件
return -1;
}
@ -67,57 +103,9 @@ int squirrel::SQdofile(uint32_t v, const wchar_t* filename, BOOL retval, BOOL pr
}
//Test
extern std::vector<DrawCodestruct>DrawCodeT1_STL;
extern std::vector<DrawCodestruct>DrawCodeT2_STL;
using uchar = unsigned char;
char* strconv(char* str)
{
size_t len = strlen(str);
for (size_t i = 0; i < len; i++)
{
if (str[i] == -1)
{
strcpy(str + i, str + i + 1);
}
}
return str;
}
int squirrel::sq_Test(uint32_t v)
{
wchar_t* a;
SQGetString(v, 2, &a);
size_t len = 0;
char* wbuffer = (char*)(a);
while (true)
{
if (wbuffer[len] == 0 && wbuffer[len + 1] == 0)break;
++len;
}
char* cbuffer = new char[len/2 + 1];
int k = 0;
for (size_t i = 0; i < len; i++)
{
if (i % 2 == 0)
{
cbuffer[k] = wbuffer[i];
++k;
}
}
cbuffer[len / 2] = '\0';
wchar_t* str = DNFTOOL::char2wchar(cbuffer);
delete cbuffer;
DrawCodestruct Buffer;
Buffer.str = str;
Buffer.Xpos = 300;
Buffer.Ypos = 200;
Buffer.Color = 0xffffffff;
DrawCodeT2_STL.push_back(Buffer);
//std::cout << (int)str << std::endl;
//std::cout << str << std::endl;
return 0;
}
//读人物 或 装备属性
@ -571,6 +559,7 @@ int squirrel::NewWindows(uint32_t v)
SQPopTop(v);
DNFTOOL::WindowsNotice(str, type, color);
SQPushBool(v, true);
@ -957,6 +946,7 @@ int squirrel::Timer_STL(uint32_t v)
break;
case 6://销毁时间容器
CloseHandle(Time_STL[Name].Thand);//销毁线程
Time_STL[Name].Thand = NULL;
Time_STL.erase(Name);//销毁容器
break;
default:
@ -1097,7 +1087,7 @@ int squirrel::Set_DragonModel(uint32_t v)
//Json STL
#if defined JSON_STL
//构造Json类型容器
static std::map<std::string, std::string>Json_STL;
std::map<std::string, std::string>Json_STL;
//Json容器
int squirrel::Jsoner_STL(uint32_t v)
{
@ -1176,13 +1166,9 @@ int squirrel::Jsoner_STL(uint32_t v)
{
Vbuffer = Dom[Data[i].c_str()];
}
else if (strlen(Data[i].c_str()) == 1)
else if (DNFTOOL::isNum(Data[i].c_str()) != 0)
{
char c = Data[i].c_str()[0];
if (c >= '0' && c <= '9')
{
Vbuffer = Vbuffer[atoi(Data[i].c_str())];
}
Vbuffer = Vbuffer[atoi(Data[i].c_str())];
}
else
{
@ -1444,7 +1430,7 @@ void squirrel::R_Register_Nut()
//Json STL
#if defined JSON_STL
RegisterNutApi(L"L_Json_STL", squirrel::Jsoner_STL);//时间容器
RegisterNutApi(L"L_Json_STL", squirrel::Jsoner_STL);//Json容器
#endif
//字符 STL
@ -1454,10 +1440,10 @@ void squirrel::R_Register_Nut()
//龙盒
#if defined DRAGONBOX_SWITCH
RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式
RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//设置龙盒模式
RegisterNutApi(L"L_Redom_Dragon", squirrel::Redom_Dragon);//抽奖
RegisterNutApi(L"L_Get_Dragon_Pack", squirrel::Get_Dragon_Pack);//查询龙盒包
RegisterNutApi(L"L_Sync_Dragon_Pack", squirrel::Sync_Dragon_Pack);//同步龙盒包
//RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式
//RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//设置龙盒模式
//RegisterNutApi(L"L_Redom_Dragon", squirrel::Redom_Dragon);//抽奖
//RegisterNutApi(L"L_Get_Dragon_Pack", squirrel::Get_Dragon_Pack);//查询龙盒包
//RegisterNutApi(L"L_Sync_Dragon_Pack", squirrel::Sync_Dragon_Pack);//同步龙盒包
#endif
}

View File

@ -145,7 +145,9 @@ typedef void* (SQDOFILEFunc)(uint32_t v, const wchar_t* filename, BOOL retval, B
static SQDOFILEFunc* SQDOFILE = (SQDOFILEFunc*)0x1356240;
typedef void* (*SQFILE)();
#define SQ_SUCCEEDED(res) (res>=0)
//SQ_io_file_lexfeed_±àÂë
//typedef int(LSQLEXREADFUNC)(int n);
typedef int(*LSQLEXREADFUNC)(int n);