Skip to content

Commit 8643baf

Browse files
committed
Added boss_points and bosstiary_progress to auctions.
1 parent 985cd1b commit 8643baf

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Changelog
66
Due to this library relying on external content, older versions are not guaranteed to work.
77
Try to always use the latest version.
88

9+
.. v.5.4.0
10+
11+
5.4.0 (2022-07-23)
12+
==================
13+
- Added `boss_points` and `bosstiary_progress` to auctions.
14+
915
.. v.5.3.0
1016
1117
5.3.0 (2022-07-22)

tibiapy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Tibia.com parsing and fetching library."""
2-
__version__ = '5.3.0'
2+
__version__ = '5.4.0'
33
__author__ = 'Allan Galarza'
44
__license__ = 'Apache-2.0 License'
55

tibiapy/bazaar.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,8 @@ class Auction(AuctionEntry):
873873
The amount of exalted dust the character has.
874874
exalted_dust_limit: :class:`int`
875875
The dust limit of the character.
876+
boss_points: :class:`int`
877+
The boss points of the character.
876878
items: :class:`ItemSummary`
877879
The items the character has across inventory, depot and item stash.
878880
store_items: :class:`ItemSummary`
@@ -903,6 +905,8 @@ class Auction(AuctionEntry):
903905
The achievements the character has unlocked.
904906
bestiary_progress: :class:`list` of :class:`BestiaryEntry`
905907
The bestiary progress of the character.
908+
bosstiary_progress: :class:`list` of :class:`BosstiaryEntry`
909+
The bosstiary progress of the character.
906910
"""
907911

908912
def __init__(self, **kwargs):
@@ -936,6 +940,7 @@ def __init__(self, **kwargs):
936940
self.hireling_outfits: int = kwargs.get("hireling_outfits", 0)
937941
self.exalted_dust: int = kwargs.get("exalted_dust", 0)
938942
self.exalted_dust_limit: int = kwargs.get("exalted_dust_limit", 0)
943+
self.boss_points: int = kwargs.get("boss_points", 0)
939944
self.items: ItemSummary = kwargs.get("items")
940945
self.store_items: ItemSummary = kwargs.get("store_items")
941946
self.mounts: Mounts = kwargs.get("mounts")
@@ -950,6 +955,7 @@ def __init__(self, **kwargs):
950955
self.titles: List[str] = kwargs.get("titles", [])
951956
self.achievements: List[AchievementEntry] = kwargs.get("achievements", [])
952957
self.bestiary_progress: List[BestiaryEntry] = kwargs.get("bestiary_progress", [])
958+
self.bosstiary_progress: List[BestiaryEntry] = kwargs.get("bosstiary_progress", [])
953959

954960
__slots__ = (
955961
"hit_points",
@@ -979,6 +985,7 @@ def __init__(self, **kwargs):
979985
"hireling_outfits",
980986
"exalted_dust",
981987
"exalted_dust_limit",
988+
"boss_points",
982989
"items",
983990
"store_items",
984991
"mounts",
@@ -994,6 +1001,7 @@ def __init__(self, **kwargs):
9941001
"titles",
9951002
"achievements",
9961003
"bestiary_progress",
1004+
"bosstiary_progress",
9971005
)
9981006

9991007
# region Properties
@@ -1087,6 +1095,8 @@ def from_content(cls, content, auction_id=0, skip_details=False):
10871095
auction._parse_achievements_table(details_tables["Achievements"])
10881096
if "BestiaryProgress" in details_tables:
10891097
auction._parse_bestiary_table(details_tables["BestiaryProgress"])
1098+
if "BosstiaryProgress" in details_tables:
1099+
auction._parse_bestiary_table(details_tables["BosstiaryProgress"], True)
10901100
return auction
10911101
# endregion
10921102

@@ -1226,7 +1236,7 @@ def _parse_achievements_table(self, table):
12261236
secret = col.find("img") is not None
12271237
self.achievements.append(AchievementEntry(text, secret))
12281238

1229-
def _parse_bestiary_table(self, table):
1239+
def _parse_bestiary_table(self, table, bosstiary=False):
12301240
"""Parse the bestiary table and extracts its information.
12311241
12321242
Parameters
@@ -1243,7 +1253,10 @@ def _parse_bestiary_table(self, table):
12431253
step_c, kills_c, name_c = [c.text for c in cols]
12441254
kills = parse_integer(kills_c.replace("x", ""))
12451255
step = int(step_c)
1246-
self.bestiary_progress.append(BestiaryEntry(name_c, kills, step))
1256+
if not bosstiary:
1257+
self.bestiary_progress.append(BestiaryEntry(name_c, kills, step))
1258+
else:
1259+
self.bosstiary_progress.append(BestiaryEntry(name_c, kills, step))
12471260

12481261
@classmethod
12491262
def _parse_page_items(cls, content, entry_class):
@@ -1320,11 +1333,14 @@ def _parse_general_table(self, table):
13201333
self.hirelings = parse_integer(hirelings_data.get("hirelings", ""))
13211334
self.hireling_jobs = parse_integer(hirelings_data.get("hireling_jobs", ""))
13221335
self.hireling_outfits = parse_integer(hirelings_data.get("hireling_outfits", ""))
1323-
if len(content_containers) == 9:
1336+
if len(content_containers) >= 9:
13241337
dust_data = self._parse_data_table(content_containers[8])
13251338
dust_values = dust_data.get("exalted_dust", "0/0").split("/")
13261339
self.exalted_dust = parse_integer(dust_values[0])
13271340
self.exalted_dust_limit = parse_integer(dust_values[1])
1341+
if len(content_containers) >= 10:
1342+
boss_data = self._parse_data_table(content_containers[9])
1343+
self.boss_points = parse_integer(boss_data.get("boss_points", ""))
13281344
# endregion
13291345

13301346

0 commit comments

Comments
 (0)