浏览代码

Battleground and clan support for addrid (#7969)

HAO YAN 1 年之前
父节点
当前提交
7db67c6207
共有 2 个文件被更改,包括 33 次插入1 次删除
  1. 5 1
      doc/script_commands.txt
  2. 28 0
      src/map/script.cpp

+ 5 - 1
doc/script_commands.txt

@@ -4212,7 +4212,11 @@ invoking RID. It returns 1 if successful and 0 upon failure.
  4: All players in a specified area of the map of the invoking player (or NPC).
     [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  5: All players in the map.
-    [ Parameters: "<map name>" ]
+    [ Parameters: "<map name>" ] 
+ 6: Battleground members of a specified battleground ID.
+    [ Parameters: <battleground id> ]
+ 7: Clan members of a specified clan ID.
+    [ Parameters: <clan id> ]
  Account ID: If type is Account ID, attach the specified account ID.
 
 <flag> can prevent certain players from being attached:

+ 28 - 0
src/map/script.cpp

@@ -13179,6 +13179,10 @@ void script_detach_rid(struct script_state* st)
  *	    [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  *	5 : All players in the map.
  *	    [ Parameters: "<map name>" ]
+ *	6 : Battleground members of a specified battleground ID.
+ *	    [ Parameters: <battleground id> ]
+ *	7 : Clan members of a specified clan ID.
+ *	    [ Parameters: <clan id> ]
  *	Account ID: The specified account ID.
  * <flag>:
  *	0 : Players are always attached. (default)
@@ -13272,6 +13276,30 @@ BUILDIN_FUNC(addrid)
 			}
 			map_foreachinmap(buildin_addrid_sub, map_mapname2mapid(script_getstr(st, 4)), BL_PC, st, script_getnum(st, 3));
 			break;
+		case 6:
+			if (script_getnum(st, 4) == 0) {
+				script_pushint(st, 0);
+				mapit_free(iter);
+				return SCRIPT_CMD_FAILURE;
+			}
+			for (sd = (TBL_PC *)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC *)mapit_next(iter)) {
+				if (!forceflag || !sd->st)
+					if ((sd->status.account_id != st->rid) && (sd->bg_id == script_getnum(st, 4))) //attached player already runs.
+						run_script(st->script, st->pos, sd->status.account_id, st->oid);
+			}
+			break;
+		case 7:
+			if (script_getnum(st, 4) == 0) {
+				script_pushint(st, 0);
+				mapit_free(iter);
+				return SCRIPT_CMD_FAILURE;
+			}
+			for (sd = (TBL_PC *)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC *)mapit_next(iter)) {
+				if (!forceflag || !sd->st)
+					if ((sd->status.account_id != st->rid) && (sd->status.clan_id == script_getnum(st, 4))) //attached player already runs.
+						run_script(st->script, st->pos, sd->status.account_id, st->oid);
+			}
+			break;
 		default:
 			mapit_free(iter);
 			if((map_id2sd(type)) == NULL) { // Player not found.