diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-27 18:30:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-27 18:30:29 +0300 |
commit | a04eeef27f16ba4fbe31e5e178313e6e718af4c8 (patch) | |
tree | 93ece9f2298ef3883821d65a08c226574699f227 /src | |
parent | 454c1448e30fe9d8cc2e6bc535921b2f7efd58e2 (diff) | |
download | evol-hercules-a04eeef27f16ba4fbe31e5e178313e6e718af4c8.tar.gz evol-hercules-a04eeef27f16ba4fbe31e5e178313e6e718af4c8.tar.bz2 evol-hercules-a04eeef27f16ba4fbe31e5e178313e6e718af4c8.tar.xz evol-hercules-a04eeef27f16ba4fbe31e5e178313e6e718af4c8.zip |
Allow set/get npc sex by working with variable '.sex'.
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/script.c | 12 | ||||
-rw-r--r-- | src/emap/scriptdefines.h | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c index 0df3847..bb414b1 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -59,6 +59,13 @@ void escript_set_reg_npc_num(struct script_state* st, struct reg_db *n, int64 *n ext->language = *val; hookStop(); } + else if (!strcmp(name, ".sex")) + { + getND(); + clif->clearunit_area(&nd->bl, CLR_OUTSIGHT); + nd->vd->sex = *val; + clif->spawn(&nd->bl); + } } int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data) @@ -71,6 +78,11 @@ int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, stru hookStop(); return ext->language; } + else if (!strcmp(name, ".sex")) + { + getNDReturn(0); + return nd->vd->sex; + } return 0; } diff --git a/src/emap/scriptdefines.h b/src/emap/scriptdefines.h index d35f71c..921df75 100644 --- a/src/emap/scriptdefines.h +++ b/src/emap/scriptdefines.h @@ -85,4 +85,14 @@ return false; \ } +#define getND() \ + TBL_NPC *nd = map->id2nd(st->oid); \ + if (!nd) \ + return; \ + +#define getNDReturn(def) \ + TBL_NPC *nd = map->id2nd(st->oid); \ + if (!nd) \ + return def; \ + #endif // EVOL_MAP_SCRIPTDEFINES |