龙盒完成初版

This commit is contained in:
Lenheart 2022-03-15 09:21:02 +08:00
parent ce6413df51
commit 2e11642e49
6 changed files with 212 additions and 43 deletions

View File

@ -27,6 +27,9 @@ static SendPacksWORD _SendPacksWord = (SendPacksWORD)0x1128580;
typedef int(__fastcall* SendPacksDWORD)(DWORD thisc, int Seat, int Parm);
static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0;
//发包参数 char
typedef int(__fastcall* SendPacksChar)(DWORD thisc, int Seat, char* Parm,int Size);
static SendPacksChar _SendPacksChar = (SendPacksChar)0x11285E0;
//公告Class this地址
typedef DWORD NoticeClass;

View File

@ -1,6 +1,84 @@
#include "pch.h"
#include "STL.h"
void STL::SyncDargonBox_STL()
{
DargonState_STL["dargonmap"].sync = 0;
}
void STL::DrawDargonBox_STL(char* Buffer)
{
std::cout << u8"插件收到的字符串:" << Buffer << std::endl;
rapidjson::Document Dom;
Dom.Parse(Buffer);
//构造龙盒 模式
//DrawDargonModel_STL(Dom["op"].GetInt());
DargonModel_STL["op"] = Dom["op"].GetInt();
//构造res包 结构体
Dargonresult Res_Buffer[10];
if (DargonModel_STL["op"] == 4)
{
Res_Buffer[0].ItemIndex = Dom["result"][0]["item"].GetInt();
Res_Buffer[0].ItemNum = Dom["result"][0]["num"].GetInt();
Res_Buffer[0].ItemGrade = Dom["result"][0]["grade"].GetInt();
}
if (DargonModel_STL["op"] == 6)
{
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();
}
}
//构造龙盒总 结构体
DargonMap M_Buffer;
M_Buffer.LuckyValue = Dom["lucky_value"].GetInt();
M_Buffer.sync = 1;
for (int b = 0; b < 10; ++b)
{
M_Buffer.Result[b] = Res_Buffer[b];
}
//构造 龙盒 奖励数据
DargonState_STL["dargonmap"] = M_Buffer;
}
int STL::SelectDargonBox_STL(int Type , int Index)
{
switch (Type)
{
case 0://物品ID
return DargonState_STL["dargonmap"].Result[Index].ItemIndex;
break;
case 1://物品数量
return DargonState_STL["dargonmap"].Result[Index].ItemNum;
break;
case 2://物品品级
return DargonState_STL["dargonmap"].Result[Index].ItemGrade;
break;
case 3://幸运值
return DargonState_STL["dargonmap"].LuckyValue;
break;
case 4://Sync
return DargonState_STL["dargonmap"].sync;
break;
default:
break;
}
return 404404404;
}
void STL::DrawDargonModel_STL(int Value)
{
DargonModel_STL["op"] = Value;
}
int STL::SelectDargonModel_STL()
{
return DargonModel_STL["op"];
}
int STL::Check_STL(std::string name,int Type,int idx)
{

View File

@ -32,6 +32,7 @@ struct DargonMap
{
int LuckyValue;
Dargonresult Result[10];
int sync;
};
static std::map<std::string, DargonMap>DargonState_STL;
static std::map<std::string, int>DargonModel_STL;
@ -73,5 +74,13 @@ public:
static std::string GetStringArr_STL(std::string name, int idx);
static bool GetBoolArr_STL(std::string name, int idx);
static void SyncDargonBox_STL();//谿딧질분관
static void DrawDargonBox_STL(char* Buffer);//<2F>零질분관
static int SelectDargonBox_STL(int Type,int Index = 0);//삿혤질분관
static void DrawDargonModel_STL(int Value);//<2F>零질분친駕
static int SelectDargonModel_STL();//삿혤질분친駕
};

View File

@ -12,3 +12,11 @@
//#include "squirrel.h"
#include "hook.h"
#include "DNFTOOL.h"
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/istreamwrapper.h"

View File

@ -1,13 +1,8 @@
#include "pch.h"
#include "sock.h"
#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"
#include "DNFTOOL.h"
@ -20,35 +15,12 @@ void sock::Pack_
Net_Get_Buffer(Buffer, Size);
Buffer[Size] = '\0';
rapidjson::Document Dom;
Dom.Parse(Buffer);
//뭐芚질분 친駕
//DargonModel_STL.emplace("op", Dom["op"].GetInt());
DargonModel_STL["op"] = Dom["op"].GetInt();
std::cout << DargonModel_STL["op"] << std::endl;
STL::DrawDargonBox_STL(Buffer);
/*
if (DargonModel_STL["op"] == 4 || DargonModel_STL["op"] == 6)
{
//뭐芚res관 써뭐竟
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();
}
//뭐芚질분悧 써뭐竟
DargonMap M_Buffer;
M_Buffer.LuckyValue = Dom["luckyvalue"].GetInt();
for (int b = 0; b < 10; ++b)
{
M_Buffer.Result[b] = Res_Buffer[b];
}
//뭐芚 질분 쉽쟨鑒앴
DargonState_STL["dargonmap"] = M_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;

View File

@ -730,17 +730,50 @@ static int New_STL(uint32_t v)
return 1;
}
//new
static int Get_DragonModel(uint32_t v)
//谿꼍 질분鑒앴관
static int Sync_Dragon_Pack(uint32_t v)
{
int Model = DargonModel_STL["op"];//질분친駕
std::cout << DargonModel_STL["op"] << std::endl;
int ParameterNum = SQGetTop(v);
std::cout << ParameterNum << std::endl;
if (ParameterNum == 1)
{
SQPushInt(v, Model);
STL::SyncDargonBox_STL();
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
//삿혤 질분鑒앴관
static int Get_Dragon_Pack(uint32_t v)
{
int Type;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 2)
{
SQGetInt(v, 2, &Type);
int Pack_Value;
//데녜친駕
Pack_Value = STL::SelectDargonBox_STL(Type);
SQPushInt(v, Pack_Value);
return 1;
}
if (ParameterNum == 3)
{
int Index;
SQGetInt(v, 2, &Type);
SQGetInt(v, 3, &Index);
int Pack_Value;
Pack_Value = STL::SelectDargonBox_STL(Type, Index);
SQPushInt(v, Pack_Value);
return 1;
}
else
{
@ -751,6 +784,68 @@ static int Get_DragonModel(uint32_t v)
}
//랙箇 역질분
static int Redom_Dragon(uint32_t v)
{
int Type;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 2)
{
SQGetInt(v, 2, &Type);
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
writer.StartObject();
writer.Key("op");
writer.Int(Type);
writer.EndObject();
char* str = (char*)buffer.GetString();
_SendpacksType(*_SendClass, 0, 130);
_SendPacksChar(*_SendClass, 0, str,strlen(str));
_SendPacks();
}
else
{
SQPushBool(v, false);
}
return 1;
}
//삿혤 질분 친駕
static int Get_DragonModel(uint32_t v)
{
int Model = STL::SelectDargonModel_STL();//질분친駕
int ParameterNum = SQGetTop(v);
if (ParameterNum == 1)
{
SQPushInt(v, Model);
}
else
{
SQPushBool(v, false);
}
return 1;
}
//<2F>零 질분 친駕
static int Set_DragonModel(uint32_t v)
{
int Model;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 2)
{
SQGetInt(v, 2, &Model);
STL::DrawDargonModel_STL(Model);//질분친駕
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
//»ñÈ¡Squirrel v »ùÖ·
inline uint32_t GetSqVm()
@ -798,5 +893,9 @@ void squirrel::R_Register_Nut()
RegisterNutApi(L"L_Get_DragonModel", Get_DragonModel);
RegisterNutApi(L"L_Get_DragonModel", Get_DragonModel);//삿혤질분친駕
RegisterNutApi(L"L_Set_DragonModel", Set_DragonModel);//<2F>零질분친駕
RegisterNutApi(L"L_Redom_Dragon", Redom_Dragon);//녜쉽
RegisterNutApi(L"L_Get_Dragon_Pack", Get_Dragon_Pack);//꿴璂질분관
RegisterNutApi(L"L_Sync_Dragon_Pack", Sync_Dragon_Pack);//谿꼍질분관
}