diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-03-15 09:26:27 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-03-15 09:26:27 -0300 |
commit | 02bb73a4a3c9b52a14da05997efd0381fe9f1403 (patch) | |
tree | e85648eca013e0801861700661aa9437033e57da /src | |
parent | 030cf9c15212df4afcc0a34c1629a6c18b01c236 (diff) | |
download | evol-hercules-02bb73a4a3c9b52a14da05997efd0381fe9f1403.tar.gz evol-hercules-02bb73a4a3c9b52a14da05997efd0381fe9f1403.tar.bz2 evol-hercules-02bb73a4a3c9b52a14da05997efd0381fe9f1403.tar.xz evol-hercules-02bb73a4a3c9b52a14da05997efd0381fe9f1403.zip |
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 ^.^
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 45 | ||||
-rw-r--r-- | src/emap/script_buildins.h | 1 |
3 files changed, 47 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index e1f1206..3c81adb 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -216,6 +216,7 @@ HPExport void plugin_init (void) addScriptCommand("getguildexp","i",getguildexp); addScriptCommand("getguildnxp","i",getguildnxp); addScriptCommand("setguildrole","iiiis",setguildrole); + addScriptCommand("getguildmember","i?",getguildmember); do_init_langs(); 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 <guild_id>{,<type>}; + * @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; +} + diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h index ad1916d..6d4b6e9 100644 --- a/src/emap/script_buildins.h +++ b/src/emap/script_buildins.h @@ -106,5 +106,6 @@ BUILDIN(getguildavg); BUILDIN(getguildexp); BUILDIN(getguildnxp); BUILDIN(setguildrole); +BUILDIN(getguildmember); #endif // EVOL_MAP_SCRIPT_BUILDINS |