summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-31 22:52:58 +0000
committereathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-31 22:52:58 +0000
commitdc3d5221ddad6a0f94133bf8b83f9c0c76ff85b4 (patch)
tree60fc4245e5b0ef3aa050a1c59218438211be1a03 /src
parent5278174e72f1fe0b35dbe28e3295ee34f76bc821 (diff)
downloadhercules-dc3d5221ddad6a0f94133bf8b83f9c0c76ff85b4.tar.gz
hercules-dc3d5221ddad6a0f94133bf8b83f9c0c76ff85b4.tar.bz2
hercules-dc3d5221ddad6a0f94133bf8b83f9c0c76ff85b4.tar.xz
hercules-dc3d5221ddad6a0f94133bf8b83f9c0c76ff85b4.zip
* Merged changes up to eAthena 15085.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15819 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 6504c41cb..53a8e0fd9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6358,18 +6358,29 @@ BUILDIN_FUNC(getcharid)
*------------------------------------------*/
BUILDIN_FUNC(getnpcid)
{
- int num;
-
- switch (num = script_getnum(st,2)) {
+ int num = script_getnum(st,2);
+ struct npc_data* nd;
+
+ if( script_hasdata(st,3) )
+ {// unique npc name
+ if( ( nd = npc_name2id(script_getstr(st,3)) ) == NULL )
+ {
+ ShowError("buildin_getnpcid: No such NPC '%s'.\n", script_getstr(st,3));
+ script_pushint(st,0);
+ return 1;
+ }
+ }
+
+ switch (num) {
case 0:
- script_pushint(st,st->oid);
+ script_pushint(st,nd ? nd->bl.id : st->oid);
break;
default:
ShowError("buildin_getnpcid: invalid parameter (%d).\n", num);
script_pushint(st,0);
- break;
+ return 1;
}
-
+
return 0;
}
/*==========================================
@@ -15932,7 +15943,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(checkweight,"vi"),
BUILDIN_DEF(readparam,"i?"),
BUILDIN_DEF(getcharid,"i?"),
- BUILDIN_DEF(getnpcid,"i"),
+ BUILDIN_DEF(getnpcid,"i?"),
BUILDIN_DEF(getpartyname,"i"),
BUILDIN_DEF(getpartymember,"i?"),
BUILDIN_DEF(getpartyleader,"i?"),