summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorMurilo_Bio <murilopereti@gmail.com>2017-09-18 19:53:38 -0400
committergumi <mekolat@users.noreply.github.com>2017-09-19 17:18:45 -0400
commit97df01a69aa790ced8ecb90024ff646e1d9a4083 (patch)
tree20cf5979ea9aa010232ce6402c25b43362c2e11c /src/map/script.c
parent94b3f24afa5e77bf770fdf90cf446396165b82c6 (diff)
downloadhercules-97df01a69aa790ced8ecb90024ff646e1d9a4083.tar.gz
hercules-97df01a69aa790ced8ecb90024ff646e1d9a4083.tar.bz2
hercules-97df01a69aa790ced8ecb90024ff646e1d9a4083.tar.xz
hercules-97df01a69aa790ced8ecb90024ff646e1d9a4083.zip
allow buildin_getgroupid to take a GID
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 8ddb056bd..533e421d8 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9967,14 +9967,22 @@ BUILDIN(setgroupid) {
/// Returns the group ID of the player.
///
-/// getgroupid() -> <int>
-BUILDIN(getgroupid)
-{
- struct map_session_data *sd = script->rid2sd(st);
- if (sd == NULL)
+/// getgroupid({<account id>}) -> <int>
+BUILDIN(getgroupid) {
+ struct map_session_data *sd = NULL;
+
+ if (script_hasdata(st, 2)) {
+ sd = map->id2sd(script_getnum(st, 2));
+ } else {
+ sd = script->rid2sd(st);
+ }
+
+ if (sd == NULL) {
+ script_pushint(st, -1);
return true; // no player attached, report source
- script_pushint(st, pc_get_group_id(sd));
+ }
+ script_pushint(st, pc_get_group_id(sd));
return true;
}
@@ -23861,7 +23869,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(basicskillcheck,""),
BUILDIN_DEF(getgmlevel,""),
BUILDIN_DEF(setgroupid, "i?"),
- BUILDIN_DEF(getgroupid,""),
+ BUILDIN_DEF(getgroupid,"?"),
BUILDIN_DEF(end,""),
BUILDIN_DEF(checkoption,"i?"),
BUILDIN_DEF(setoption,"i??"),