clashofclans.js 2.8.1 → 2.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## 2.8.3 (2022-09-13)
6
+
7
+ ### Bug Fixes
8
+
9
+ - Conflict with the same name of builder base and home base troops. ([#123](https://github.com/clashperk/clashofclans.js/pull/123))
10
+ - Fix the issue with the `Client#getLeagueWar()` method.
11
+
12
+ ### Features
13
+
14
+ - Clan Capital related properties and typings.
15
+
5
16
  ## 2.8.0 (2022-07-22)
6
17
 
7
18
  ### Features
@@ -131,7 +131,9 @@ class Client extends events_1.EventEmitter {
131
131
  if (args.round && args.round in Constants_1.CWL_ROUNDS) {
132
132
  return wars.find((war) => war.clan.tag === args.clanTag && war.state === state) ?? null;
133
133
  }
134
- return wars.find((war) => war.clan.tag === args.clanTag) ?? null;
134
+ return (wars.find((war) => war.clan.tag === args.clanTag && war.state === state) ??
135
+ wars.find((war) => war.clan.tag === args.clanTag) ??
136
+ null);
135
137
  }
136
138
  /** Returns active wars (last 2) of the CWL group. */
137
139
  async getLeagueWars(clanTag, options) {
@@ -70,31 +70,31 @@ class Player {
70
70
  /** An array of the player's home base troops. */
71
71
  get homeTroops() {
72
72
  return this.troops
73
- .filter((entry) => Constants_1.HOME_TROOPS.includes(entry.name))
73
+ .filter((entry) => entry.village === 'home' && Constants_1.HOME_TROOPS.includes(entry.name))
74
74
  .sort((a, b) => Constants_1.HOME_TROOPS.indexOf(a.name) - Constants_1.HOME_TROOPS.indexOf(b.name));
75
75
  }
76
76
  /** An array of the player's builder base troops. */
77
77
  get builderTroops() {
78
78
  return this.troops
79
- .filter((entry) => Constants_1.BUILDER_TROOPS.includes(entry.name))
79
+ .filter((entry) => entry.village === 'builderBase' && Constants_1.BUILDER_TROOPS.includes(entry.name))
80
80
  .sort((a, b) => Constants_1.BUILDER_TROOPS.indexOf(a.name) - Constants_1.BUILDER_TROOPS.indexOf(b.name));
81
81
  }
82
82
  /** An array of the player's super troops. */
83
83
  get superTroops() {
84
84
  return this.troops
85
- .filter((entry) => Constants_1.SUPER_TROOPS.includes(entry.name))
85
+ .filter((entry) => entry.village === 'home' && Constants_1.SUPER_TROOPS.includes(entry.name))
86
86
  .sort((a, b) => Constants_1.SUPER_TROOPS.indexOf(a.name) - Constants_1.SUPER_TROOPS.indexOf(b.name));
87
87
  }
88
88
  /** An array of the player's hero pets. */
89
89
  get heroPets() {
90
90
  return this.troops
91
- .filter((entry) => Constants_1.HERO_PETS.includes(entry.name))
91
+ .filter((entry) => entry.village === 'home' && Constants_1.HERO_PETS.includes(entry.name))
92
92
  .sort((a, b) => Constants_1.HERO_PETS.indexOf(a.name) - Constants_1.HERO_PETS.indexOf(b.name));
93
93
  }
94
94
  /** An array of the player's siege machines. */
95
95
  get siegeMachines() {
96
96
  return this.troops
97
- .filter((entry) => Constants_1.SIEGE_MACHINES.includes(entry.name))
97
+ .filter((entry) => entry.village === 'home' && Constants_1.SIEGE_MACHINES.includes(entry.name))
98
98
  .sort((a, b) => Constants_1.SIEGE_MACHINES.indexOf(a.name) - Constants_1.SIEGE_MACHINES.indexOf(b.name));
99
99
  }
100
100
  /** Get player's formatted link to open player in-game. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clashofclans.js",
3
- "version": "2.8.1",
3
+ "version": "2.8.4",
4
4
  "description": "JavaScript library for interacting with the Clash of Clans API",
5
5
  "author": "SUVAJIT <suvajit.me@gmail.com>",
6
6
  "license": "MIT",