From 6b814243a0597aacb6f30b7c5e10fd9a7381e187 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 3 Mar 2023 22:37:29 +0800 Subject: [PATCH] 1 --- server/gameserver/app.cc | 2 +- server/gameserver/buff.cc | 2 +- server/gameserver/creature.cc | 2 +- server/gameserver/mt/Buff.cc | 14 ++++++++++++++ server/gameserver/mt/Buff.h | 17 +++++++++++++++++ server/gameserver/mtb/Buff.h | 4 ++-- server/gameserver/mtb/mtb.all.cc | 2 +- server/tools/protobuild/mt.proto | 2 +- third_party/a8 | 2 +- 9 files changed, 39 insertions(+), 8 deletions(-) diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index 4684203e..ce024f40 100644 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -122,7 +122,7 @@ bool App::Init(int argc, char* argv[]) { { auto env = std::make_shared(); - auto p = a8::lisp::Expr::Compile("(+ 1 3)", env); + auto p = a8::lisp::Expr::Compile("(+ 1 3 (+ 100 200))", env); auto ret = a8::lisp::Expr::Eval(p, env); a8::XPrintf("p:%s ret:%f\n", {p->ToXObject().ToJsonStr(), ret->ToXObject().ToJsonStr()}); } diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index bcacc8c6..6d175d36 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -77,7 +77,7 @@ int Buff::GetLeftTime() int Buff::GetLastingTime() { - return meta->duration_time() * 1000; + return meta->GetDurationTime(skill_meta) * 1000; } void Buff::InternalTimerAddBuff() diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 53d7bfd2..dc0ef121 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -224,7 +224,7 @@ int Creature::AddBuff(Creature* caster, { buff->remover_timer = room->xtimer.SetTimeoutWpEx ( - buff_meta->duration_time() * SERVER_FRAME_RATE, + buff_meta->GetDurationTime(buff_skill_meta) * SERVER_FRAME_RATE, [buff_wp = (std::weak_ptr)buff] (int event, const a8::Args* args) { if (a8::TIMER_EXEC_EVENT == event) { diff --git a/server/gameserver/mt/Buff.cc b/server/gameserver/mt/Buff.cc index 9caa9cb1..20e20497 100644 --- a/server/gameserver/mt/Buff.cc +++ b/server/gameserver/mt/Buff.cc @@ -243,7 +243,9 @@ namespace mt break; case kBET_DelayAddBuff: { + #if 0 assert(_buff_param1 < duration_time()); + #endif if (!mt::Buff::GetById(_int_buff_param2)) { A8_ABORT(); } @@ -251,7 +253,9 @@ namespace mt break; case kBET_IntervalAddBuff: { + #if 0 assert(_int_buff_param1 < duration_time() * 1000); + #endif if (!mt::Buff::GetById(_int_buff_param2)) { A8_ABORT(); } @@ -315,4 +319,14 @@ namespace mt } } + float Buff::GetDurationTime(const mt::Skill* skill_meta) const + { + return 0.0f; + } + + std::string Buff::duration_time() const + { + return mtb::Buff::duration_time(); + } + } diff --git a/server/gameserver/mt/Buff.h b/server/gameserver/mt/Buff.h index bdebaf77..780d3eb8 100644 --- a/server/gameserver/mt/Buff.h +++ b/server/gameserver/mt/Buff.h @@ -3,6 +3,15 @@ #include "mt/macro.h" #include "mtb/Buff.h" +namespace a8 +{ + namespace lisp + { + struct Value; + } + +} + namespace mt { @@ -44,6 +53,14 @@ namespace mt std::vector _child_buff_list; + float GetDurationTime(const mt::Skill* skill_meta) const; + + private: + float _duration_time = 0.0f; + std::shared_ptr _duration_time_expr; + + std::string duration_time() const; + }; } diff --git a/server/gameserver/mtb/Buff.h b/server/gameserver/mtb/Buff.h index 61b9ebd0..da8e3435 100644 --- a/server/gameserver/mtb/Buff.h +++ b/server/gameserver/mtb/Buff.h @@ -20,7 +20,7 @@ namespace mtb const std::string buff_param3() const { return buff_param3_; }; const std::string buff_param4() const { return buff_param4_; }; const std::string buff_param5() const { return buff_param5_; }; - float duration_time() const { return duration_time_; }; + const std::string duration_time() const { return duration_time_; }; float buff_valueup() const { return buff_valueup_; }; const std::string immune_buffeffect_list() const { return immune_buffeffect_list_; }; const std::string post_remove_action() const { return post_remove_action_; }; @@ -88,7 +88,7 @@ namespace mtb std::string buff_param3_; std::string buff_param4_; std::string buff_param5_; - float duration_time_ = 0.0f; + std::string duration_time_; float buff_valueup_ = 0.0f; std::string immune_buffeffect_list_; std::string post_remove_action_; diff --git a/server/gameserver/mtb/mtb.all.cc b/server/gameserver/mtb/mtb.all.cc index 328ab204..5ae9a296 100644 --- a/server/gameserver/mtb/mtb.all.cc +++ b/server/gameserver/mtb/mtb.all.cc @@ -453,7 +453,7 @@ namespace mtb meta_class->SetSimpleField(7, "buff_param3", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param3_)); meta_class->SetSimpleField(8, "buff_param4", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param4_)); meta_class->SetSimpleField(9, "buff_param5", a8::reflect::ET_STRING, my_offsetof2(Buff, buff_param5_)); - meta_class->SetSimpleField(10, "duration_time", a8::reflect::ET_FLOAT, my_offsetof2(Buff, duration_time_)); + meta_class->SetSimpleField(10, "duration_time", a8::reflect::ET_STRING, my_offsetof2(Buff, duration_time_)); meta_class->SetSimpleField(11, "buff_valueup", a8::reflect::ET_FLOAT, my_offsetof2(Buff, buff_valueup_)); meta_class->SetSimpleField(12, "immune_buffeffect_list", a8::reflect::ET_STRING, my_offsetof2(Buff, immune_buffeffect_list_)); meta_class->SetSimpleField(13, "post_remove_action", a8::reflect::ET_STRING, my_offsetof2(Buff, post_remove_action_)); diff --git a/server/tools/protobuild/mt.proto b/server/tools/protobuild/mt.proto index ae13a139..70e55fb3 100755 --- a/server/tools/protobuild/mt.proto +++ b/server/tools/protobuild/mt.proto @@ -355,7 +355,7 @@ message Buff required string buff_param3 = 8; required string buff_param4 = 9; optional string buff_param5 = 19; - required float duration_time = 10; + required string duration_time = 10; optional float buff_valueup = 11; required string immune_buffeffect_list = 12; optional string post_remove_action = 13; diff --git a/third_party/a8 b/third_party/a8 index 8cf0d04a..bb2f7667 160000 --- a/third_party/a8 +++ b/third_party/a8 @@ -1 +1 @@ -Subproject commit 8cf0d04a936a352fff2a502bf39d9c5729a15e12 +Subproject commit bb2f76674df56baa480924081cb3be5ca1737e1f