From b00b313f21092967015a9c12acbbd3d3a4581fb7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 9 Jan 2024 10:49:51 +0800 Subject: [PATCH] 1 --- server/gameserver/ability.cc | 172 +---------------------------------- 1 file changed, 5 insertions(+), 167 deletions(-) diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index b5dd1212..8a6f010e 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -359,7 +359,6 @@ void Ability::GMClearAttr() std::vector Ability::GMShowAttrs() { - #if 0 std::vector strings; strings.push_back(a8::Format("curr_hp:%f max_hp:%f atk:%f def:%f block:%f crit:%f", { @@ -373,105 +372,11 @@ std::vector Ability::GMShowAttrs() { std::vector tmp_strings; int attr_id = 0; - for (auto& tuple : attr_abs_) { - list_head* head = &std::get<1>(tuple); + for (auto& list : attr_list_) { + list_head* head = &list; list_head* pos = nullptr; list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, std::get<0>(tuple)}); - int i = 0; - list_for_each_safe(pos, next, head) { - AttrAbs* e = list_entry(pos, - AttrAbs, - entry); - data += "" + a8::XValue(e->value).GetString() + ","; - ++i; - } - if (i > 0) { - data += "]"; - tmp_strings.push_back(data); - } - ++attr_id; - } - strings.push_back("基础属性定值:"); - if (tmp_strings.empty()) { - strings.push_back("无"); - } else { - for (auto& str : tmp_strings) { - strings.push_back(str); - } - } - } - { - std::vector tmp_strings; - int attr_id = 0; - for (auto& tuple : attr_rate_) { - list_head* head = &std::get<1>(tuple); - list_head* pos = nullptr; - list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, std::get<0>(tuple)}); - int i = 0; - list_for_each_safe(pos, next, head) { - AttrRate* e = list_entry(pos, - AttrRate, - entry); - data += "" + a8::XValue(e->value).GetString() + ","; - ++i; - } - if (i > 0) { - data += "]"; - tmp_strings.push_back(data); - } - ++attr_id; - } - strings.push_back("基础属性百分比:"); - if (tmp_strings.empty()) { - strings.push_back("无"); - } else { - for (auto& str : tmp_strings) { - strings.push_back(str); - } - } - } - { - std::vector tmp_strings; - int attr_id = 0; - for (auto& tuple : attr_add_) { - list_head* head = &std::get<1>(tuple); - list_head* pos = nullptr; - list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, std::get<0>(tuple)}); - int i = 0; - list_for_each_safe(pos, next, head) { - AttrAddition* e = list_entry(pos, - AttrAddition, - entry); - data += "" + a8::XValue(e->value).GetString() + ","; - ++i; - } - if (i > 0) { - data += "]"; - tmp_strings.push_back(data); - } - ++attr_id; - } - strings.push_back("成长属性增:"); - if (tmp_strings.empty()) { - strings.push_back("无"); - } else { - for (auto& str : tmp_strings) { - strings.push_back(str); - } - } - } - { - std::vector tmp_strings; - int attr_id = 0; - for (auto& tuple : vattr_add_) { - list_head* head = &std::get<1>(tuple); - list_head* pos = nullptr; - list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id + kHVAT_Begin, - std::get<0>(tuple)}); + std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, GetAttr(attr_id)}); int i = 0; list_for_each_safe(pos, next, head) { AttrAddition* e = list_entry(pos, @@ -486,7 +391,7 @@ std::vector Ability::GMShowAttrs() } ++attr_id; } - strings.push_back("成长属性增(虚):"); + strings.push_back("属性:"); if (tmp_strings.empty()) { strings.push_back("无"); } else { @@ -495,74 +400,7 @@ std::vector Ability::GMShowAttrs() } } } - - { - std::vector tmp_strings; - int attr_id = 0; - for (auto& tuple : attr_dec_) { - list_head* head = &std::get<1>(tuple); - list_head* pos = nullptr; - list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, std::get<0>(tuple)}); - int i = 0; - list_for_each_safe(pos, next, head) { - AttrRuduce* e = list_entry(pos, - AttrRuduce, - entry); - data += "" + a8::XValue(e->value).GetString() + ","; - ++i; - } - if (i > 0) { - data += "]"; - tmp_strings.push_back(data); - } - ++attr_id; - } - strings.push_back("成长属性减:"); - if (tmp_strings.empty()) { - strings.push_back("无"); - } else { - for (auto& str : tmp_strings) { - strings.push_back(str); - } - } - } - - { - std::vector tmp_strings; - int attr_id = 0; - for (auto& tuple : vattr_dec_) { - list_head* head = &std::get<1>(tuple); - list_head* pos = nullptr; - list_head* next = nullptr; - std::string data = a8::Format("减 attr_id:%d value:%f [", {attr_id + kHVAT_Begin, - std::get<0>(tuple)}); - int i = 0; - list_for_each_safe(pos, next, head) { - AttrRuduce* e = list_entry(pos, - AttrRuduce, - entry); - data += "" + a8::XValue(e->value).GetString() + ","; - ++i; - } - if (i > 0) { - data += "]"; - tmp_strings.push_back(data); - } - ++attr_id; - } - strings.push_back("成长属性减(虚):"); - if (tmp_strings.empty()) { - strings.push_back("无"); - } else { - for (auto& str : tmp_strings) { - strings.push_back(str); - } - } - } - - return strings; - #endif + return strings; } void Ability::IncSwitch(int type)