From ebbf711e46f08a032fa4d55fed0e26c6296cd79b Mon Sep 17 00:00:00 2001 From: gumi Date: Sun, 18 Oct 2020 13:58:59 +0000 Subject: [PATCH 1/2] allow to use buildin_getcharid with an account id --- src/map/script.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/map/script.c b/src/map/script.c index b831d09a3a7..689fa920ed8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9290,10 +9290,15 @@ static BUILDIN(getcharid) int num = script_getnum(st, 2); struct map_session_data *sd; - if (script_hasdata(st, 3)) - sd = map->nick2sd(script_getstr(st, 3), false); - else + if (script_hasdata(st, 3)) { + if (script_isstringtype(st, 3)) { + sd = map->nick2sd(script_getstr(st, 3), false); + } else { + sd = map->id2sd(script_getnum(st, 3)); + } + } else { sd = script->rid2sd(st); + } if (sd == NULL) { script_pushint(st, 0); //return 0, according docs From 039b25128512ba95f38fcde552d785c9e2658ce5 Mon Sep 17 00:00:00 2001 From: gumi Date: Sun, 18 Oct 2020 14:03:39 +0000 Subject: [PATCH 2/2] update the documentation for buildin_getcharid --- doc/script_commands.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 72e122f2b8f..4dcccaea41d 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -2632,18 +2632,19 @@ bStr, bInt, bLuk --------------------------------------- *getcharid({, ""}) +*getcharid({, }) This function will return a unique ID number of the invoking character, or, if a character name is specified, of that player. Type is the kind of associated ID number required: -(0) CHAR_ID_CHAR - Character ID number. -(1) CHAR_ID_PARTY - Party ID number. -(2) CHAR_ID_GUILD - Guild ID number. +(0) CHAR_ID_CHAR - Character ID number. +(1) CHAR_ID_PARTY - Party ID number. +(2) CHAR_ID_GUILD - Guild ID number. (3) CHAR_ID_ACCOUNT - Account ID number. -(4) CHAR_ID_BG - Battle ground ID -(5) CHAR_ID_CLAN - Clan ID number. +(4) CHAR_ID_BG - Battle ground ID +(5) CHAR_ID_CLAN - Clan ID number. For most purposes other than printing it, a number is better to have than a name (people do horrifying things to their character names).