|
@@ -6569,6 +6569,10 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
|
|
|
sd->canlog_tick = gettick();
|
|
|
}
|
|
|
|
|
|
+void pc_close_npc_timer(int tid, unsigned int tick, int id, intptr_t data){
|
|
|
+ TBL_PC *sd = map_id2sd(id);
|
|
|
+ if(sd) pc_close_npc(sd,data);
|
|
|
+}
|
|
|
/*
|
|
|
* Method to properly close npc for player and clear anything related
|
|
|
* @flag == 1 : produce close button
|
|
@@ -6583,6 +6587,10 @@ void pc_close_npc(struct map_session_data *sd,int flag) {
|
|
|
sd->state.using_fake_npc = 0;
|
|
|
}
|
|
|
if (sd->st) {
|
|
|
+ if(sd->st->state == RUN){ //wait ending code execution
|
|
|
+ add_timer(gettick()+500,pc_close_npc_timer,sd->bl.id,flag);
|
|
|
+ return;
|
|
|
+ }
|
|
|
sd->st->state = ((flag==1 && sd->st->mes_active)?CLOSE:END);
|
|
|
sd->st->mes_active = 0;
|
|
|
}
|