This commit is contained in:
Lenheart 2022-04-21 12:48:20 +08:00
parent ba3f6c0325
commit d2fb2a75d2
7 changed files with 150 additions and 29 deletions

View File

@ -284,3 +284,36 @@ void DNFTOOL::GMNotice(char* str, int type, int color)
thisc = *(DWORD*)(thisc + 0x40); thisc = *(DWORD*)(thisc + 0x40);
_Noticecall(thisc, 0, str, color, type, 0, 0, 0); _Noticecall(thisc, 0, str, color, type, 0, 0, 0);
} }
std::string DNFTOOL::GetIP()
{
httplib::SSLClient Tencword("docs.qq.com");
std::string body;
auto res = Tencword.Get("/doc/DQ1dGbVpzTkZDVlhY",
[&](const char* data, size_t data_length) {
body.append(data, data_length);
return true;
});
int strat_index = body.find("Yosin_Ip:");
int end_index = body.find("Yosin_IP");
if (strat_index != -1 && end_index != -1)
{
std::string rqip = body.substr(strat_index + 9, end_index - (strat_index + 9));
return rqip;
}
else
return GetIP();
}
void DNFTOOL::Wchar_tToString(std::string& szDst, wchar_t* wchar)
{
wchar_t* wText = wchar;
DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, NULL, 0, NULL, FALSE);// WideCharToMultiByte的运用
char* psText; // psText为char*的临时数组作为赋值给std::string的中间变量
psText = new char[dwNum];
WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, psText, dwNum, NULL, FALSE);// WideCharToMultiByte的再次运用
szDst = psText;// std::string赋值
delete[]psText;// psText的清除
}

View File

@ -72,12 +72,18 @@ public:
//获取装备偏移地址 //获取装备偏移地址
static int GetEquAddr(int addr); static int GetEquAddr(int addr);
//wchar_t* ת char*
static char* UnicodeToAnsi(const wchar_t* szStr, char* pResult, int maxLen); static char* UnicodeToAnsi(const wchar_t* szStr, char* pResult, int maxLen);
//wchar_t* ת string*
static void Wchar_tToString(std::string& szDst, wchar_t* wchar);
//char* ת wchar_t*
static wchar_t* AnsiToUnicode(const char* szStr, wchar_t* pResult, int maxLen); static wchar_t* AnsiToUnicode(const char* szStr, wchar_t* pResult, int maxLen);
//窗口公告 0x10d //窗口公告 0x10d
static void WindowsNotice(char* str, int type = 0x10d, int b = 0x0); static void WindowsNotice(char* str, int type = 0x10d, int b = 0x0);
//GM公告 //GM公告
static void GMNotice(char* str, int type, int color); static void GMNotice(char* str, int type, int color);
//»ñÈ¡IP
static std::string GetIP();
}; };

View File

@ -1,6 +1,8 @@
#include "pch.h" #include "pch.h"
#include "STL.h" #include "STL.h"
//질분
#if defined DRAGONBOX_SWITCH
void STL::SyncDargonBox_STL() void STL::SyncDargonBox_STL()
{ {
DargonState_STL["dargonmap"].sync = 0; DargonState_STL["dargonmap"].sync = 0;
@ -98,7 +100,10 @@ int STL::SelectDargonModel_STL(int Type)
} }
return 0; return 0;
} }
#endif
//팹繫 STL
#if defined NORMAL_STL
int STL::Check_STL(std::string name,int Type,int idx) int STL::Check_STL(std::string name,int Type,int idx)
{ {
switch (Type) switch (Type)
@ -199,3 +204,4 @@ bool STL::GetBoolArr_STL(std::string name, int idx)
{ {
return BoolArr_STL[name][idx]; return BoolArr_STL[name][idx];
} }
#endif

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
//普通 STL
#if defined NORMAL_STL
//构造int类型容器 //构造int类型容器
static std::map<std::string, int>Int_STL; static std::map<std::string, int>Int_STL;
//构造float类型容器 //构造float类型容器
@ -11,17 +11,6 @@ static std::map<std::string, std::string>String_STL;
//构造bool类型容器 //构造bool类型容器
static std::map<std::string, bool>Bool_STL; static std::map<std::string, bool>Bool_STL;
struct TimeSTLStruct
{
wchar_t* Name;
int Max_Time;
int Now_Time;
long long Static_Time;
HANDLE Thand;
};
//构造Time类型容器
static std::map<wchar_t*, TimeSTLStruct>Time_STL;
//构造intarr类型容器 //构造intarr类型容器
static std::map<std::string, std::map<int, int>>IntArr_STL; static std::map<std::string, std::map<int, int>>IntArr_STL;
//构造floatarr类型容器 //构造floatarr类型容器
@ -31,16 +20,28 @@ static std::map<std::string, std::map<int, std::string>>StringArr_STL;
//构造boolarr类型容器 //构造boolarr类型容器
static std::map<std::string, std::map<int, bool>>BoolArr_STL; static std::map<std::string, std::map<int, bool>>BoolArr_STL;
static std::map<int, int>aod; static std::map<int, int>aod;
static std::map<int, float>bod; static std::map<int, float>bod;
static std::map<int, std::string>cod; static std::map<int, std::string>cod;
static std::map<int, bool>dod; static std::map<int, bool>dod;
#endif
//时间 STL
#if defined TIME_STL
struct TimeSTLStruct
{
wchar_t* Name;
int Max_Time;
int Now_Time;
long long Static_Time;
HANDLE Thand;
};
//构造Time类型容器
static std::map<wchar_t*, TimeSTLStruct>Time_STL;
#endif
ifdenf DRAGONBOX_SWITCH //龙盒
#if defined DRAGONBOX_SWITCH
//抽奖 类型结构体 //抽奖 类型结构体
struct Dargonresult struct Dargonresult
{ {
@ -60,7 +61,7 @@ struct DargonMap
static std::map<std::string, DargonMap>DargonState_STL; static std::map<std::string, DargonMap>DargonState_STL;
//龙盒模式Map //龙盒模式Map
static std::map<std::string, int>DargonModel_STL; static std::map<std::string, int>DargonModel_STL;
ifndef #endif
class STL class STL
{ {
@ -68,8 +69,8 @@ private:
public: public:
//普通 STL
#if defined NORMAL_STL
//查询指定容器是否存在 //查询指定容器是否存在
static int Check_STL(std::string name,int Type,int idx = 0); static int Check_STL(std::string name,int Type,int idx = 0);
//static int Check_STL_Idx(std::string name,int idx); //static int Check_STL_Idx(std::string name,int idx);
@ -92,14 +93,17 @@ public:
static float GetFloatArr_STL(std::string name, int idx); static float GetFloatArr_STL(std::string name, int idx);
static std::string GetStringArr_STL(std::string name, int idx); static std::string GetStringArr_STL(std::string name, int idx);
static bool GetBoolArr_STL(std::string name, int idx); static bool GetBoolArr_STL(std::string name, int idx);
#endif
//龙盒
#if defined DRAGONBOX_SWITCH
static void SyncDargonBox_STL();//同调龙盒包 static void SyncDargonBox_STL();//同调龙盒包
static void DrawDargonBox_STL(char* Buffer);//设置龙盒包 static void DrawDargonBox_STL(char* Buffer);//设置龙盒包
static int SelectDargonBox_STL(int Type,int Index = 0);//获取龙盒包 static int SelectDargonBox_STL(int Type,int Index = 0);//获取龙盒包
static void DrawDargonModel_STL(int Value);//设置龙盒模式 static void DrawDargonModel_STL(int Value);//设置龙盒模式
static int SelectDargonModel_STL(int Type);//获取龙盒模式 static int SelectDargonModel_STL(int Type);//获取龙盒模式
#endif
}; };

View File

@ -20,3 +20,29 @@
#include "rapidjson/filereadstream.h" #include "rapidjson/filereadstream.h"
#include "rapidjson/filewritestream.h" #include "rapidjson/filewritestream.h"
#include "rapidjson/istreamwrapper.h" #include "rapidjson/istreamwrapper.h"
#define CHRATRBT_SWITCH "人物或装备属性 查看 修改 开启"
#define TOWN_SWITCH "城镇类接口 开启"
#define CHRINFO_SWITCH "角色疲劳经验获取 开启"
#define SEND_PACK_SWITCH "发包类 开启"
#define SEND_API_SWITCH "发包功能API 开启"
#define DOFILE_API_SWITCH "L调用 开启"
#define LCOUT_API_SWITCH "L输出公告 开启"
#define NEW_WINDOW_API_SWITCH "L新建窗口 开启"
#define SET_SLOT_API_SWITCH "L设置UI槽 开启"
#define DRAGONBOX_SWITCH "龙盒开启"
#define NORMAL_STL "普通STL开启"
#define TIME_STL "时间STL开启"

View File

@ -5,8 +5,8 @@
#include "DNFTOOL.h" #include "DNFTOOL.h"
//질분
#if defined DRAGONBOX_SWITCH
void sock::Pack_抽奖(int idx, int code, void* p3, void* p4) void sock::Pack_抽奖(int idx, int code, void* p3, void* p4)
{ {
DWORD Size; DWORD Size;
@ -25,12 +25,16 @@ void sock::Pack_
std::cout << u8"130号收包成功" << std::endl; std::cout << u8"130号收包成功" << std::endl;
} }
#endif
void sock::R_Register_Pack() void sock::R_Register_Pack()
{ {
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0); auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
//질분
#if defined DRAGONBOX_SWITCH
Registerfunc(130, Pack_抽奖, 0); Registerfunc(130, Pack_抽奖, 0);
#endif
} }
bool sock::Net_Get_Byte(BYTE& v) bool sock::Net_Get_Byte(BYTE& v)

View File

@ -655,7 +655,8 @@ int squirrel::SetSlot(uint32_t v)
return 1; return 1;
} }
//普通 STL
#if defined NORMAL_STL
//查询 类型容器 //查询 类型容器
int squirrel::Get_STL(uint32_t v) int squirrel::Get_STL(uint32_t v)
{ {
@ -839,8 +840,10 @@ int squirrel::New_STL(uint32_t v)
} }
return 1; return 1;
} }
#endif
//时间 STL
#if defined TIME_STL
//时间容器线程 //时间容器线程
void TimeSTL(LPVOID lpParam) void TimeSTL(LPVOID lpParam)
{ {
@ -934,7 +937,10 @@ int squirrel::Timer_STL(uint32_t v)
} }
return 1; return 1;
} }
#endif
//龙盒
#if defined DRAGONBOX_SWITCH
//同步 龙盒数据包 //同步 龙盒数据包
int squirrel::Sync_Dragon_Pack(uint32_t v) int squirrel::Sync_Dragon_Pack(uint32_t v)
{ {
@ -1050,13 +1056,15 @@ int squirrel::Set_DragonModel(uint32_t v)
} }
return 1; return 1;
} }
#endif
//获取Squirrel v 基址 //获取Squirrel v 基址
inline uint32_t GetSqVm() inline uint32_t GetSqVm()
{ {
return *(uint32_t*)0x1AF3544; return *(uint32_t*)0x1AF3544;
} }
//注册 Nut API
void squirrel::RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v = NULL) void squirrel::RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v = NULL)
{ {
if (v == NULL) if (v == NULL)
@ -1071,41 +1079,75 @@ void squirrel::RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t
void squirrel::R_Register_Nut() void squirrel::R_Register_Nut()
{ {
RegisterNutApi(L"L_sq_Test", squirrel::sq_Test); RegisterNutApi(L"L_sq_Test", squirrel::sq_Test);
//人物或装备属性 查看 修改 开启
#if defined CHRATRBT_SWITCH
RegisterNutApi(L"L_sq_GetCharacterAttribute", squirrel::GetCharacterAttribute);//获取人物或装备属性 RegisterNutApi(L"L_sq_GetCharacterAttribute", squirrel::GetCharacterAttribute);//获取人物或装备属性
RegisterNutApi(L"L_sq_SetCharacterAttribute", squirrel::SetCharacterAttribute);//设置人物或装备属性 RegisterNutApi(L"L_sq_SetCharacterAttribute", squirrel::SetCharacterAttribute);//设置人物或装备属性
#endif
#if defined TOWN_SWITCH
RegisterNutApi(L"L_sq_GetTownIndex", squirrel::GetTownIndex);//获取城镇编号 RegisterNutApi(L"L_sq_GetTownIndex", squirrel::GetTownIndex);//获取城镇编号
RegisterNutApi(L"L_sq_GetRegionIndex", squirrel::GetRegionIndex);//获取区域编号 RegisterNutApi(L"L_sq_GetRegionIndex", squirrel::GetRegionIndex);//获取区域编号
RegisterNutApi(L"L_sq_GetTownXpos", squirrel::GetTownXpos);//获取城镇X坐标 RegisterNutApi(L"L_sq_GetTownXpos", squirrel::GetTownXpos);//获取城镇X坐标
RegisterNutApi(L"L_sq_GetTownYpos", squirrel::GetTownYpos);//获取城镇Y坐标 RegisterNutApi(L"L_sq_GetTownYpos", squirrel::GetTownYpos);//获取城镇Y坐标
#endif
#if defined CHRINFO_SWITCH
RegisterNutApi(L"L_sq_GetFatigue", squirrel::GetFatigue);//获取疲劳值 RegisterNutApi(L"L_sq_GetFatigue", squirrel::GetFatigue);//获取疲劳值
RegisterNutApi(L"L_sq_GetExp", squirrel::GetExp);//获取经验值 RegisterNutApi(L"L_sq_GetExp", squirrel::GetExp);//获取经验值
#endif
#if defined SEND_PACK_SWITCH
RegisterNutApi(L"L_sq_SendPackType", squirrel::SendPackType);//发包类型 RegisterNutApi(L"L_sq_SendPackType", squirrel::SendPackType);//发包类型
RegisterNutApi(L"L_sq_SendPackByte", squirrel::SendPackByte);//包数据Byte RegisterNutApi(L"L_sq_SendPackByte", squirrel::SendPackByte);//包数据Byte
RegisterNutApi(L"L_sq_SendPackWord", squirrel::SendPackWord);//包数据Word RegisterNutApi(L"L_sq_SendPackWord", squirrel::SendPackWord);//包数据Word
RegisterNutApi(L"L_sq_SendPackDWord", squirrel::SendPackDWord);//包数据DWord RegisterNutApi(L"L_sq_SendPackDWord", squirrel::SendPackDWord);//包数据DWord
RegisterNutApi(L"L_sq_SendPackWChar", squirrel::SendPackWChar);//包数据DWord RegisterNutApi(L"L_sq_SendPackWChar", squirrel::SendPackWChar);//包数据DWord
RegisterNutApi(L"L_sq_SendPack", squirrel::SendPack);//发包 RegisterNutApi(L"L_sq_SendPack", squirrel::SendPack);//发包
#if defined SEND_API_SWITCH
RegisterNutApi(L"L_sq_GivePlayerItem", squirrel::GivePlayerItem);//给用户物品 RegisterNutApi(L"L_sq_GivePlayerItem", squirrel::GivePlayerItem);//给用户物品
RegisterNutApi(L"L_sq_GivePlayerEqu", squirrel::GivePlayerEqu);//给用户装备 RegisterNutApi(L"L_sq_GivePlayerEqu", squirrel::GivePlayerEqu);//给用户装备
RegisterNutApi(L"L_sq_GoDungeon", squirrel::GoDungeon);//去副本 RegisterNutApi(L"L_sq_GoDungeon", squirrel::GoDungeon);//去副本
RegisterNutApi(L"L_sq_GoTown", squirrel::GoTown);//去城镇 RegisterNutApi(L"L_sq_GoTown", squirrel::GoTown);//去城镇
RegisterNutApi(L"L_sq_MoveTown", squirrel::MoveTown);//去城镇 RegisterNutApi(L"L_sq_MoveTown", squirrel::MoveTown);//去城镇
#endif
#endif
#if defined DOFILE_API_SWITCH
RegisterNutApi(L"L_sq_Dofile", squirrel::LDofile);//加密读取 RegisterNutApi(L"L_sq_Dofile", squirrel::LDofile);//加密读取
#endif
#if defined LCOUT_API_SWITCH
RegisterNutApi(L"L_cout", squirrel::Lcout);//输出公告 RegisterNutApi(L"L_cout", squirrel::Lcout);//输出公告
#endif
#if defined NEW_WINDOW_API_SWITCH
RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//创建窗口 RegisterNutApi(L"L_NewWindows", squirrel::NewWindows);//创建窗口
#endif
#if defined SET_SLOT_API_SWITCH
RegisterNutApi(L"L_SetSlot", squirrel::SetSlot);//设置槽坐标 RegisterNutApi(L"L_SetSlot", squirrel::SetSlot);//设置槽坐标
#endif
//普通 STL
#if defined NORMAL_STL
RegisterNutApi(L"L_New_STL", squirrel::New_STL);//新建容器 RegisterNutApi(L"L_New_STL", squirrel::New_STL);//新建容器
RegisterNutApi(L"L_Set_STL", squirrel::Set_STL);//设置容器 RegisterNutApi(L"L_Set_STL", squirrel::Set_STL);//设置容器
RegisterNutApi(L"L_Get_STL", squirrel::Get_STL);//获取容器 RegisterNutApi(L"L_Get_STL", squirrel::Get_STL);//获取容器
#endif
//时间 STL
#if defined TIME_STL
RegisterNutApi(L"L_Timer_STL", squirrel::Timer_STL);//时间容器 RegisterNutApi(L"L_Timer_STL", squirrel::Timer_STL);//时间容器
#endif
//龙盒
#if defined DRAGONBOX_SWITCH
RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式 RegisterNutApi(L"L_Get_DragonModel", squirrel::Get_DragonModel);//获取龙盒模式
RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//设置龙盒模式 RegisterNutApi(L"L_Set_DragonModel", squirrel::Set_DragonModel);//设置龙盒模式
RegisterNutApi(L"L_Redom_Dragon", squirrel::Redom_Dragon);//抽奖 RegisterNutApi(L"L_Redom_Dragon", squirrel::Redom_Dragon);//抽奖
RegisterNutApi(L"L_Get_Dragon_Pack", squirrel::Get_Dragon_Pack);//查询龙盒包 RegisterNutApi(L"L_Get_Dragon_Pack", squirrel::Get_Dragon_Pack);//查询龙盒包
RegisterNutApi(L"L_Sync_Dragon_Pack", squirrel::Sync_Dragon_Pack);//同步龙盒包 RegisterNutApi(L"L_Sync_Dragon_Pack", squirrel::Sync_Dragon_Pack);//同步龙盒包
#endif
} }