From bac281edd0ade365b1b3135a1773a320596f5d25 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 12 Aug 2021 05:15:59 +0000 Subject: [PATCH] 1 --- server/gameserver/buff.cc | 1 + server/gameserver/creature.cc | 12 +++++++----- server/tools/protobuild/cs_proto.proto | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index dc40501..04c4645 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -58,6 +58,7 @@ void Buff::FillMFBuff(cs::MFBuff* buff_pb) buff_pb->set_buff_id(meta->i->buff_id()); buff_pb->set_left_time(GetLeftTime()); buff_pb->set_lasting_time(GetLastingTime()); + buff_pb->set_buff_uniid(buff_uniid); if (owner->IsHuman() && (meta->i->buff_effect() == kBET_Driver || meta->i->buff_effect() == kBET_Passenger)) { diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index c9bef19..4b553b5 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -354,12 +354,12 @@ int Creature::AddBuff(Creature* caster, buff_meta->i->duration_time() * SERVER_FRAME_RATE, a8::XParams() .SetSender(this) - .SetParam1(buff_meta->i->buff_id()) + .SetParam1(buff->buff_uniid) .SetParam2(buff), [] (const a8::XParams& param) { Creature* c = (Creature*)param.sender.GetUserData(); - c->RemoveBuffById(param.param1); + c->RemoveBuffByUniId(param.param1); }, &buff->xtimer_attacher.timer_list_, [] (const a8::XParams& param) @@ -385,7 +385,7 @@ int Creature::AddBuff(Creature* caster, } } #ifdef DEBUG - SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d", + SendDebugMsg(a8::Format("添加buff_id:%d effect:%d %s params:%d,%d,%d,%d,%d uniid:%d", { buff_meta->i->buff_id(), buff_meta->i->buff_effect(), @@ -395,6 +395,7 @@ int Creature::AddBuff(Creature* caster, buff_meta->int_param3, buff_meta->int_param4, buff_meta->int_param5, + buff->buff_uniid })); #endif return new_buff_uniid; @@ -538,9 +539,10 @@ void Creature::RemoveBuffByUniId(int buff_uniid) } RecalcBuffAttr(); #ifdef DEBUG - SendDebugMsg(a8::Format("移除buff_id:%d", + SendDebugMsg(a8::Format("移除buff_id:%d uniid:%d", { - buff_id + buff_id, + buff_uniid })); #endif } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 05f57d7..c8c7f8c 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -758,6 +758,7 @@ message MFBuff optional float left_time = 2; //剩余时间(单位毫秒) optional float lasting_time = 3; //持续时间(总时间毫秒) repeated float params = 4; //当是驾驶员或者乘客状时 params[0]:car_id + optional int32 buff_uniid = 5; //buff唯一id } //buff变更