龙盒完成初版

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

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;
}
//设置 龙盒 模式
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);//设置龙盒模式
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);//同步龙盒包
}