From 145b0e76b970c7721fd42ad04f36a8587a1deb53 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 22 Apr 2024 19:48:42 +0800 Subject: [PATCH] 1 --- server/gameserver/netdata.cc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/server/gameserver/netdata.cc b/server/gameserver/netdata.cc index 9d16b5ec..ed5c4653 100644 --- a/server/gameserver/netdata.cc +++ b/server/gameserver/netdata.cc @@ -287,6 +287,24 @@ private: if (attr && attr->IsObject()) { int attr_id = a8::XValue(attr->Get("attr_id", "0")); float val = a8::XValue(attr->Get("val", "0")).GetDouble(); + if (IsValidHumanAttr(attr_id)) { + auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val); + if (!attr_handle.expired()) { +#ifdef MYDEBUG + std::string source_name = a8::Format + ("<-hero_rand_attr", + { + }); + auto cb = std::make_shared> + ( + [source_name] () -> std::string + { + return source_name; + }); + owner_.Get()->GetAbility()->SetSource(attr_handle, cb); + } +#endif + } } } } @@ -301,6 +319,24 @@ private: if (attr && attr->IsObject()) { int attr_id = a8::XValue(attr->Get("attr_id", "0")); float val = a8::XValue(attr->Get("val", "0")).GetDouble(); + if (IsValidHumanAttr(attr_id)) { + auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val); + if (!attr_handle.expired()) { +#ifdef MYDEBUG + std::string source_name = a8::Format + ("<-chip_page", + { + }); + auto cb = std::make_shared> + ( + [source_name] () -> std::string + { + return source_name; + }); + owner_.Get()->GetAbility()->SetSource(attr_handle, cb); + } +#endif + } } } }