This fixes the client hang issue when using the @refresh command while a NPC dialog box/menu is open. I don't know if this plugin will compile, as I made it on the fly, but the command fix definitely works.
Inspired from npc_rr_secure_timeout_timer
Download: https://pastebin.com/zUzYyz1S
ACMD(refresh)
{
if (sd->npc_id) {
/**
* If we still have the NPC script attached, tell it to stop.
**/
if (sd->st)
sd->st->state = END;
sd->state.menu_or_input = 0;
sd->npc_menu = 0;
clif->scriptclose(sd, sd->npc_id);
/**
* We will end the script ourselves, client will request to end it again if it have dialog,
* however it will be ignored, workaround for client stuck if NPC have no dialog. [hemagx]
**/
sd->state.dialog = 0;
npc->scriptcont(sd, sd->npc_id, true);
}
clif->refresh(sd);
return true;
}