Added script function 'strnpcinfo', for increased npc awareness (originally from jAthena).
Updated script reference doc. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11650 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
e63e86fb83
commit
17eb2f7764
@ -3,6 +3,8 @@ Date Added
|
||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2007/11/03
|
||||
* Added jA script function 'strnpcinfo', for increased npc awareness
|
||||
2007/11/02
|
||||
* Fixed one wrong return value in buildin_getcharid (bugreport:33)
|
||||
* Removed the big list of BUILDIN_FUNC() declarations in script.c,
|
||||
|
@ -9,7 +9,7 @@
|
||||
//= Maeki Rika - A section on general concepts and lots of
|
||||
//= other updates and additions.
|
||||
//===== Version ===========================================
|
||||
//= 3.08.20071018
|
||||
//= 3.09.20071103
|
||||
//=========================================================
|
||||
//= 1.0 - First release, filled will as much info as I could
|
||||
//= remember or figure out, most likely there are errors,
|
||||
@ -88,6 +88,8 @@
|
||||
//= Fixed 'duplicate' missing the target 'name' parameter! [ultramage]
|
||||
//= 3.08.20071018
|
||||
//= Clarified how npc names work. [FlavioJS]
|
||||
//= 3.09.20071103
|
||||
//= Added script function 'strnpcinfo' [ultramage]
|
||||
//===== Description =======================================
|
||||
//= A reference manual for the eAthena scripting language,
|
||||
//= sorted out depending on their functionality.
|
||||
@ -1822,6 +1824,18 @@ returned when requesting that information.
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*strnpcinfo(<type>)
|
||||
|
||||
This function will return the various parts of the name of the calling npc.
|
||||
Whatever it returns is determined by type.
|
||||
|
||||
0 - The NPC's display name (visible#hidden)
|
||||
1 - The visible part of the NPC's display name
|
||||
2 - The hidden part of the NPC's display name
|
||||
3 - The NPC's unique name (::name)
|
||||
|
||||
---------------------------------------
|
||||
|
||||
*getarraysize(<array name>)
|
||||
|
||||
This function returns the number of values that are contained inside the
|
||||
|
@ -1781,6 +1781,12 @@ struct map_session_data * map_id2sd(int id)
|
||||
return (struct map_session_data*)idb_get(pc_db,id);
|
||||
}
|
||||
|
||||
struct npc_data * map_id2nd(int id)
|
||||
{// just a id2bl lookup because there's no npc_db
|
||||
if (id <= 0) return NULL;
|
||||
return (struct npc_data*)map_id2bl(id);
|
||||
}
|
||||
|
||||
/// Returns the nick of the target charid or NULL if unknown (requests the nick to the char server).
|
||||
const char* map_charid2nick(int charid)
|
||||
{
|
||||
|
@ -1324,6 +1324,7 @@ const char* map_charid2nick(int charid);
|
||||
struct map_session_data* map_charid2sd(int charid);
|
||||
|
||||
struct map_session_data * map_id2sd(int);
|
||||
struct npc_data * map_id2nd(int);
|
||||
struct block_list * map_id2bl(int);
|
||||
|
||||
#define map_id2index(id) map[(id)].index
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user