diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-05 02:53:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-05 02:53:26 +0300 |
commit | 81a7dd76a7530c46bc2e08977ba6ac5eac81ccb9 (patch) | |
tree | 48b1532954632175ff3cd4cbb9927472b8778a84 /src | |
parent | bc5cd40bdf2fe9a37af83c2fb23fc8911c0b2ee1 (diff) | |
download | evol-hercules-81a7dd76a7530c46bc2e08977ba6ac5eac81ccb9.tar.gz evol-hercules-81a7dd76a7530c46bc2e08977ba6ac5eac81ccb9.tar.bz2 evol-hercules-81a7dd76a7530c46bc2e08977ba6ac5eac81ccb9.tar.xz evol-hercules-81a7dd76a7530c46bc2e08977ba6ac5eac81ccb9.zip |
For all npc in init state set .id variable to bl->id.
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/status.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/emap/status.c b/src/emap/status.c index bc3f0e3..262ea93 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -16,6 +16,7 @@ #include "map/map.h" #include "map/npc.h" #include "map/pc.h" +#include "map/script.h" #include "map/status.h" #include "emap/data/itemd.h" @@ -45,6 +46,17 @@ void estatus_set_viewdata_post(struct block_list *bl, { data->init = true; npc->vd->sex = 3; + if (npc->subtype == SCRIPT) + { + if (npc->u.scr.script) + { + // here some magic to set npc local variable .id to bl.id + const int num = reference_uid(script->add_str(".id"), 0); + if (!npc->u.scr.script->local.vars) + npc->u.scr.script->local.vars = i64db_alloc(DB_OPT_RELEASE_DATA); + i64db_iput(npc->u.scr.script->local.vars, num, npc->bl.id); + } + } } } |