2022-03-08 12:57:35 +08:00
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
#include "sock.h"
|
|
|
|
|
|
|
2022-03-10 20:33:31 +08:00
|
|
|
|
#include "rapidjson/document.h"
|
|
|
|
|
|
#include "rapidjson/writer.h"
|
|
|
|
|
|
#include "rapidjson/stringbuffer.h"
|
|
|
|
|
|
#include "rapidjson/filereadstream.h"
|
|
|
|
|
|
#include "rapidjson/filewritestream.h"
|
|
|
|
|
|
#include "rapidjson/istreamwrapper.h"
|
|
|
|
|
|
#include "STL.h"
|
|
|
|
|
|
|
2022-03-11 07:10:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD> <20>齱 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
struct Dargonresult
|
|
|
|
|
|
{
|
|
|
|
|
|
int ItemIndex;
|
|
|
|
|
|
int ItemNum;
|
|
|
|
|
|
int ItemGrade;
|
|
|
|
|
|
};
|
|
|
|
|
|
struct DargonMap
|
|
|
|
|
|
{
|
|
|
|
|
|
int Op;
|
|
|
|
|
|
int LuckyValue;
|
|
|
|
|
|
Dargonresult Result[10];
|
|
|
|
|
|
};
|
|
|
|
|
|
static std::map<std::string, DargonMap>Dargon_STL;
|
|
|
|
|
|
|
2022-03-09 16:27:06 +08:00
|
|
|
|
void sock::Pack_<EFBFBD>齱(int idx, int code, void* p3, void* p4)
|
2022-03-08 12:57:35 +08:00
|
|
|
|
{
|
2022-03-10 20:33:31 +08:00
|
|
|
|
DWORD Size;
|
|
|
|
|
|
Net_Get_Dword(Size);
|
|
|
|
|
|
char* Buffer = new char[Size+1];
|
|
|
|
|
|
Net_Get_Buffer(Buffer, Size);
|
|
|
|
|
|
Buffer[Size] = '\0';
|
|
|
|
|
|
|
|
|
|
|
|
rapidjson::Document Dom;
|
|
|
|
|
|
Dom.Parse(Buffer);
|
|
|
|
|
|
|
2022-03-11 07:10:23 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>res<65><73> <20>ṹ<EFBFBD><E1B9B9>
|
|
|
|
|
|
Dargonresult Res_Buffer[10];
|
|
|
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
Res_Buffer[i].ItemIndex = Dom["result"][i]["item"].GetInt();
|
|
|
|
|
|
Res_Buffer[i].ItemNum = Dom["result"][i]["num"].GetInt();
|
|
|
|
|
|
Res_Buffer[i].ItemGrade = Dom["result"][i]["grade"].GetInt();
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ṹ<EFBFBD><E1B9B9>
|
|
|
|
|
|
DargonMap M_Buffer;
|
|
|
|
|
|
M_Buffer.Op = Dom["op"].GetInt();
|
|
|
|
|
|
M_Buffer.LuckyValue = Dom["luckyvalue"].GetInt();
|
|
|
|
|
|
for (int b = 0; b < 10; ++b)
|
|
|
|
|
|
{
|
|
|
|
|
|
M_Buffer.Result[b] = Res_Buffer[b];
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> map
|
|
|
|
|
|
Dargon_STL["dargonmap"] = M_Buffer;
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-08 12:57:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sock::R_Register_Pack()
|
|
|
|
|
|
{
|
|
|
|
|
|
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
|
|
|
|
|
|
|
2022-03-09 16:27:06 +08:00
|
|
|
|
Registerfunc(130, Pack_<EFBFBD>齱, 0);
|
2022-03-08 12:57:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-10 20:33:31 +08:00
|
|
|
|
bool sock::Net_Get_Byte(BYTE& v)
|
2022-03-08 12:57:35 +08:00
|
|
|
|
{
|
2022-03-10 20:33:31 +08:00
|
|
|
|
typedef bool(__cdecl* func_t)(BYTE*);
|
2022-03-08 12:57:35 +08:00
|
|
|
|
return reinterpret_cast<func_t>(0x011AEA00)(&v);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-10 20:33:31 +08:00
|
|
|
|
bool sock::Net_Get_Short(short int& v)
|
2022-03-08 12:57:35 +08:00
|
|
|
|
{
|
2022-03-10 20:33:31 +08:00
|
|
|
|
typedef bool(__cdecl* func_t)(short int*);
|
2022-03-08 12:57:35 +08:00
|
|
|
|
return reinterpret_cast<func_t>(0x011AEA30)(&v);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-10 20:33:31 +08:00
|
|
|
|
bool sock::Net_Get_Dword(DWORD& v)
|
2022-03-08 12:57:35 +08:00
|
|
|
|
{
|
2022-03-10 20:33:31 +08:00
|
|
|
|
typedef bool(__cdecl* func_t)(DWORD*);
|
2022-03-08 12:57:35 +08:00
|
|
|
|
return reinterpret_cast<func_t>(0x011AEA60)(&v);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-10 20:33:31 +08:00
|
|
|
|
bool sock::Net_Get_Buffer(char* v, int sz)
|
2022-03-08 12:57:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
typedef bool(__cdecl* func_t)(char*, int);
|
|
|
|
|
|
return reinterpret_cast<func_t>(0x011AEA90)(v, sz);
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
|
|
bool sock::HookRegistPackHandler(int idx, pack_handler_t handler)
|
|
|
|
|
|
{
|
|
|
|
|
|
return handleTable.emplace(idx, handler).second;
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|