ソースを参照

- 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://svn.code.sf.net/p/rathena/svn/trunk@8162 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 年 前
コミット
85655282d4
4 ファイル変更81 行追加6 行削除
  1. 5 0
      Changelog-Trunk.txt
  2. 14 0
      doc/script_commands.txt
  3. 53 0
      src/map/script.c
  4. 9 6
      src/map/status.c

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/08/07
+	* Adjusted the order in which option/sc change packets are sent to match
+	  Aegis's [Skotlex]
+	* Added script command getpartyleader through which you can retrieve
+	  various information of a party's leader. See doc/script_commands.txt for
+	  further information. [Skotlex]
 	* mpeg's Ninja work [Vicious]
 	* Adjusted Battle_check_target so that alchemist summoned mobs are
 	  targetted by everyone as long as 1. The top-level master is a player and 2.

+ 14 - 0
doc/script_commands.txt

@@ -2067,6 +2067,20 @@ Example:
 
 ---------------------------------------
 
+*getpartyleader <party id>,[<type>];
+
+This function returns some information about the given party-id's leader. When type is ommitted, the default information retrieved is Character name of the party leader. Possible types are:
+
+	1: Leader account id
+	2: Leader character id
+	3: Leader's class
+	4: Leader's current map index
+	5: Leader's current level as stored on the party structure (may not be
+	   current level if leader leveled up recently).
+
+If retrieval fails (leader not found or party does not exists), "null" is returned instead of character name, and -1 is returned for the other types.
+
+---------------------------------------
 *getguildname(<guild id>)
 
 This function returns a guild's name given an ID number. If there is no such 

+ 53 - 0
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;
+}
+
 /*==========================================
  *Žw’èID‚̃Mƒ‹ƒh–¼Žæ“¾
  *------------------------------------------

+ 9 - 6
src/map/status.c

@@ -5469,9 +5469,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 		break;
 	}
 
-	if (vd && pcdb_checkid(vd->class_)) //Only for players sprites, client crashes if they receive this for a mob o.O [Skotlex]
-		clif_status_change(bl,StatusIconChangeTable[type],1);
-
 	// Set option as needed.
 	opt_flag = 1;
 	switch(type){
@@ -5590,9 +5587,13 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 			opt_flag = 0;
 	}
 
+	//On Aegis, when turning on a status change, first goes the option packet,
+	// then the sc packet.
 	if(opt_flag)
 		clif_changeoption(bl);
 
+	if (vd && pcdb_checkid(vd->class_)) //Only for players sprites, client crashes if they receive this for a mob o.O [Skotlex]
+		clif_status_change(bl,StatusIconChangeTable[type],1);
 	(sc->count)++;
 
 	sc->data[type].val1 = val1;
@@ -5603,6 +5604,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 	sc->data[type].timer = add_timer(
 		gettick() + tick, status_change_timer, bl->id, type);
 
+
 	if (calc_flag)
 		status_calc_bl(bl,calc_flag);
 	
@@ -5960,9 +5962,6 @@ int status_change_end( struct block_list* bl , int type,int tid )
 			break; //guess hes not in jail :P
 		}
 
-	if (vd && pcdb_checkid(vd->class_))
-		clif_status_change(bl,StatusIconChangeTable[type],0);
-
 	opt_flag = 1;
 	switch(type){
 	case SC_STONE:
@@ -6077,6 +6076,10 @@ int status_change_end( struct block_list* bl , int type,int tid )
 		opt_flag = 0;
 	}
 
+	//On Aegis, when turning off a status change, first goes the sc packet, then the option packet.
+	if (vd && pcdb_checkid(vd->class_))
+		clif_status_change(bl,StatusIconChangeTable[type],0);
+
 	if(opt_flag)
 		clif_changeoption(bl);