This commit is contained in:
aozhiwei 2024-01-10 11:58:57 +08:00
parent 80f3bae4ea
commit fbc71c035c
3 changed files with 25 additions and 3 deletions

View File

@ -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<std::string> 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<std::string> 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,

View File

@ -1,5 +1,7 @@
#include "precompile.h"
#include <a8/magicenum.h>
#include "attrhelper.h"
float* AttrHelper::GetAttrAbsPtr(std::array<float, kNHAT_End>& attr, int attr_id)
@ -49,5 +51,15 @@ bool AttrHelper::ParseAttr(std::shared_ptr<a8::XObject> xobj,
std::string AttrHelper::GetAttrName(int attr_id)
{
if (IsValidHumanAttr(attr_id)) {
std::string name = a8::GetEnumName<NewHumanAttrType_e>(attr_id);
a8::ReplaceString(name, "kNHAT_", "");
return name;
} else if (IsValidHumanVirtualAttr(attr_id)) {
std::string name = a8::GetEnumName<HumanVirtualAttrType_e>(attr_id);
a8::ReplaceString(name, "kHVAT_", "Virtual_");
return name;
} else {
return "None";
}
}

View File

@ -1,6 +1,8 @@
#include "precompile.h"
#include "global.h"
#include <a8/magicenum.h>
#include "attrdefine.h"
bool IsValidSlotId(int slot_id)