1231
This commit is contained in:
126
src/df_main.cpp
126
src/df_main.cpp
@@ -44,9 +44,29 @@ SUBHOOK_INIT(History_Log, 0x854F990);
|
||||
SUBHOOK_INIT(UseGlod, 0x84FF54C);
|
||||
SUBHOOK_INIT(BossDieCheckSend, 0x81CDA62);
|
||||
SUBHOOK_INIT(Giveup_Game, 0x81C40B4);
|
||||
SUBHOOK_INIT(CUserWorkPerFiveMin, 0x8652F0C);
|
||||
SUBHOOK_INIT(TimerDispatcher_dispatch, 0x8632A18);
|
||||
|
||||
//_setCharacInfoDetail
|
||||
|
||||
template <typename R, typename A, typename... ARG>
|
||||
R CallMain(A call_addr, const ARG... arguments)
|
||||
{
|
||||
if (!call_addr)
|
||||
{
|
||||
return R();
|
||||
}
|
||||
const auto control = reinterpret_cast<R (*)(ARG...)>(call_addr);
|
||||
try
|
||||
{
|
||||
return control(arguments...);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
return R();
|
||||
}
|
||||
|
||||
int checkGame(const char *pName)
|
||||
{
|
||||
char path[256];
|
||||
@@ -530,34 +550,6 @@ int _LenGetTimerMess(void *TimerQueue, void *TimerEntry)
|
||||
return LenGetTimerMess(TimerQueue, TimerEntry);
|
||||
}
|
||||
|
||||
// void ReqScript()
|
||||
// {
|
||||
// asio::io_context io_context;
|
||||
// asio::ip::tcp::resolver resolver(io_context);
|
||||
// asio::ip::tcp::socket socket(io_context);
|
||||
|
||||
// // 解析主机名和端口号
|
||||
// auto endpoints = resolver.resolve("110.42.251.214", "9007");
|
||||
|
||||
// // 连接到服务器
|
||||
// asio::connect(socket, endpoints);
|
||||
|
||||
// // 发送 HTTP GET 请求
|
||||
// asio::write(socket, asio::buffer("GET /user/getuser4 HTTP/1.1\r\nHost: 110.42.251.214\r\nConnection: close\r\n\r\n"));
|
||||
|
||||
// // 读取服务器的响应
|
||||
// asio::streambuf response;
|
||||
// asio::read_until(socket, response, "\r\n");
|
||||
|
||||
// // 输出响应
|
||||
// std::istream response_stream(&response);
|
||||
// std::string http_version;
|
||||
// response_stream >> http_version;
|
||||
|
||||
// std::cout << "Response:\n";
|
||||
// std::cout << &response;
|
||||
// }
|
||||
|
||||
int _UseGlod(void *CUser, int a1, int a3, int a4)
|
||||
{
|
||||
return UseGlod(CUser, a1, a3, a4);
|
||||
@@ -567,17 +559,17 @@ void PrintAuroraTag()
|
||||
{
|
||||
printf("\n");
|
||||
|
||||
YLOG("**********************************************************");
|
||||
YLOG(" DNF_Server Plugin S%s ", MY_VERSION);
|
||||
YLOG(" By:Rindro-Aurora ");
|
||||
YLOG(" PowerBy:Vance ");
|
||||
YLOG("**********************************************************");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
// YLOG("**********************************************************");
|
||||
// YLOG(" DNF_Server Plugin S%s ", MY_VERSION);
|
||||
// YLOG(" By:Rindro-Aurora ");
|
||||
// YLOG(" PowerBy:Vance ");
|
||||
// YLOG("**********************************************************");
|
||||
// YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
// YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
// YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
// YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
// YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
// YLOG("DP_S插件已加载*************************************凌众-极光");
|
||||
}
|
||||
|
||||
int _Inter_LoadGeolocation_dispatch_sig(void *pThis, void *pUser, char *a3)
|
||||
@@ -617,14 +609,6 @@ bool _CreateSkill(int a1, int a2)
|
||||
{
|
||||
char *Str = (char *)(a2 + 121);
|
||||
char *Str1 = (char *)(a2 + 529);
|
||||
// Str[6] = 8;
|
||||
// Str[7] = 1;
|
||||
// Str1[6] = 8;
|
||||
// Str1[7] = 1;
|
||||
// Str[8] = 36;
|
||||
// Str[9] = 1;
|
||||
// Str1[8] = 36;
|
||||
// Str1[9] = 1;
|
||||
std::cout << "Str: " << Str << std::endl;
|
||||
std::cout << "Str1: " << Str1 << std::endl;
|
||||
|
||||
@@ -718,6 +702,50 @@ void _Giveup_Game(void *CParty, void *CUser, bool a3, bool a4, bool a5)
|
||||
Giveup_Game(CParty, CUser, a3, a4, a5);
|
||||
}
|
||||
|
||||
void _CUserWorkPerFiveMin(void *CUser)
|
||||
{
|
||||
// 用户每五分钟执行
|
||||
std::lock_guard<std::recursive_mutex> lock(SqMtx);
|
||||
// 执行虚拟机Main函数
|
||||
SQInteger top = sq_gettop(v); // saves the stack size before the call
|
||||
sq_pushroottable(v); // pushes the global table
|
||||
sq_pushstring(v, _SC("Cb_user_workperfivemin"), -1);
|
||||
if (SQ_SUCCEEDED(sq_get(v, -2)))
|
||||
{ // gets the fie123oo' from the global table
|
||||
sq_pushroottable(v); // push the 'this' (in this case is the global table)
|
||||
sq_pushuserpointer(v, CUser);
|
||||
sq_call(v, 2, SQFalse, SQTrue); // calls the function
|
||||
}
|
||||
sq_settop(v, top); // restores the original stack size
|
||||
CUserWorkPerFiveMin(CUser);
|
||||
}
|
||||
|
||||
int _TimerDispatcher_dispatch(void *A, void *B)
|
||||
{
|
||||
int ret = TimerDispatcher_dispatch(A, B);
|
||||
// void *a1 = malloc(100);
|
||||
// void *mutexobj = CallMain<void *>(0x810544C, a1, (char *)CallMain<void *>(0x80F647C) + 16);
|
||||
|
||||
if (v)
|
||||
{
|
||||
// 用户每五分钟执行
|
||||
std::lock_guard<std::recursive_mutex> lock(SqMtx);
|
||||
// 执行虚拟机Main函数
|
||||
SQInteger top = sq_gettop(v); // saves the stack size before the call
|
||||
sq_pushroottable(v); // pushes the global table
|
||||
sq_pushstring(v, _SC("Cb_timer_dispatch"), -1);
|
||||
if (SQ_SUCCEEDED(sq_get(v, -2)))
|
||||
{ // gets the fie123oo' from the global table
|
||||
sq_pushroottable(v); // push the 'this' (in this case is the global table)
|
||||
sq_call(v, 1, SQFalse, SQTrue); // calls the function
|
||||
}
|
||||
sq_settop(v, top); // restores the original stack size
|
||||
}
|
||||
|
||||
// CallMain<int>(0x8105468, mutexobj);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Lenheart()
|
||||
{
|
||||
|
||||
@@ -800,6 +828,10 @@ void Lenheart()
|
||||
SUBHOOK_SETUP(BossDieCheckSend);
|
||||
// 放弃副本
|
||||
SUBHOOK_SETUP(Giveup_Game);
|
||||
// 用户每五分钟执行
|
||||
SUBHOOK_SETUP(CUserWorkPerFiveMin);
|
||||
// 每帧执行
|
||||
SUBHOOK_SETUP(TimerDispatcher_dispatch);
|
||||
|
||||
// SUBHOOK_SETUP(doDispatch); // 收包注册
|
||||
|
||||
|
||||
@@ -103,4 +103,10 @@ typedef void (*fnBossDieCheckSend)(void *a1, void *a2, void *a3);
|
||||
// 放弃副本
|
||||
typedef void (*fnGiveup_Game)(void *CParty, void *CUser, bool a3, bool a4, bool a5);
|
||||
|
||||
// 用户每五分钟执行一次
|
||||
typedef void (*fnCUserWorkPerFiveMin)(void *CUser);
|
||||
|
||||
// 线程执行
|
||||
typedef int (*fnTimerDispatcher_dispatch)(void *A, void *B);
|
||||
|
||||
__END_DECLS
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <chrono>
|
||||
#include "SqrReqScript.hpp"
|
||||
|
||||
// #define WEBSCRIPT true;
|
||||
|
||||
using asio::ip::tcp;
|
||||
|
||||
static char szGamePathA[256];
|
||||
@@ -161,10 +163,13 @@ static void ReloadingScript(HSQUIRRELVM v, std::string FilePath)
|
||||
|
||||
static SQInteger SqReloadScript(HSQUIRRELVM v)
|
||||
{
|
||||
// ReloadingScript(v, "/dp_s/Dps_A/");
|
||||
// ReloadingScript(v, "/dp_s/Dps_B/");
|
||||
// ReloadingScript(v, "/dp_s/Dps_C/");
|
||||
#ifdef WEBSCRIPT
|
||||
ReqSquirrelScript(v);
|
||||
#else
|
||||
ReloadingScript(v, "/dp_s/Dps_A/");
|
||||
ReloadingScript(v, "/dp_s/Dps_B/");
|
||||
ReloadingScript(v, "/dp_s/Dps_C/");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -193,13 +198,15 @@ void InitSquirrel()
|
||||
// 注册全局NutApi
|
||||
GlobaRegisterSquirrel(v);
|
||||
|
||||
#ifdef WEBSCRIPT
|
||||
// 从网络加载脚本
|
||||
// ReqSquirrelScript(v);
|
||||
|
||||
ReqSquirrelScript(v);
|
||||
#else
|
||||
// 加载基础脚本文件
|
||||
ReloadingScript(v, "/dp_s/Dps_A/");
|
||||
ReloadingScript(v, "/dp_s/Dps_B/");
|
||||
ReloadingScript(v, "/dp_s/Dps_C/");
|
||||
#endif
|
||||
|
||||
// 执行虚拟机Main函数
|
||||
SQInteger top = sq_gettop(v); // saves the stack size before the call
|
||||
|
||||
Reference in New Issue
Block a user