summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-07 18:19:57 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-16 22:44:20 +0300
commit61d6c958d5a753904d32ef2057b50f426bb0f3b9 (patch)
tree97a563e9f9ecc99ada1f7505459c58add34e47b2
parent625ed85b6a3d88587e8927f1f640f1fadd3dc642 (diff)
downloadhercules-61d6c958d5a753904d32ef2057b50f426bb0f3b9.tar.gz
hercules-61d6c958d5a753904d32ef2057b50f426bb0f3b9.tar.bz2
hercules-61d6c958d5a753904d32ef2057b50f426bb0f3b9.tar.xz
hercules-61d6c958d5a753904d32ef2057b50f426bb0f3b9.zip
Add function what call OnUntouch event.
-rw-r--r--src/map/npc.c16
-rw-r--r--src/map/npc.h1
-rw-r--r--src/map/script.c5
-rw-r--r--src/map/script.h1
4 files changed, 19 insertions, 4 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index c0e61e41f..63514710f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -139,11 +139,22 @@ int npc_ontouch2_event(struct map_session_data *sd, struct npc_data *nd)
{
char name[EVENT_NAME_LENGTH];
- if( sd->areanpc_id == nd->bl.id )
+ if (sd->areanpc_id == nd->bl.id)
return 0;
snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script->config.ontouch2_name);
- return npc->event(sd,name,2);
+ return npc->event(sd, name, 2);
+}
+
+int npc_onuntouch_event(struct map_session_data *sd, struct npc_data *nd)
+{
+ char name[EVENT_NAME_LENGTH];
+
+ if (sd->areanpc_id == nd->bl.id)
+ return 0;
+
+ snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script->config.onuntouch_name);
+ return npc->event(sd, name, 2);
}
/*==========================================
@@ -4614,6 +4625,7 @@ void npc_defaults(void) {
npc->isnear = npc_isnear;
npc->ontouch_event = npc_ontouch_event;
npc->ontouch2_event = npc_ontouch2_event;
+ npc->onuntouch_event = npc_onuntouch_event;
npc->enable_sub = npc_enable_sub;
npc->enable = npc_enable;
npc->name2id = npc_name2id;
diff --git a/src/map/npc.h b/src/map/npc.h
index 0825faf10..cb8f09644 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -182,6 +182,7 @@ struct npc_interface {
bool (*isnear) (struct block_list *bl);
int (*ontouch_event) (struct map_session_data *sd, struct npc_data *nd);
int (*ontouch2_event) (struct map_session_data *sd, struct npc_data *nd);
+ int (*onuntouch_event) (struct map_session_data *sd, struct npc_data *nd);
int (*enable_sub) (struct block_list *bl, va_list ap);
int (*enable) (const char *name, int flag);
struct npc_data* (*name2id) (const char *name);
diff --git a/src/map/script.c b/src/map/script.c
index fbfb88de2..3ccb6a45a 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -20124,8 +20124,9 @@ void script_defaults(void) {
script->config.loadmap_event_name = "OnPCLoadMapEvent";
script->config.baselvup_event_name = "OnPCBaseLvUpEvent";
script->config.joblvup_event_name = "OnPCJobLvUpEvent";
- script->config.ontouch_name = "OnTouch_";//ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves)
- script->config.ontouch2_name = "OnTouch";//ontouch2_name (run whenever a char walks into the OnTouch area)
+ script->config.ontouch_name = "OnTouch_"; //ontouch_name (runs on first visible char to enter area, picks another char if the first char leaves)
+ script->config.ontouch2_name = "OnTouch"; //ontouch2_name (run whenever a char walks into the OnTouch area)
+ script->config.onuntouch_name = "OnUnTouch"; //onuntouch_name (run whenever a char walks from the OnTouch area)
// for ENABLE_CASE_CHECK
script->calc_hash_ci = calc_hash_ci;
diff --git a/src/map/script.h b/src/map/script.h
index e28abf970..548c0f261 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -343,6 +343,7 @@ struct Script_Config {
const char* ontouch_name;
const char* ontouch2_name;
+ const char* onuntouch_name;
};
/**