summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-05-31 02:04:24 -0300
committershennetsind <ind@henn.et>2013-05-31 02:04:24 -0300
commitadc2e6ea9778e34945722f8f7d89e10cd9a4b972 (patch)
tree0178b50b3ef3bdcdd16d45a56d1c8d250c0eb2ea
parent68ff83df2e3a161ebf67f9e8b1c64a0eab767f8b (diff)
downloadhercules-adc2e6ea9778e34945722f8f7d89e10cd9a4b972.tar.gz
hercules-adc2e6ea9778e34945722f8f7d89e10cd9a4b972.tar.bz2
hercules-adc2e6ea9778e34945722f8f7d89e10cd9a4b972.tar.xz
hercules-adc2e6ea9778e34945722f8f7d89e10cd9a4b972.zip
Fixed Bug #7272
Special Thanks to bgamez23 http://hercules.ws/board/tracker/issue-7272-secure-npctimeout-bug-for-those-npc-who-have-no-dialog-window/ Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/packets_struct.h7
4 files changed, 21 insertions, 3 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index a0cf7a0c3..375f4a1d0 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17079,6 +17079,15 @@ void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_
clif->send(&p,sizeof(p), &sd->bl, target);
}
+void clif_scriptclear(struct map_session_data *sd, int npcid) {
+ struct packet_script_clear p;
+
+ p.PacketType = script_clearType;
+ p.NpcID = npcid;
+
+ clif->send(&p,sizeof(p), &sd->bl, SELF);
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -17410,6 +17419,7 @@ void clif_defaults(void) {
clif->scriptinputstr = clif_scriptinputstr;
clif->cutin = clif_cutin;
clif->sendfakenpc = clif_sendfakenpc;
+ clif->scriptclear = clif_scriptclear;
/* client-user-interface-related */
clif->viewpoint = clif_viewpoint;
clif->damage = clif_damage;
diff --git a/src/map/clif.h b/src/map/clif.h
index 4347ad743..94b29db9a 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -553,6 +553,7 @@ struct clif_interface {
void (*scriptinputstr) (struct map_session_data *sd, int npcid);
void (*cutin) (struct map_session_data* sd, const char* image, int type);
void (*sendfakenpc) (struct map_session_data *sd, int npcid);
+ void (*scriptclear) (struct map_session_data *sd, int npcid);
/* client-user-interface-related */
void (*viewpoint) (struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color);
int (*damage) (struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int damage, int div, int type, int damage2);
diff --git a/src/map/npc.c b/src/map/npc.c
index bff6be30c..cb26bd75c 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -270,11 +270,12 @@ int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t dat
sd->st->state = END;
sd->state.menu_or_input = 0;
sd->npc_menu = 0;
-
+ clif->scriptmes(sd, sd->npc_id, " ");
/**
* This guy's been idle for longer than allowed, close him.
**/
clif->scriptclose(sd,sd->npc_id);
+ clif->scriptclear(sd,sd->npc_id);
sd->npc_idle_timer = INVALID_TIMER;
} else //Create a new instance of ourselves to continue
sd->npc_idle_timer = add_timer(gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc_rr_secure_timeout_timer,sd->bl.id,0);
@@ -289,8 +290,7 @@ int npc_event_dequeue(struct map_session_data* sd)
{
nullpo_ret(sd);
- if(sd->npc_id)
- { //Current script is aborted.
+ if(sd->npc_id) { //Current script is aborted.
if(sd->state.using_fake_npc){
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 9d1f9b280..083c00e31 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -72,6 +72,7 @@ enum packet_headers {
#else
authokType = 0x2eb,
#endif
+ script_clearType = 0x8d6,
#if PACKETVER < 4
unit_walkingType = 0x7b,
#elif PACKETVER < 7
@@ -453,6 +454,12 @@ struct packet_bgqueue_battlebegins {
char game_name[NAME_LENGTH];
} __attribute__((packed));
+struct packet_script_clear {
+ short PacketType;
+ unsigned int NpcID;
+} __attribute__((packed));
+
+
#pragma pack(pop)
#endif /* _PACKETS_STRUCT_H_ */