Battleground and clan support for addrid (#7969)

This commit is contained in:
HAO YAN 2023-12-11 15:47:00 +08:00 committed by GitHub
parent 461294f423
commit 7db67c6207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 1 deletions

View File

@ -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:

View File

@ -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.