From fbc71c035cd46bd778745d9afc34ef199a043773 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 10 Jan 2024 11:58:57 +0800 Subject: [PATCH] 1 --- server/gameserver/ability.cc | 12 ++++++++++-- server/gameserver/attrhelper.cc | 14 +++++++++++++- server/gameserver/global.cc | 2 ++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/server/gameserver/ability.cc b/server/gameserver/ability.cc index 15226429..e4b07b69 100644 --- a/server/gameserver/ability.cc +++ b/server/gameserver/ability.cc @@ -7,6 +7,7 @@ #include "creature.h" #include "netdata.h" #include "room.h" +#include "attrhelper.h" #include "mt/Equip.h" #include "mt/Buff.h" @@ -386,7 +387,10 @@ std::vector Ability::GMShowAttrs() list_head* head = &list; list_head* pos = nullptr; list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, GetAttr(attr_id)}); + std::string data = a8::Format("attr_id:%d attr_name:%s value:%f [", + {attr_id, + AttrHelper::GetAttrName(attr_id), + GetAttr(attr_id)}); int i = 0; list_for_each_safe(pos, next, head) { AttrAddition* e = list_entry(pos, @@ -417,7 +421,11 @@ std::vector Ability::GMShowAttrs() list_head* head = &list; list_head* pos = nullptr; list_head* next = nullptr; - std::string data = a8::Format("attr_id:%d value:%f [", {attr_id, GetAttr(attr_id)}); + std::string data = a8::Format("attr_id:%d attr_name:%s value:%f [", + {attr_id, + AttrHelper::GetAttrName(attr_id), + GetAttr(attr_id) + }); int i = 0; list_for_each_safe(pos, next, head) { AttrAddition* e = list_entry(pos, diff --git a/server/gameserver/attrhelper.cc b/server/gameserver/attrhelper.cc index 667dec45..92853753 100644 --- a/server/gameserver/attrhelper.cc +++ b/server/gameserver/attrhelper.cc @@ -1,5 +1,7 @@ #include "precompile.h" +#include + #include "attrhelper.h" float* AttrHelper::GetAttrAbsPtr(std::array& attr, int attr_id) @@ -49,5 +51,15 @@ bool AttrHelper::ParseAttr(std::shared_ptr xobj, std::string AttrHelper::GetAttrName(int attr_id) { - + if (IsValidHumanAttr(attr_id)) { + std::string name = a8::GetEnumName(attr_id); + a8::ReplaceString(name, "kNHAT_", ""); + return name; + } else if (IsValidHumanVirtualAttr(attr_id)) { + std::string name = a8::GetEnumName(attr_id); + a8::ReplaceString(name, "kHVAT_", "Virtual_"); + return name; + } else { + return "None"; + } } diff --git a/server/gameserver/global.cc b/server/gameserver/global.cc index d57ecfff..4d064925 100644 --- a/server/gameserver/global.cc +++ b/server/gameserver/global.cc @@ -1,6 +1,8 @@ #include "precompile.h" #include "global.h" +#include + #include "attrdefine.h" bool IsValidSlotId(int slot_id)