Suggestion: NPC name as parameter in enablenpc (#6233)

* The required NPC name parameter is now optional for the following script commands:
    enablenpc
    disablenpc
    hideonnpc
    hideoffnpc
    cloakonnpc
    cloakoffnpc
    isnpccloaked
* Updated docs

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
Atemo
2021-09-09 14:50:24 +02:00
committed by GitHub
parent c18707bb6d
commit 69802a23fb
63 changed files with 364 additions and 375 deletions

View File

@@ -254,20 +254,15 @@ static int npc_cloaked_sub(struct block_list *bl, va_list ap)
/*==========================================
* Disable / Enable NPC
*------------------------------------------*/
bool npc_enable_target(const char* name, uint32 char_id, int flag)
bool npc_enable_target(npc_data* nd, uint32 char_id, int flag)
{
struct npc_data* nd = npc_name2id(name);
if (!nd) {
ShowError("npc_enable: Attempted to %s a non-existing NPC '%s' (flag=%d).\n", (flag&11) ? "show" : "hide", name, flag);
return false;
}
nullpo_ret(nd);
if (char_id > 0 && (flag & 24)) {
map_session_data *sd = map_charid2sd(char_id);
if (!sd) {
ShowError("npc_enable: Attempted to %s a NPC '%s' on an invalid target %d.\n", (flag & 8) ? "show" : "hide", name, char_id);
ShowError("npc_enable: Attempted to %s a NPC '%s' on an invalid target %d.\n", (flag & 8) ? "show" : "hide", nd->name, char_id);
return false;
}