Corrected atcommand reloadscript and NPC dialogs (#3643)
* Corrected atcommand reloadscript and NPC dialogs * Fixes #3637. * Force atcommand reloadscript to send a close button if a NPC dialog is active to any attached players. * Fixed cutin removal as well. Thanks to @kukuasir1 and @Lemongrass3110!
This commit is contained in:
parent
1333db584b
commit
a7d8fbae14
@ -7470,11 +7470,12 @@ This command will display a picture, usually an NPC illustration, also called
|
|||||||
cutin, for the currently attached client. The position parameter determines the
|
cutin, for the currently attached client. The position parameter determines the
|
||||||
placement of the illustration and takes following values:
|
placement of the illustration and takes following values:
|
||||||
|
|
||||||
0 - bottom left corner
|
0 bottom left corner
|
||||||
1 - bottom middle
|
1 bottom middle
|
||||||
2 - bottom right corner
|
2 bottom right corner
|
||||||
3 - middle of screen in a movable window with an empty title bar
|
3 middle of screen in a movable window with an empty title bar
|
||||||
4 - middle of screen without the window header, but still movable
|
4 middle of screen without the window header, but still movable
|
||||||
|
255 clear all displayed cutins
|
||||||
|
|
||||||
The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
|
The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
|
||||||
and data folder, and is required to be a bitmap. The file extension .bmp can be
|
and data folder, and is required to be a bitmap. The file extension .bmp can be
|
||||||
|
@ -3910,8 +3910,10 @@ ACMD_FUNC(reload) {
|
|||||||
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
|
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
|
||||||
|
|
||||||
iter = mapit_getallusers();
|
iter = mapit_getallusers();
|
||||||
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
|
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ){
|
||||||
pc_close_npc(pl_sd,2);
|
pc_close_npc(pl_sd,1);
|
||||||
|
clif_cutin(pl_sd, "", 255);
|
||||||
|
}
|
||||||
mapit_free(iter);
|
mapit_free(iter);
|
||||||
|
|
||||||
flush_fifos();
|
flush_fifos();
|
||||||
|
@ -2388,6 +2388,7 @@ void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, in
|
|||||||
/// 2 = bottom right corner
|
/// 2 = bottom right corner
|
||||||
/// 3 = middle of screen, inside a movable window
|
/// 3 = middle of screen, inside a movable window
|
||||||
/// 4 = middle of screen, movable with a close button, chrome-less
|
/// 4 = middle of screen, movable with a close button, chrome-less
|
||||||
|
/// 255 = clear all displayed cutins
|
||||||
void clif_cutin(struct map_session_data* sd, const char* image, int type)
|
void clif_cutin(struct map_session_data* sd, const char* image, int type)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -7684,10 +7684,12 @@ TIMER_FUNC(pc_close_npc_timer){
|
|||||||
if(sd) pc_close_npc(sd,data);
|
if(sd) pc_close_npc(sd,data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/**
|
||||||
* Method to properly close npc for player and clear anything related
|
* Method to properly close a NPC for player and clear anything related.
|
||||||
* @flag == 1 : produce close button
|
* @param sd: Player attached
|
||||||
* @flag == 2 : directly close it
|
* @param flag: Method of closure
|
||||||
|
* 1: Produce a close button and end the NPC
|
||||||
|
* 2: End the NPC (best for no dialog windows)
|
||||||
*/
|
*/
|
||||||
void pc_close_npc(struct map_session_data *sd,int flag)
|
void pc_close_npc(struct map_session_data *sd,int flag)
|
||||||
{
|
{
|
||||||
@ -7713,17 +7715,19 @@ void pc_close_npc(struct map_session_data *sd,int flag)
|
|||||||
#ifdef SECURE_NPCTIMEOUT
|
#ifdef SECURE_NPCTIMEOUT
|
||||||
sd->npc_idle_timer = INVALID_TIMER;
|
sd->npc_idle_timer = INVALID_TIMER;
|
||||||
#endif
|
#endif
|
||||||
if (sd->st && sd->st->state == CLOSE) {
|
if (sd->st) {
|
||||||
|
if (sd->st->state == CLOSE) {
|
||||||
clif_scriptclose(sd, sd->npc_id);
|
clif_scriptclose(sd, sd->npc_id);
|
||||||
clif_scriptclear(sd, sd->npc_id); // [Ind/Hercules]
|
clif_scriptclear(sd, sd->npc_id); // [Ind/Hercules]
|
||||||
sd->st->state = END; // Force to end now
|
sd->st->state = END; // Force to end now
|
||||||
}
|
}
|
||||||
if(sd->st && sd->st->state == END ) {// free attached scripts that are waiting
|
if (sd->st->state == END) { // free attached scripts that are waiting
|
||||||
script_free_state(sd->st);
|
script_free_state(sd->st);
|
||||||
sd->st = NULL;
|
sd->st = NULL;
|
||||||
sd->npc_id = 0;
|
sd->npc_id = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user