summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-07 16:19:42 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-07 16:19:42 +0000
commitcdb9971c1511c4732ce08f0cb1c411a21abe8d77 (patch)
tree544b44af116a85d37906494259ab75454d62e958 /src/map/script.c
parent4f20e5d5ee48b1a56b78173b8e9e68a5dc2b0cd7 (diff)
downloadhercules-cdb9971c1511c4732ce08f0cb1c411a21abe8d77.tar.gz
hercules-cdb9971c1511c4732ce08f0cb1c411a21abe8d77.tar.bz2
hercules-cdb9971c1511c4732ce08f0cb1c411a21abe8d77.tar.xz
hercules-cdb9971c1511c4732ce08f0cb1c411a21abe8d77.zip
- Adjusted the order in which option/sc change packets are sent to match Aegis's
- Added script command getpartyleader through which you can retrieve various information of a party's leader. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8162 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index ff5795939..2b0585b18 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3293,6 +3293,7 @@ int buildin_readparam(struct script_state *st);
int buildin_getcharid(struct script_state *st);
int buildin_getpartyname(struct script_state *st);
int buildin_getpartymember(struct script_state *st);
+int buildin_getpartyleader(struct script_state *st);
int buildin_getguildname(struct script_state *st);
int buildin_getguildmaster(struct script_state *st);
int buildin_getguildmasterid(struct script_state *st);
@@ -3619,6 +3620,7 @@ struct script_function buildin_func[] = {
{buildin_getcharid,"getcharid","i*"},
{buildin_getpartyname,"getpartyname","i"},
{buildin_getpartymember,"getpartymember","i*"},
+ {buildin_getpartyleader,"getpartyleader","i*"},
{buildin_getguildname,"getguildname","i"},
{buildin_getguildmaster,"getguildmaster","i"},
{buildin_getguildmasterid,"getguildmasterid","i"},
@@ -5691,6 +5693,57 @@ int buildin_getpartymember(struct script_state *st)
return 0;
}
+
+/*==========================================
+ * Retrieves party leader. if flag is specified,
+ * return some of the leader data. Otherwise, return name.
+ *------------------------------------------
+ */
+int buildin_getpartyleader(struct script_state *st)
+{
+ int party_id, type = 0, i;
+ struct party_data *p;
+
+ party_id=conv_num(st,& (st->stack->stack_data[st->start+2]));
+ if( st->end>st->start+3 )
+ type=conv_num(st,& (st->stack->stack_data[st->start+3]));
+
+ p=party_search(party_id);
+
+ if (p) //Search leader
+ for(i = 0; i < MAX_PARTY && !p->party.member[i].leader; i++);
+
+ if (!p || i == MAX_PARTY) { //leader not found
+ if (type)
+ push_val(st->stack,C_INT,-1);
+ else
+ push_str(st->stack,C_CONSTSTR, (unsigned char *) "null");
+ return 0;
+ }
+
+ switch (type) {
+ case 1:
+ push_val(st->stack,C_INT,p->party.member[i].account_id);
+ break;
+ case 2:
+ push_val(st->stack,C_INT,p->party.member[i].char_id);
+ break;
+ case 3:
+ push_val(st->stack,C_INT,p->party.member[i].class_);
+ break;
+ case 4:
+ push_val(st->stack,C_INT,p->party.member[i].map);
+ break;
+ case 5:
+ push_val(st->stack,C_INT,p->party.member[i].lv);
+ break;
+ default:
+ push_str(st->stack,C_STR,(unsigned char *)p->party.member[i].name);
+ break;
+ }
+ return 0;
+}
+
/*==========================================
*指定IDのギルド名取得
*------------------------------------------