diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-03 22:07:47 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-03 22:07:47 +0000 |
commit | 647558b6b91166728157e6d5cfcdb14891295a66 (patch) | |
tree | f5a8c0ab46998b688bcd9cd35272fedd4fe64331 /src/map/script.c | |
parent | 686a1e31a3a10093ff7898e3df9961ad913a1a1d (diff) | |
download | hercules-647558b6b91166728157e6d5cfcdb14891295a66.tar.gz hercules-647558b6b91166728157e6d5cfcdb14891295a66.tar.bz2 hercules-647558b6b91166728157e6d5cfcdb14891295a66.tar.xz hercules-647558b6b91166728157e6d5cfcdb14891295a66.zip |
Added script function 'strnpcinfo', for increased npc awareness (originally from jAthena).
Updated script reference doc.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11650 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c index 0a308d3e6..a1b0834e0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6127,6 +6127,51 @@ BUILDIN_FUNC(strcharinfo) return 0; } +/*========================================== + * 呼び出し元のNPC情報を取得する + *------------------------------------------*/ +BUILDIN_FUNC(strnpcinfo) +{ + TBL_NPC* nd; + int num; + char *buf,*name=NULL; + + nd = map_id2nd(st->oid); + if (!nd) { + script_pushconststr(st, ""); + return 0; + } + + num = script_getnum(st,2); + switch(num){ + case 0: // display name + name = aStrdup(nd->name); + break; + case 1: // visible part of display name name + if((buf = strchr(nd->name,'#')) != NULL) + { + name = aStrdup(nd->name); + name[buf - nd->name] = 0; + } + break; + case 2: // # fragment + if((buf = strchr(nd->name,'#')) != NULL) + name = aStrdup(buf+1); + break; + case 3: // unique name + name = aStrdup(nd->exname); + break; + } + + if(name) + script_pushstr(st, name); + else + script_pushconststr(st, ""); + + return 0; +} + + unsigned int equip[10]={EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW}; /*========================================== @@ -12870,6 +12915,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(getguildmaster,"i"), BUILDIN_DEF(getguildmasterid,"i"), BUILDIN_DEF(strcharinfo,"i"), + BUILDIN_DEF(strnpcinfo,"i"), BUILDIN_DEF(getequipid,"i"), BUILDIN_DEF(getequipname,"i"), BUILDIN_DEF(getbrokenid,"i"), // [Valaris] |