This commit is contained in:
aozhiwei 2024-04-22 17:58:05 +08:00
parent 563f936d44
commit d2db33e7db

View File

@ -279,6 +279,32 @@ private:
void DtoInit(Creature* c)
{
{
auto rand_attr = hero_dto->At("rand_attr");
if (rand_attr && rand_attr->IsArray()) {
for (int i = 0; i < rand_attr->Size(); ++i) {
auto attr = rand_attr->At(i);
if (attr && attr->IsObject()) {
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
}
}
}
}
{
auto chip_page = hero_dto->At("chip_page");
if (chip_page && chip_page->IsObject()) {
std::vector<std::string> keys;
chip_page->GetKeys(keys);
for (auto& key : keys) {
auto attr = chip_page->At(key);
if (attr && attr->IsObject()) {
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
}
}
}
}
}
private: