龙盒完成初版
This commit is contained in:
78
test/STL.cpp
78
test/STL.cpp
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user