diff --git a/server/gameserver/mt/PveGeminiContent.cc b/server/gameserver/mt/PveGeminiContent.cc index bb260ecc..a923320e 100644 --- a/server/gameserver/mt/PveGeminiContent.cc +++ b/server/gameserver/mt/PveGeminiContent.cc @@ -16,4 +16,9 @@ namespace mt } } + std::vector* PveGeminiContent::GetContentsByMode(int mode) + { + return nullptr; + } + } diff --git a/server/gameserver/mt/PveGeminiContent.h b/server/gameserver/mt/PveGeminiContent.h index 1b5887ce..4689fbaa 100644 --- a/server/gameserver/mt/PveGeminiContent.h +++ b/server/gameserver/mt/PveGeminiContent.h @@ -15,6 +15,7 @@ namespace mt std::vector enemys; void Init1(); + static std::vector* GetContentsByMode(int mode); }; } diff --git a/server/gameserver/mt/PveGeminiMode.cc b/server/gameserver/mt/PveGeminiMode.cc index 3e4744d8..ffb97a8f 100644 --- a/server/gameserver/mt/PveGeminiMode.cc +++ b/server/gameserver/mt/PveGeminiMode.cc @@ -1,6 +1,8 @@ #include "precompile.h" #include "mt/PveGeminiMode.h" +#include "mt/PveGeminiContent.h" +#include "mt/SafeArea.h" IMPL_TABLE(mt::PveGeminiMode) @@ -20,32 +22,32 @@ namespace mt if (time > 200) { abort(); } - mode_time.push_back(time); + _mode_time.push_back(time); } } { std::vector strings; a8::Split(area(), strings, '|'); for (auto& str : strings) { - MetaData::SafeArea* p = MetaMgr::Instance()->GetSafeArea(a8::XValue(str)); + mt::SafeArea* p = mt::SafeArea::GetById(a8::XValue(str)); if (!p) { abort(); } - area.push_back(p); + _area.push_back(p); } } - if (area.empty()) { + if (_area.empty()) { abort(); } - waves.resize(mode_time.size()); - for (auto& content : *MetaMgr::Instance()->GetPveGeminiContents(id())) { - if (content.round() <= 0 || - content.round() > mode_time.size()) { + _waves.resize(_mode_time.size()); + for (auto& content : *mt::PveGeminiContent::GetContentsByMode(id())) { + if (content->round() <= 0 || + content->round() > _mode_time.size()) { abort(); } - waves[content.round() - 1].push_back(&content); - if (content.round() >= waves.size()) { - if (content.enemys.size() != 1) { + _waves[content->round() - 1].push_back(content); + if (content->round() >= _waves.size()) { + if (content->enemys.size() != 1) { abort(); } } @@ -58,10 +60,10 @@ namespace mt if (a8::XValue(str).GetInt() <= last_val) { abort(); } - score_reward.push_back(a8::XValue(str).GetInt()); + _score_reward.push_back(a8::XValue(str).GetInt()); last_val = a8::XValue(str); } - if (score_reward.size() < 0) { + if (_score_reward.size() < 0) { abort(); } } @@ -69,9 +71,9 @@ namespace mt std::vector strings; a8::Split(round_score(), strings, '|'); for (std::string& str : strings) { - round_score.push_back(a8::XValue(str).GetInt()); + _round_score.push_back(a8::XValue(str).GetInt()); } - if (round_score.size() != waves.size()) { + if (_round_score.size() != _waves.size()) { abort(); } } @@ -89,9 +91,9 @@ namespace mt v.x = a8::XValue(strings2[0]).GetDouble(); v.y = 0.0f; v.y = a8::XValue(strings2[1]).GetDouble(); - next_door.push_back(v); + _next_door.push_back(v); } - if (next_door.size() + 1 != waves.size()) { + if (_next_door.size() + 1 != _waves.size()) { abort(); } } @@ -101,8 +103,8 @@ namespace mt int PveGeminiMode::CalcStar(int score) { int star = 0; - for (int i = 0; i < score_reward.size(); ++i) { - if (score >= score_reward[i]) { + for (int i = 0; i < _score_reward.size(); ++i) { + if (score >= _score_reward[i]) { star = i + 1; } else { break; diff --git a/server/gameserver/mt/PveGeminiMode.h b/server/gameserver/mt/PveGeminiMode.h index 8c1d4a29..6cd22dee 100644 --- a/server/gameserver/mt/PveGeminiMode.h +++ b/server/gameserver/mt/PveGeminiMode.h @@ -12,8 +12,8 @@ namespace mt public: std::vector _mode_time; - std::vector _area; - std::vector> _waves; + std::vector _area; + std::vector> _waves; std::vector _score_reward; std::vector _round_score; std::vector _next_door; diff --git a/server/gameserver/mt/Robot.cc b/server/gameserver/mt/Robot.cc index 842af0c1..24677b1b 100644 --- a/server/gameserver/mt/Robot.cc +++ b/server/gameserver/mt/Robot.cc @@ -12,9 +12,9 @@ namespace mt std::vector strings; a8::Split(skin_id(), strings, '|'); for (auto& str : strings) { - skin_id.push_back(a8::XValue(str)); + _skin_id.push_back(a8::XValue(str)); } - if (skin_id.size() != 3) { + if (_skin_id.size() != 3) { A8_ABORT(); } } diff --git a/server/gameserver/mt/SafeAreaPos.cc b/server/gameserver/mt/SafeAreaPos.cc index 48c221ed..5ae3fcd7 100644 --- a/server/gameserver/mt/SafeAreaPos.cc +++ b/server/gameserver/mt/SafeAreaPos.cc @@ -11,22 +11,22 @@ namespace mt { std::vector tmp_list; { - tmp_list.push_back(a8::Vec2(pb->x1(), pb->y1())); - tmp_list.push_back(a8::Vec2(pb->x2(), pb->y2())); - tmp_list.push_back(a8::Vec2(pb->x3(), pb->y3())); - tmp_list.push_back(a8::Vec2(pb->x4(), pb->y4())); - tmp_list.push_back(a8::Vec2(pb->x5(), pb->y5())); - tmp_list.push_back(a8::Vec2(pb->x6(), pb->y6())); - tmp_list.push_back(a8::Vec2(pb->x7(), pb->y7())); - tmp_list.push_back(a8::Vec2(pb->x8(), pb->y8())); - tmp_list.push_back(a8::Vec2(pb->x9(), pb->y9())); - tmp_list.push_back(a8::Vec2(pb->x10(), pb->y10())); + tmp_list.push_back(a8::Vec2(x1(), y1())); + tmp_list.push_back(a8::Vec2(x2(), y2())); + tmp_list.push_back(a8::Vec2(x3(), y3())); + tmp_list.push_back(a8::Vec2(x4(), y4())); + tmp_list.push_back(a8::Vec2(x5(), y5())); + tmp_list.push_back(a8::Vec2(x6(), y6())); + tmp_list.push_back(a8::Vec2(x7(), y7())); + tmp_list.push_back(a8::Vec2(x8(), y8())); + tmp_list.push_back(a8::Vec2(x9(), y9())); + tmp_list.push_back(a8::Vec2(x10(), y10())); } for (auto& pos : tmp_list) { if (pos.x < 1.0f || pos.y < 1.0f) { break; } - poses.push_back(pos); + _poses.push_back(pos); } } diff --git a/server/gameserver/mt/Skill.cc b/server/gameserver/mt/Skill.cc index 462268a9..500a0e9d 100644 --- a/server/gameserver/mt/Skill.cc +++ b/server/gameserver/mt/Skill.cc @@ -1,25 +1,29 @@ #include "precompile.h" #include "mt/Skill.h" +#include "mt/Buff.h" +#include "mt/SkillNumber.h" +#include "skillhelper.h" IMPL_TABLE(mt::Skill) namespace mt { - void Skill::Init() + void Skill::Init1() { { std::vector strings; - a8::Split(pb->buff_list(), strings, '|'); + a8::Split(buff_list(), strings, '|'); for (auto& str : strings) { - buff_list.insert(a8::XValue(str)); + _buff_list.insert(a8::XValue(str)); } } + #if 0 { - const google::protobuf::Descriptor* descriptor = pb->GetDescriptor(); - const google::protobuf::Reflection* reflection = pb->GetReflection(); + const google::protobuf::Descriptor* descriptor = GetDescriptor(); + const google::protobuf::Reflection* reflection = GetReflection(); for (int idx = 1; idx <= 100; ++idx) { MetaData::SkillPhase phase; { @@ -78,52 +82,52 @@ namespace mt } } } + #endif { - SkillHelper::GetMagicIdAndBaseSkillId(pb->skill_id(), magic_id, base_skill_id); + SkillHelper::GetMagicIdAndBaseSkillId(skill_id(), _magic_id, _base_skill_id); } } void Skill::Init2() { - int skill_id = pb->skill_id(); - if (!(pb->skill_type() == kActiveSkill || pb->skill_type() == kPassiveSkill)) { + if (!(skill_type() == kActiveSkill || skill_type() == kPassiveSkill)) { A8_ABORT(); } #if 0 - if (!(pb->use_method() == 1 || pb->use_method() == 2 || pb->use_method() == 3)) { + if (!(use_method() == 1 || use_method() == 2 || use_method() == 3)) { A8_ABORT(); } #endif { - for (int buff_id : buff_list) { - MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); + for (int buff_id : _buff_list) { + const mt::Buff* buff_meta = mt::Buff::GetById(buff_id); if (!buff_meta) { A8_ABORT(); } - if (pb->skill_type() == kPassiveSkill) { - if (buff_meta->pb->trigger_type() != kBTT_UseSkill) { + if (skill_type() == kPassiveSkill) { + if (buff_meta->trigger_type() != kBTT_UseSkill) { A8_ABORT(); } } - auto itr = trigger_type_buffs.find(buff_meta->pb->trigger_type()); - if (itr != trigger_type_buffs.end()) { + auto itr = _trigger_type_buffs.find(buff_meta->trigger_type()); + if (itr != _trigger_type_buffs.end()) { itr->second.insert(buff_meta); } else { - trigger_type_buffs[buff_meta->pb->trigger_type()] = std::set({buff_meta}); + _trigger_type_buffs[buff_meta->trigger_type()] = std::set({buff_meta}); } } } { - base_skill_meta = MetaMgr::Instance()->GetSkill(base_skill_id); - if (base_skill_id) { - if (!base_skill_meta) { + _base_skill_meta = mt::Skill::GetById(_base_skill_id); + if (_base_skill_id) { + if (!_base_skill_meta) { abort(); } } } { - number_meta = MetaMgr::Instance()->GetSkillNumber(pb->skill_id()); - if (!number_meta && GetMagicId() != 0) { + _number_meta = mt::SkillNumber::GetById(skill_id()); + if (!_number_meta && GetMagicId() != 0) { abort(); } } @@ -131,12 +135,12 @@ namespace mt int Skill::GetMagicId() const { - return magic_id; + return _magic_id; } bool Skill::IsTurnOverSkill() const { - return !phases.empty() && phases[0].func_id == kSkill_TurnOver; + return !_phases.empty() && _phases[0].func_id == kSkill_TurnOver; } diff --git a/server/gameserver/mt/Skill.h b/server/gameserver/mt/Skill.h index 9f620f36..82af3d27 100644 --- a/server/gameserver/mt/Skill.h +++ b/server/gameserver/mt/Skill.h @@ -29,22 +29,22 @@ namespace mt "skill_id") public: - struct SkillNumber* number_meta = nullptr; + struct mt::SkillNumber* _number_meta = nullptr; - void Init(); + void Init1(); void Init2(); - Skill* base_skill_meta = nullptr; - float value_up = 0.0f; - std::set buff_list; - std::map> trigger_type_buffs; - std::vector phases; - std::vector raw_phases; + const mt::Skill* _base_skill_meta = nullptr; + float _value_up = 0.0f; + std::set _buff_list; + std::map> _trigger_type_buffs; + std::vector _phases; + std::vector _raw_phases; bool IsTurnOverSkill() const; int GetMagicId() const; private: - int magic_id = 0; - int base_skill_id = 0; + int _magic_id = 0; + int _base_skill_id = 0; }; diff --git a/server/gameserver/mt/SkillNumber.cc b/server/gameserver/mt/SkillNumber.cc index 6e94d491..45383359 100644 --- a/server/gameserver/mt/SkillNumber.cc +++ b/server/gameserver/mt/SkillNumber.cc @@ -1,85 +1,90 @@ #include "precompile.h" #include "mt/SkillNumber.h" +#include "mt/Skill.h" IMPL_TABLE(mt::SkillNumber) namespace mt { - void SkillNumber::Init() + void SkillNumber::Init1() { - int_ratio = a8::XValue(pb->ratio()); - float_ratio = a8::XValue(pb->ratio()).GetDouble(); - if (pb->ratio().find('%') != std::string::npos) { - std::string tmp_str = pb->ratio(); + _int_ratio = a8::XValue(ratio()); + _float_ratio = a8::XValue(ratio()).GetDouble(); + if (ratio().find('%') != std::string::npos) { + std::string tmp_str = ratio(); a8::ReplaceString(tmp_str, "%", ""); - float_ratio = a8::XValue(tmp_str).GetDouble() / 100; + _float_ratio = a8::XValue(tmp_str).GetDouble() / 100; } - int_ratio2 = a8::XValue(pb->ratio2()); - float_ratio2 = a8::XValue(pb->ratio2()).GetDouble(); - if (pb->ratio2().find('%') != std::string::npos) { - std::string tmp_str = pb->ratio2(); + _int_ratio2 = a8::XValue(ratio2()); + _float_ratio2 = a8::XValue(ratio2()).GetDouble(); + if (ratio2().find('%') != std::string::npos) { + std::string tmp_str = ratio2(); a8::ReplaceString(tmp_str, "%", ""); - float_ratio2 = a8::XValue(tmp_str).GetDouble() / 100; + _float_ratio2 = a8::XValue(tmp_str).GetDouble() / 100; } - int_speed = a8::XValue(pb->speed()); - float_speed = a8::XValue(pb->speed()).GetDouble(); - if (pb->speed().find('%') != std::string::npos) { - std::string tmp_str = pb->speed(); + _int_speed = a8::XValue(speed()); + _float_speed = a8::XValue(speed()).GetDouble(); + if (speed().find('%') != std::string::npos) { + std::string tmp_str = speed(); a8::ReplaceString(tmp_str, "%", ""); - float_speed = a8::XValue(tmp_str).GetDouble() / 100; + _float_speed = a8::XValue(tmp_str).GetDouble() / 100; } - int_range = a8::XValue(pb->range()); - float_range = a8::XValue(pb->range()).GetDouble(); - if (pb->range().find('%') != std::string::npos) { - std::string tmp_str = pb->range(); + _int_range = a8::XValue(range()); + _float_range = a8::XValue(range()).GetDouble(); + if (range().find('%') != std::string::npos) { + std::string tmp_str = range(); a8::ReplaceString(tmp_str, "%", ""); - float_range = a8::XValue(tmp_str).GetDouble() / 100; + _float_range = a8::XValue(tmp_str).GetDouble() / 100; } - int_range2 = a8::XValue(pb->range2()); - float_range2 = a8::XValue(pb->range2()).GetDouble(); - if (pb->range2().find('%') != std::string::npos) { - std::string tmp_str = pb->range2(); + _int_range2 = a8::XValue(range2()); + _float_range2 = a8::XValue(range2()).GetDouble(); + if (range2().find('%') != std::string::npos) { + std::string tmp_str = range2(); a8::ReplaceString(tmp_str, "%", ""); - float_range2 = a8::XValue(tmp_str).GetDouble() / 100; + _float_range2 = a8::XValue(tmp_str).GetDouble() / 100; } - int_probability = a8::XValue(pb->probability()); - float_probability = a8::XValue(pb->probability()).GetDouble(); - if (pb->probability().find('%') != std::string::npos) { - std::string tmp_str = pb->probability(); + _int_probability = a8::XValue(probability()); + _float_probability = a8::XValue(probability()).GetDouble(); + if (probability().find('%') != std::string::npos) { + std::string tmp_str = probability(); a8::ReplaceString(tmp_str, "%", ""); - float_probability = a8::XValue(tmp_str).GetDouble() / 100; + _float_probability = a8::XValue(tmp_str).GetDouble() / 100; } - int_time = a8::XValue(pb->time()); - float_time = a8::XValue(pb->time()).GetDouble(); - if (pb->time().find('%') != std::string::npos) { - std::string tmp_str = pb->time(); + _int_time = a8::XValue(time()); + _float_time = a8::XValue(time()).GetDouble(); + if (time().find('%') != std::string::npos) { + std::string tmp_str = time(); a8::ReplaceString(tmp_str, "%", ""); - float_time = a8::XValue(tmp_str).GetDouble() / 100; + _float_time = a8::XValue(tmp_str).GetDouble() / 100; } - int_cd = a8::XValue(pb->cd()); - float_cd = a8::XValue(pb->cd()).GetDouble(); - if (pb->cd().find('%') != std::string::npos) { - std::string tmp_str = pb->cd(); + _int_cd = a8::XValue(cd()); + _float_cd = a8::XValue(cd()).GetDouble(); + if (cd().find('%') != std::string::npos) { + std::string tmp_str = cd(); a8::ReplaceString(tmp_str, "%", ""); - float_cd = a8::XValue(tmp_str).GetDouble() / 100; + _float_cd = a8::XValue(tmp_str).GetDouble() / 100; } { - MetaData::Skill* skill_meta = MetaMgr::Instance()->GetSkill(pb->skill_id()); + const mt::Skill* skill_meta = mt::Skill::GetById(skill_id()); if (!skill_meta) { abort(); } + #if 0 metatable::Skill* skill_pb = (metatable::Skill*)(skill_meta->pb); - skill_pb->set_skill_cd(float_cd); +- skill_pb->set_skill_cd(float_cd); ++ + skill_cd_ = _float_cd; + #endif } }