Skip to content

Commit

Permalink
feat(ClanWar): add getMemberByMapPosition (#189)
Browse files Browse the repository at this point in the history
* feat(ClanWar): add getMemberByMapPosition

Add method to ClanWar to provide encapsulated functionality for getting a member by their map position in war.

* chore: bump package version to 3.3.11

* Update package.json

---------

Co-authored-by: Suvajit <[email protected]>
  • Loading branch information
ryancundiff and csuvajit authored Sep 29, 2024
1 parent a96b9d2 commit 7087d34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
"engines": {
"node": ">=16.x"
}
}
}
5 changes: 5 additions & 0 deletions src/struct/ClanWar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ export class WarClan {
return this.members.find((m) => m.tag === tag) ?? null;
}

/** Get a member of the clan for the given map position, or `null` if not found. */
public getMemberByMapPosition(mapPosition: number): ClanWarMember | null {
return this.members.find((m) => m.mapPosition === mapPosition) ?? null;
}

/** Get clan's formatted link to open clan in-game. */
public get shareLink() {
return `https://link.clashofclans.com/en?action=OpenClanProfile&tag=${this.tag.replace(/#/g, '')}`;
Expand Down

0 comments on commit 7087d34

Please sign in to comment.