Added support of the aegis mob name in the script npc definition (view) (#6252)

* Added the npc path in status_set_viewdata warning

Thanks to @Lemongrass3110
This commit is contained in:
Atemo 2021-09-14 19:26:01 +02:00 committed by GitHub
parent f4fbfb3299
commit a725844553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -2688,8 +2688,13 @@ int npc_parseview(const char* w4, const char* start, const char* buffer, const c
// Check if constant exists and get its value. // Check if constant exists and get its value.
if(!script_get_constant(viewid, &val_tmp)) { if(!script_get_constant(viewid, &val_tmp)) {
std::shared_ptr<s_mob_db> mob = mobdb_search_aegisname(viewid);
if (mob != nullptr)
val = static_cast<int>(mob->vd.class_);
else {
ShowWarning("npc_parseview: Invalid NPC constant '%s' specified in file '%s', line'%d'. Defaulting to INVISIBLE. \n", viewid, filepath, strline(buffer,start-buffer)); ShowWarning("npc_parseview: Invalid NPC constant '%s' specified in file '%s', line'%d'. Defaulting to INVISIBLE. \n", viewid, filepath, strline(buffer,start-buffer));
val = JT_INVISIBLE; val = JT_INVISIBLE;
}
} else } else
val = static_cast<int>(val_tmp); val = static_cast<int>(val_tmp);
} }

View File

@ -8886,10 +8886,12 @@ void status_set_viewdata(struct block_list *bl, int class_)
nd->vd.class_ = class_; nd->vd.class_ = class_;
nd->vd.hair_style = cap_value(nd->vd.hair_style, MIN_HAIR_STYLE, MAX_HAIR_STYLE); nd->vd.hair_style = cap_value(nd->vd.hair_style, MIN_HAIR_STYLE, MAX_HAIR_STYLE);
} else { } else {
ShowError("status_set_viewdata (NPC): Invalid view data %d\n", class_);
if (bl->m >= 0) if (bl->m >= 0)
ShowDebug("Source (NPC): %s at %s (%d,%d)\n", nd->name, map_mapid2mapname(bl->m), bl->x, bl->y); ShowDebug("Source (NPC): %s at %s (%d,%d)\n", nd->name, map_mapid2mapname(bl->m), bl->x, bl->y);
else else
ShowDebug("Source (NPC): %s (invisible/not on a map)\n", nd->name); ShowDebug("Source (NPC): %s (invisible/not on a map)\n", nd->name);
ShowDebug( "Source (NPC): %s is located in: %s\n", nd->name, nd->path );
} }
break; break;
} }