2525
2626
2727from .players import ClanMember
28- from .miscmodels import try_enum , ChatLanguage , Location , Label , WarLeague , CapitalDistrict
28+ from .miscmodels import try_enum , ChatLanguage , Location , Label , BaseLeague , CapitalDistrict
2929from .utils import get , cached_property , correct_tag
3030from .abc import BaseClan
3131
@@ -48,11 +48,13 @@ class RankedClan(BaseClan):
4848 member_count: :class:`int`
4949 The number of members in the clan.
5050 points: :class:`int`
51- The clan's trophy-count. If retrieving info for capital or versus leader-boards, this will be ``None``.
52- versus_points: :class:`int`
53- The clan's versus trophy count. If retrieving info for regular or capital leader boards, this will be ``None``.
51+ The clan's trophy-count. If retrieving info for capital or builder base leader-boards, this will be ``None``.
52+ builder_base_points: :class:`int`
53+ The clan's builder base trophy count. If retrieving info for regular or capital leader boards, this will be
54+ ``None``.
5455 capital_points: :class:`int`
55- The clan's capital trophy count. If retrieving info for regular or versus leader boards, this will be ``None``.
56+ The clan's capital trophy count. If retrieving info for regular or builder base leader boards, this will be
57+ ``None``.
5658 rank: :class:`int`
5759 The clan's rank in the leader board.
5860 previous_rank: :class:`int`
@@ -63,7 +65,7 @@ class RankedClan(BaseClan):
6365 "location" ,
6466 "member_count" ,
6567 "points" ,
66- "versus_points " ,
68+ "builder_base_points " ,
6769 "capital_points" ,
6870 "rank" ,
6971 "previous_rank" ,
@@ -77,7 +79,7 @@ def _from_data(self, data: dict) -> None:
7779 data_get = data .get
7880
7981 self .points : int = data_get ("clanPoints" )
80- self .versus_points : int = data_get ("clanVersusPoints " )
82+ self .builder_base_points : int = data_get ("clanBuilderBasePoints " )
8183 self .capital_points : int = data_get ("clanCapitalPoints" )
8284 self .member_count : int = data_get ("members" )
8385 self .location = try_enum (Location , data = data_get ("location" ))
@@ -110,12 +112,14 @@ class Clan(BaseClan):
110112 The clan's location.
111113 points: :class:`int`
112114 The clan's trophy count. This is calculated according to members' trophy counts.
113- versus_points : :class:`int`
114- The clan's versus trophy count. This is calculated according to members' versus trophy counts.
115+ builder_base_points : :class:`int`
116+ The clan's builder base trophy count. This is calculated according to members' builder base trophy counts.
115117 capital_points: :class:`int`
116118 The clan's clan capital points. Unsure how this is calculated.
117119 required_trophies: :class:`int`
118120 The minimum trophies required to apply to this clan.
121+ required_builder_base_trophies: :class:`int`
122+ The minimum builder base trophies required to apply to this clan.
119123 required_townhall: :class:`int`
120124 The minimum townhall level required to apply to this clan.
121125 war_frequency: :class:`str`
@@ -126,9 +130,9 @@ class Clan(BaseClan):
126130 war_wins: :class:`int`
127131 The number of wars the clan has won.
128132 war_ties: :class:`int`
129- The number of wars the clan has tied.
133+ The number of wars the clan has tied. This is only available from the clan search endpoint else -1.
130134 war_losses: :class:`int`
131- The number of wars the clan has lost.
135+ The number of wars the clan has lost. This is only available from the clan search endpoint else -1.
132136 public_war_log: :class:`bool`
133137 Indicates if the clan has a public war log.
134138 If this is ``False``, operations to find the clan's current
@@ -145,9 +149,9 @@ class Clan(BaseClan):
145149 The type which the clan capital districts found in
146150 :attr:`Clan.capital_districts` will be of. Ensure any overriding of
147151 this inherits from :class:`coc.CapitalDistrict`.
148- war_league: :class:`coc.WarLeague `
152+ war_league: :class:`coc.BaseLeague `
149153 The clan's CWL league.
150- capital_league: :class:`coc.WarLeague `
154+ capital_league: :class:`coc.BaseLeague `
151155 The clan's Clan Capital league.
152156 """
153157
@@ -157,9 +161,10 @@ class Clan(BaseClan):
157161 "description" ,
158162 "location" ,
159163 "points" ,
160- "versus_points " ,
164+ "builder_base_points " ,
161165 "capital_points" ,
162166 "required_trophies" ,
167+ "required_builder_base_trophies" ,
163168 "war_frequency" ,
164169 "war_win_streak" ,
165170 "war_wins" ,
@@ -200,7 +205,7 @@ def _from_data(self, data: dict) -> None:
200205 data_get = data .get
201206
202207 self .points : int = data_get ("clanPoints" )
203- self .versus_points : int = data_get ("clanVersusPoints " )
208+ self .builder_base_points : int = data_get ("clanBuilderBasePoints " )
204209 self .capital_points : int = data_get ("clanCapitalPoints" )
205210 self .member_count : int = data_get ("members" )
206211 self .location = try_enum (Location , data = data_get ("location" ))
@@ -209,15 +214,16 @@ def _from_data(self, data: dict) -> None:
209214 self .type : str = data_get ("type" )
210215 self .family_friendly = data_get ("isFamilyFriendly" )
211216 self .required_trophies : int = data_get ("requiredTrophies" )
217+ self .required_builder_base_trophies : int = data_get ("requiredBuilderBaseTrophies" )
212218 self .war_frequency : str = data_get ("warFrequency" )
213219 self .war_win_streak : int = data_get ("warWinStreak" )
214220 self .war_wins : int = data_get ("warWins" )
215- self .war_ties : int = data_get ("warTies" )
216- self .war_losses : int = data_get ("warLosses" )
221+ self .war_ties : int = data_get ("warTies" , - 1 )
222+ self .war_losses : int = data_get ("warLosses" , - 1 )
217223 self .public_war_log : bool = data_get ("isWarLogPublic" )
218224 self .description : str = data_get ("description" )
219- self .war_league = try_enum (WarLeague , data = data_get ("warLeague" ))
220- self .capital_league = try_enum (WarLeague , data = data_get ("capitalLeague" ))
225+ self .war_league = try_enum (BaseLeague , data = data_get ("warLeague" ))
226+ self .capital_league = try_enum (BaseLeague , data = data_get ("capitalLeague" ))
221227 self .chat_language = try_enum (ChatLanguage , data = data_get ("chatLanguage" ))
222228 self .required_townhall = data_get ("requiredTownhallLevel" )
223229
@@ -227,8 +233,8 @@ def _from_data(self, data: dict) -> None:
227233 # update members globally. only available via /clans/{clanTag}
228234 member_cls = self .member_cls
229235 member_data = data .get ("memberList" , [])
230- for rank , mdata in enumerate (sorted (member_data , key = lambda x : x ["versusTrophies " ], reverse = True ), 1 ):
231- mdata ["versusRank " ] = rank
236+ for rank , mdata in enumerate (sorted (member_data , key = lambda x : x ["builderBaseTrophies " ], reverse = True ), 1 ):
237+ mdata ["builderBaseRank " ] = rank
232238 self ._iter_members = (
233239 member_cls (data = mdata , client = self ._client , clan = self ) for mdata in member_data
234240 )
0 commit comments