2022-03-09 16:27:06 +08:00
|
|
|
|
#include "pch.h"
|
|
|
|
|
|
#include "STL.h"
|
|
|
|
|
|
|
2022-03-15 09:21:02 +08:00
|
|
|
|
void STL::SyncDargonBox_STL()
|
|
|
|
|
|
{
|
|
|
|
|
|
DargonState_STL["dargonmap"].sync = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::DrawDargonBox_STL(char* Buffer)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::cout << u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>:" << Buffer << std::endl;
|
|
|
|
|
|
rapidjson::Document Dom;
|
|
|
|
|
|
Dom.Parse(Buffer);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ģʽ
|
|
|
|
|
|
//DrawDargonModel_STL(Dom["op"].GetInt());
|
|
|
|
|
|
DargonModel_STL["op"] = Dom["op"].GetInt();
|
2022-03-21 11:51:20 +08:00
|
|
|
|
DargonModel_STL["err"] = Dom["err"].GetInt();
|
2022-04-15 18:34:06 +08:00
|
|
|
|
DargonModel_STL["port"] = Dom["port"].GetInt();
|
2022-03-15 09:21:02 +08:00
|
|
|
|
|
2022-03-21 11:51:20 +08:00
|
|
|
|
if (DargonModel_STL["err"] != 0)return;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-03-15 09:21:02 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>res<65><73> <20>ṹ<EFBFBD><E1B9B9>
|
|
|
|
|
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ṹ<EFBFBD><E1B9B9>
|
|
|
|
|
|
DargonMap M_Buffer;
|
|
|
|
|
|
M_Buffer.LuckyValue = Dom["lucky_value"].GetInt();
|
|
|
|
|
|
M_Buffer.sync = 1;
|
2022-03-16 10:03:39 +08:00
|
|
|
|
M_Buffer.box_num = Dom["box_num"].GetInt();
|
2022-03-15 09:21:02 +08:00
|
|
|
|
for (int b = 0; b < 10; ++b)
|
|
|
|
|
|
{
|
|
|
|
|
|
M_Buffer.Result[b] = Res_Buffer[b];
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
DargonState_STL["dargonmap"] = M_Buffer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int STL::SelectDargonBox_STL(int Type , int Index)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0://<2F><>ƷID
|
|
|
|
|
|
return DargonState_STL["dargonmap"].Result[Index].ItemIndex;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1://<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|
|
|
|
|
return DargonState_STL["dargonmap"].Result[Index].ItemNum;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2://<2F><>ƷƷ<C6B7><C6B7>
|
|
|
|
|
|
return DargonState_STL["dargonmap"].Result[Index].ItemGrade;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3://<2F><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
return DargonState_STL["dargonmap"].LuckyValue;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 4://Sync
|
|
|
|
|
|
return DargonState_STL["dargonmap"].sync;
|
|
|
|
|
|
break;
|
2022-03-16 10:03:39 +08:00
|
|
|
|
case 5://Box_num
|
|
|
|
|
|
return DargonState_STL["dargonmap"].box_num;
|
|
|
|
|
|
break;
|
2022-03-15 09:21:02 +08:00
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return 404404404;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::DrawDargonModel_STL(int Value)
|
|
|
|
|
|
{
|
|
|
|
|
|
DargonModel_STL["op"] = Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-21 11:51:20 +08:00
|
|
|
|
int STL::SelectDargonModel_STL(int Type)
|
2022-03-15 09:21:02 +08:00
|
|
|
|
{
|
2022-03-21 11:51:20 +08:00
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
return DargonModel_STL["op"];
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
return DargonModel_STL["err"];
|
|
|
|
|
|
break;
|
2022-04-15 18:34:06 +08:00
|
|
|
|
case 2:
|
|
|
|
|
|
return DargonModel_STL["port"];
|
|
|
|
|
|
break;
|
2022-03-21 11:51:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
2022-03-15 09:21:02 +08:00
|
|
|
|
}
|
2022-03-09 16:27:06 +08:00
|
|
|
|
|
|
|
|
|
|
int STL::Check_STL(std::string name,int Type,int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
return Int_STL.count(name);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
return Float_STL.count(name);
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
return String_STL.count(name);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
return Bool_STL.count(name);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
return IntArr_STL[name].count(idx);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
return FloatArr_STL[name].count(idx);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 6:
|
|
|
|
|
|
return StringArr_STL[name].count(idx);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 7:
|
|
|
|
|
|
return BoolArr_STL[name].count(idx);
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::BuildIntArr_STL(std::string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
//aod.emplace(0, 0);
|
|
|
|
|
|
IntArr_STL.emplace(name, aod);
|
|
|
|
|
|
//aod.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::BuildFloatArr_STL(std::string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
//bod.emplace(0, 0.0);
|
|
|
|
|
|
FloatArr_STL.emplace(name, bod);
|
|
|
|
|
|
//bod.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::BuildStringArr_STL(std::string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
//cod.emplace(0, "zero");
|
|
|
|
|
|
StringArr_STL.emplace(name, cod);
|
|
|
|
|
|
//cod.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::BuildBoolArr_STL(std::string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
//dod.emplace(0, false);
|
|
|
|
|
|
BoolArr_STL.emplace(name, dod);
|
|
|
|
|
|
//dod.clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::SetIntArr_STL(std::string name, int idx, int value)
|
|
|
|
|
|
{
|
|
|
|
|
|
IntArr_STL[name][idx] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::SetFloatArr_STL(std::string name, int idx, float value)
|
|
|
|
|
|
{
|
|
|
|
|
|
FloatArr_STL[name][idx] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::SetStringArr_STL(std::string name, int idx, std::string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
StringArr_STL[name][idx] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void STL::SetBoolArr_STL(std::string name, int idx, bool value)
|
|
|
|
|
|
{
|
|
|
|
|
|
BoolArr_STL[name][idx] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int STL::GetIntArr_STL(std::string name, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
return IntArr_STL[name][idx];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float STL::GetFloatArr_STL(std::string name, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FloatArr_STL[name][idx];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string STL::GetStringArr_STL(std::string name, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
return StringArr_STL[name][idx];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool STL::GetBoolArr_STL(std::string name, int idx)
|
|
|
|
|
|
{
|
|
|
|
|
|
return BoolArr_STL[name][idx];
|
|
|
|
|
|
}
|