summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-05-16 16:22:15 +0200
committerHaru <haru@dotalux.com>2015-05-16 16:28:36 +0200
commit6f2b524a4f1349a588bd5db4526b485eda7a6d2d (patch)
tree79c38faa01fac08eb98a42b5b6b534c6e43fdf29 /src/map
parentcfd20d2657db0b129e10acbd8787eea017fa5cbd (diff)
downloadhercules-6f2b524a4f1349a588bd5db4526b485eda7a6d2d.tar.gz
hercules-6f2b524a4f1349a588bd5db4526b485eda7a6d2d.tar.bz2
hercules-6f2b524a4f1349a588bd5db4526b485eda7a6d2d.tar.xz
hercules-6f2b524a4f1349a588bd5db4526b485eda7a6d2d.zip
Added charid2rid script command
- Returns the account ID (RID) for the given character ID. - As per Streusel's request. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 99d6f9088..898d341ed 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8105,6 +8105,23 @@ BUILDIN(strnpcinfo) {
return true;
}
+/**
+ * charid2rid: Returns the RID associated to the given character ID
+ */
+BUILDIN(charid2rid)
+{
+ int cid = script_getnum(st, 2);
+ TBL_PC *sd = map->charid2sd(cid);
+
+ if (sd == NULL) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ script_pushint(st, sd->status.account_id);
+ return true;
+}
+
/*==========================================
* GetEquipID(Pos); Pos: 1-SCRIPT_EQUIP_TABLE_SIZE
*------------------------------------------*/
@@ -19827,6 +19844,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getguildmember,"i?"),
BUILDIN_DEF(strcharinfo,"i"),
BUILDIN_DEF(strnpcinfo,"i"),
+ BUILDIN_DEF(charid2rid,"i"),
BUILDIN_DEF(getequipid,"i"),
BUILDIN_DEF(getequipname,"i"),
BUILDIN_DEF(getbrokenid,"i"), // [Valaris]