From 273aca649e2f539ae010a2558ee3438877244c2f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 10 Jan 2024 13:17:07 +0800 Subject: [PATCH] 1 --- server/gameserver/ability.cc | 3 ++- server/gameserver/buff/modify_attr.cc | 20 ++++++++++++++++++++ server/gameserver/commands.cc | 5 +++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index 8006358e..f3ffe1b4 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -540,5 +540,6 @@ bool Ability::HasDecAttr(int attr_id) void Ability::SetSource(AttrHandle handle, std::shared_ptr> cb) { - + auto p = handle.lock(); + p->get_source = cb; } diff --git a/server/gameserver/buff/modify_attr.cc b/server/gameserver/buff/modify_attr.cc index 994911a3..ae4b2904 100644 --- a/server/gameserver/buff/modify_attr.cc +++ b/server/gameserver/buff/modify_attr.cc @@ -9,6 +9,7 @@ #include "car.h" #include "mt/Buff.h" +#include "mt/Skill.h" void ModifyAttrBuff::Activate() { @@ -16,6 +17,25 @@ void ModifyAttrBuff::Activate() float value = meta->GetBuffParam2(this); if (f8::App::Instance()->GetInstanceId() != 3) { attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value); +#ifdef MYDEBUG + if (!attr_handle_.expired()) { + std::string source_name = a8::Format + ("<-buff.%d.%d.%s", + { + meta->buff_id(), + skill_meta ? skill_meta->skill_id() : 0, + GetCaster().Get() ? (GetCaster().Get() == owner ? "self" : GetCaster().Get()->GetName() ) + : "none" + }); + auto cb = std::make_shared> + ( + [source_name] () -> std::string + { + return source_name; + }); + owner->GetAbility()->SetSource(attr_handle_, cb); + } +#endif } } diff --git a/server/gameserver/commands.cc b/server/gameserver/commands.cc index 0f6de921..083d12cb 100644 --- a/server/gameserver/commands.cc +++ b/server/gameserver/commands.cc @@ -239,11 +239,12 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg) SendDebugMsg("数值: " + str); } if (!handle.expired()) { + std::string source_name = "<-gm.self"; auto cb = std::make_shared> ( - [] () -> std::string + [source_name] () -> std::string { - return ""; + return source_name; }); target->GetAbility()->SetSource(handle, cb); }