summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-09-12 19:01:35 +0200
committerHaruna <haru@dotalux.com>2014-09-12 19:01:35 +0200
commit413caf1464b89525c4c2fd3fa103bd1dd4bf3be7 (patch)
treef0a0c71421735e3db6d077dfb188026b46798371 /src/map
parent744c3fc19a6681b80eb3d679fdd3914c2d7099f8 (diff)
parentc84363d21866adb6d0fc994c0f44cc3fdce87350 (diff)
downloadhercules-413caf1464b89525c4c2fd3fa103bd1dd4bf3be7.tar.gz
hercules-413caf1464b89525c4c2fd3fa103bd1dd4bf3be7.tar.bz2
hercules-413caf1464b89525c4c2fd3fa103bd1dd4bf3be7.tar.xz
hercules-413caf1464b89525c4c2fd3fa103bd1dd4bf3be7.zip
Merge pull request #335 from AnnieRuru/request_2
Add *getguildmember script command
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 2c893219c..cbea20e55 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7407,6 +7407,49 @@ BUILDIN(getguildmasterid)
}
/*==========================================
+ * 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_str("$@guildmemberaid"), j),g->member[i].account_id);
+ break;
+ case 1:
+ mapreg->setreg(reference_uid(script->add_str("$@guildmembercid"), j), g->member[i].char_id);
+ break;
+ default:
+ mapreg->setregstr(reference_uid(script->add_str("$@guildmembername$"), j), g->member[i].name);
+ break;
+ }
+ j++;
+ }
+ }
+ }
+ mapreg->setreg(script->add_str("$@guildmembercount"), j);
+ return true;
+}
+
+/*==========================================
* Get char string information by type :
* Return by @type :
* 0 : char_name
@@ -18800,6 +18843,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getguildname,"i"),
BUILDIN_DEF(getguildmaster,"i"),
BUILDIN_DEF(getguildmasterid,"i"),
+ BUILDIN_DEF(getguildmember,"i?"),
BUILDIN_DEF(strcharinfo,"i"),
BUILDIN_DEF(strnpcinfo,"i"),
BUILDIN_DEF(getequipid,"i"),