diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 5d610ae2..aac657b0 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -66,6 +66,7 @@ #include "mt/MergeItem.h" #include "mt/BattleBasicAttribute.h" #include "mt/BattleHeroGrow.h" +#include "mt/MobaRoom.h" #include "pbutils.h" @@ -3472,10 +3473,11 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we GetTrigger()->Die(killer_id, weapon_id); OnDie(); KillMgr::Instance()->OnHumanDead(this, &info); - room->frame_event.AddDead(GetWeakPtrRef(), mt::Param::s().moba_revive_time * 1000); + room->frame_event.AddDead(GetWeakPtrRef(), + room->GetMapMeta()->GetMobaRoomMeta()->revive_time() * 1000); a8::SetBitFlag(status, CS_Reviving); dead_timer = room->xtimer.SetTimeoutWpEx - (mt::Param::s().moba_revive_time * SERVER_FRAME_RATE, + (room->GetMapMeta()->GetMobaRoomMeta()->revive_time() * SERVER_FRAME_RATE, [this] (int event, const a8::Args* args) { if (a8::TIMER_EXEC_EVENT == event) { diff --git a/server/gameserver/mt/Map.cc b/server/gameserver/mt/Map.cc index e75a0d36..4424f143 100644 --- a/server/gameserver/mt/Map.cc +++ b/server/gameserver/mt/Map.cc @@ -4,6 +4,7 @@ #include "mt/MapCollider.h" #include "mt/SafeArea.h" #include "mt/MetaMgr.h" +#include "mt/MobaRoom.h" IMPL_TABLE(mt::Map) @@ -243,6 +244,12 @@ namespace mt if (is_open() && !IsPveMap() && !is_moba() && player() < 10) { A8_ABORT(); } + if (is_moba()) { + moba_room_meta_ = mt::MobaRoom::GetById(map_id()); + if (!moba_room_meta_) { + abort(); + } + } collider_info = MapCollider::GetByName(map_collider()); LoadWorldObjects(world_object_file(), _world_objects, diff --git a/server/gameserver/mt/Map.h b/server/gameserver/mt/Map.h index 0670c452..eba2c9a9 100644 --- a/server/gameserver/mt/Map.h +++ b/server/gameserver/mt/Map.h @@ -46,12 +46,14 @@ namespace mt bool IsPveMap() const; bool IsOpen() const; glm::vec3 GroundSamplingPos() const; + const MobaRoom* GetMobaRoomMeta() const { return moba_room_meta_; } void Init1(); void Init2(); private: glm::vec3 sampling_pos_; + const MobaRoom* moba_room_meta_ = nullptr; void PostProcess(); }; diff --git a/server/gameserver/mt/MobaRoom.cc b/server/gameserver/mt/MobaRoom.cc index ad35135a..1aac4d65 100644 --- a/server/gameserver/mt/MobaRoom.cc +++ b/server/gameserver/mt/MobaRoom.cc @@ -10,6 +10,23 @@ namespace mt void MobaRoom::Init1() { + std::vector strings; + a8::Split(towers(), strings, '|'); + if (strings.size() != 2) { + abort(); + } + for (auto& str : strings) { + std::vector strings2; + a8::Split(str, strings2, ':'); + if (strings2.size() != 4) { + abort(); + } + glm::vec3 center = glm::vec3((float)a8::XValue(strings2[0]).GetDouble(), + (float)a8::XValue(strings2[1]).GetDouble(), + (float)a8::XValue(strings2[2]).GetDouble()); + float radius = (float)a8::XValue(strings2[3]).GetDouble(); + moba_towers.push_back(std::make_tuple(center, radius)); + } } void MobaRoom::Init2() diff --git a/server/gameserver/mt/MobaRoom.h b/server/gameserver/mt/MobaRoom.h index 48195d26..6da720e5 100644 --- a/server/gameserver/mt/MobaRoom.h +++ b/server/gameserver/mt/MobaRoom.h @@ -13,6 +13,7 @@ namespace mt void Init1(); void Init2(); + std::vector> moba_towers; private: }; diff --git a/server/gameserver/mt/Param.cc b/server/gameserver/mt/Param.cc index 3324895e..962639d5 100644 --- a/server/gameserver/mt/Param.cc +++ b/server/gameserver/mt/Param.cc @@ -56,11 +56,6 @@ namespace mt s_.bullet_through_wall_check = GetIntParam("bullet_through_wall_check", 1); s_.revive_count = GetIntParam("revive_count", 1); s_.pvp_revive_time = GetIntParam("pvp_revive_time", 10); - s_.moba_kill_times = GetIntParam("moba_kill_times", 12); - s_.moba_revive_time = GetIntParam("moba_revive_time", 5); - s_.moba_room_time = GetIntParam("moba_room_time", 60 * 3); - s_.moba_tower_interval = GetIntParam("moba_tower_interval", 1); - s_.moba_tower_recover_hp_rate = GetFloatParam("moba_tower_recover_hp_rate", 0.5); s_.battle_gain_exp_radium = GetFloatParam("battle_gain_exp_radium", 2000); s_.battle_gain_exp_rate_killer = GetFloatParam("battle_gain_exp_rate_killer", 0.5); @@ -252,25 +247,6 @@ namespace mt abort(); } } - { - std::vector strings; - a8::Split(GetStringParam("moba_towers"), strings, '|'); - if (strings.size() != 2) { - abort(); - } - for (auto& str : strings) { - std::vector strings2; - a8::Split(str, strings2, ':'); - if (strings2.size() != 4) { - abort(); - } - glm::vec3 center = glm::vec3((float)a8::XValue(strings2[0]).GetDouble(), - (float)a8::XValue(strings2[1]).GetDouble(), - (float)a8::XValue(strings2[2]).GetDouble()); - float radius = (float)a8::XValue(strings2[3]).GetDouble(); - s_.moba_towers.push_back(std::make_tuple(center, radius)); - } - } { std::vector strings; a8::Split(GetStringParam("boss_skill_order"), strings, '|'); diff --git a/server/gameserver/mt/Param.h b/server/gameserver/mt/Param.h index 69ed3a19..a3a992bb 100644 --- a/server/gameserver/mt/Param.h +++ b/server/gameserver/mt/Param.h @@ -130,13 +130,6 @@ namespace mt int revive_count = 1; int pvp_revive_time = 10; - int moba_kill_times = 12; - int moba_revive_time = 2; - int moba_room_time = 60 * 3; - std::vector> moba_towers; - int moba_tower_interval = 1; - float moba_tower_recover_hp_rate = 0.5; - int nature_recover_hp_idletime = 3; int nature_recover_hp_interval = 1; float nature_recover_hp_rate = 0.1f; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index ee4daf57..b0c6caba 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -69,6 +69,7 @@ #include "mt/Robot.h" #include "mt/SafeAreaPos.h" #include "mt/MapThingGroup.h" +#include "mt/MobaRoom.h" const int SHUA_RANGE = 580; @@ -127,7 +128,7 @@ void Room::Init() #endif if (IsMobaModeRoom()) { moba_over_timer = xtimer.SetTimeoutWpEx - (SERVER_FRAME_RATE * mt::Param::s().moba_room_time, + (SERVER_FRAME_RATE * GetMapMeta()->GetMobaRoomMeta()->game_time(), [this] (int event, const a8::Args* args) { if (a8::TIMER_EXEC_EVENT == event) { @@ -157,9 +158,9 @@ void Room::Init() } }, &xtimer_attacher_); - if (mt::Param::s().moba_towers.size() == 2) { + if (GetMapMeta()->GetMobaRoomMeta()->moba_towers.size() == 2) { xtimer.SetIntervalWpEx - (SERVER_FRAME_RATE * mt::Param::s().moba_tower_interval, + (SERVER_FRAME_RATE * GetMapMeta()->GetMobaRoomMeta()->tower_interval(), [this] (int event, const a8::Args* args) { if (a8::TIMER_EXEC_EVENT == event) { @@ -169,7 +170,7 @@ void Room::Init() if (i == 1) { team = GetMobaTeamB(); } - auto tuple = mt::Param::s().moba_towers.at(i); + auto tuple = GetMapMeta()->GetMobaRoomMeta()->moba_towers.at(i); team->TraverseMembers ( [&tuple] (Human* hum) -> bool @@ -179,7 +180,7 @@ void Room::Init() if (!hum->dead && !hum->poisoning && !hum->downed) { if (hum->GetHP() + 1 < hum->GetMaxHP()) { hum->AddHp(hum->GetMaxHP() * - mt::Param::s().moba_tower_recover_hp_rate); + hum->room->GetMapMeta()->GetMobaRoomMeta()->tower_recover_hp_rate()); hum->TryAddBuff(hum, kRecoverHpEffectBuffId); } } diff --git a/server/gameserver/team.cc b/server/gameserver/team.cc index 8acfb96b..cf75e767 100644 --- a/server/gameserver/team.cc +++ b/server/gameserver/team.cc @@ -531,6 +531,7 @@ void Team::IncKillCount() return; } } + #if 0 if (room->IsMobaModeRoom() && kill_count_ + 1 >= mt::Param::s().moba_kill_times) { room->SetVictoryTeam(this); room->xtimer.SetTimeoutWpEx @@ -547,6 +548,7 @@ void Team::IncKillCount() }, &room->xtimer_attacher_); } + #endif ++kill_count_; last_kill_frameno_ = room->GetFrameNo(); }