浏览代码

Expanded bg_get_data script command (#2179)

* Expanded bg_get_data script command.
* Now able accept type parameter of 1 to list account IDs of battleground members.
* Originally implemented by @AnnieRuru at https://rathena.org/board/topic/72571-b/
Jittapan Pluemsumran 7 年之前
父节点
当前提交
fa24b2134d
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. 2 0
      doc/script_commands.txt
  2. 7 1
      src/map/script.c

+ 2 - 0
doc/script_commands.txt

@@ -8906,6 +8906,8 @@ Example:
 Retrieves data related to given Battle Group. Type can be one of the following:
 Retrieves data related to given Battle Group. Type can be one of the following:
 
 
     0 - Amount of players currently belonging to the group.
     0 - Amount of players currently belonging to the group.
+    1 - Store GID of players in <Battle Group> in a temporary global array $@arenamembers
+		and returns amount of players currently belonging to the group.
 
 
 ---------------------------------------
 ---------------------------------------
 
 

+ 7 - 1
src/map/script.c

@@ -19571,7 +19571,7 @@ BUILDIN_FUNC(bg_get_data)
 {
 {
 	struct battleground_data *bg;
 	struct battleground_data *bg;
 	int bg_id = script_getnum(st,2),
 	int bg_id = script_getnum(st,2),
-		type = script_getnum(st,3);
+		type = script_getnum(st,3), i;
 
 
 	if( (bg = bg_team_search(bg_id)) == NULL )
 	if( (bg = bg_team_search(bg_id)) == NULL )
 	{
 	{
@@ -19582,6 +19582,12 @@ BUILDIN_FUNC(bg_get_data)
 	switch( type )
 	switch( type )
 	{
 	{
 		case 0: script_pushint(st, bg->count); break;
 		case 0: script_pushint(st, bg->count); break;
+		case 1:
+			for (i = 0; bg->members[i].sd != NULL; i++)
+				mapreg_setreg(reference_uid(add_str("$@arenamembers"), i), bg->members[i].sd->bl.id);
+			mapreg_setreg(add_str("$@arenamemberscount"), i);
+			script_pushint(st, i);
+			break;
 		default:
 		default:
 			ShowError("script:bg_get_data: unknown data identifier %d\n", type);
 			ShowError("script:bg_get_data: unknown data identifier %d\n", type);
 			break;
 			break;