From 02bb73a4a3c9b52a14da05997efd0381fe9f1403 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 15 Mar 2019 09:26:27 -0300 Subject: Replace built-in function getguildmember() to return their position too. Fine grained control is everything %%e Just don't make it overly complex as usual ^.^ --- src/emap/script_buildins.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/emap/script_buildins.c') diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 330b73b..4b41e0a 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -2466,3 +2466,48 @@ BUILDIN(setguildrole) } return true; } + +/*========================================== + * Get the information of the members of a guild by type. + * getguildmember {,}; + * @param guild_id: ID of guild + * @param type: + * 0 : name (default) + * 1 : character ID + * 2 : account ID + *------------------------------------------*/ +BUILDIN(getguildmember) +{ + struct guild *g = NULL; + int j = 0; + + g = guild->search(script_getnum(st,2)); + + if (g) { + int i, type = 0; + + if (script_hasdata(st,3)) + type = script_getnum(st,3); + + for ( i = 0; i < MAX_GUILD; i++ ) { + if ( g->member[i].account_id ) { + switch (type) { + case 2: + mapreg->setreg(reference_uid(script->add_variable("$@guildmemberaid"), j),g->member[i].account_id); + break; + case 1: + mapreg->setreg(reference_uid(script->add_variable("$@guildmembercid"), j), g->member[i].char_id); + break; + default: + mapreg->setregstr(reference_uid(script->add_variable("$@guildmembername$"), j), g->member[i].name); + break; + } + mapreg->setreg(reference_uid(script->add_variable("$@guildmemberpos"), j),g->member[i].position); + j++; + } + } + } + mapreg->setreg(script->add_variable("$@guildmembercount"), j); + return true; +} + -- cgit v1.2.3-70-g09d2