From d527c83638c48f4cb8647209485803f01c7935a0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 17 Aug 2022 15:59:19 +0800 Subject: [PATCH] 1 --- server/gameserver/incubator.cc | 23 +++++++++++++++++++++++ server/gameserver/incubator.h | 1 + server/gameserver/metadata.cc | 17 +++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/server/gameserver/incubator.cc b/server/gameserver/incubator.cc index 4ab6ad09..6efa37d8 100644 --- a/server/gameserver/incubator.cc +++ b/server/gameserver/incubator.cc @@ -19,6 +19,24 @@ void Incubator::Init() incubator->AutoAllocAndroid(); }, &xtimer_attacher_.timer_list_); + if (room->IsPveRoom()) { + int wave = 0; + for (int time : room->pve_mode_meta->mode_time) { + room->xtimer.AddDeadLineTimerAndAttach + ( + time * SERVER_FRAME_RATE, + a8::XParams() + .SetSender(this) + .SetParam1(wave), + [] (const a8::XParams& param) + { + Incubator* incubator = (Incubator*)param.sender.GetUserData(); + incubator->SpawnWaveMon(param.param1.GetInt()); + }, + &xtimer_attacher_.timer_list_); + ++wave; + } + } } void Incubator::UnInit() @@ -218,3 +236,8 @@ void Incubator::ActiveAndroid(Human* hum, Human* android) })); #endif } + +void Incubator::SpawnWaveMon(int wave) +{ + +} diff --git a/server/gameserver/incubator.h b/server/gameserver/incubator.h index 6504362a..5fdcb32e 100644 --- a/server/gameserver/incubator.h +++ b/server/gameserver/incubator.h @@ -18,6 +18,7 @@ class Incubator private: bool CanSee(Human* hum, Human* exclude_hum); void AutoAllocAndroid(); + void SpawnWaveMon(int wave); private: std::vector hold_humans_; diff --git a/server/gameserver/metadata.cc b/server/gameserver/metadata.cc index 4cf4b179..909c38eb 100644 --- a/server/gameserver/metadata.cc +++ b/server/gameserver/metadata.cc @@ -1637,7 +1637,7 @@ namespace MetaData float PveGemini::GetHpMul() { - + return 0; } void PveGeminiContent::Init() @@ -1647,7 +1647,20 @@ namespace MetaData void PveGeminiMode::Init() { - + { + std::vector strings; + a8::Split(pb->mode_time(), strings, '|'); + for (auto& str : strings) { + int time = a8::XValue(str); + if (time <= 0) { + abort(); + } + if (time > 200) { + abort(); + } + mode_time.push_back(time); + } + } } }