From eef66af46d40536a0c0e4d257566554766434725 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 10 Jan 2024 12:07:39 +0800 Subject: [PATCH] 1 --- server/gameserver/commands.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/gameserver/commands.cc b/server/gameserver/commands.cc index 9bafd81b..0f6de921 100644 --- a/server/gameserver/commands.cc +++ b/server/gameserver/commands.cc @@ -233,11 +233,20 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg) int attr_id = a8::XValue(cmds[2]); float value = a8::XValue(cmds[3]).GetDouble(); if (target) { - target->GetAbility()->AddAttr(attr_id, value); + auto handle = target->GetAbility()->AddAttr(attr_id, value); std::vector strings = target->GetAbility()->GMShowAttrs(); for (auto& str : strings) { SendDebugMsg("数值: " + str); } + if (!handle.expired()) { + auto cb = std::make_shared> + ( + [] () -> std::string + { + return ""; + }); + target->GetAbility()->SetSource(handle, cb); + } } } } else if (cmd == "del_attr") {